Post

2 followers Follow
0
Avatar

Conditionally run getcustomactionurl at the end of a custom action

Hi,

I'm trying to automate a few actions for our users. I have a rollup summary field that counts the amount of active task. If the amount of active tasks equals 1 then I want to run a custom action when the last active task is marked as complete.

On a task level users use a custom action to mark their tasks as complete (for additional information). At the end of the task I want to conditionally check when the amount of active task equals 1, run a different custom action. This part works fine. But when the if-statement reaches the else part it keeps processing the request.

Console log output:
Uncaught DOMException: Failed to execute 'open' on 'Window': Unable to open a window with invalid URL 'http:'.

I only want to run a custom action when the expression is true, i want to stay on the same page when the expression is not true.

Custom action information:

  • CA part: Success (Optional)
  • Selected: Open URL (HTTP/HTTPS in a new window/tab)
  • Code:
{ if($ParentProject.C_numberofactivetasks = 1, GetCustomActionUrl( 'Review project', GetRuntimeParameter($ParentProject) ), null ) }

How can the expected result be achieved?

Yari Bernardus Answered

Please sign in to leave a comment.

1 comment

0
Avatar

Hello Yari,

I can think of two possible solutions:

1) Instead of returning null, return the URL of the CurrentObject(). This will cause the object you're on to open in a new tab.

2) Create a custom action that does not do anything and link to that custom action instead of null. I'm not sure of this will open a new tab. If it does, stick to option one.

There may be a better solution, but I can't think of anything else at the moment.

I hope this helps.

Roland

Roland Pumputis 0 votes
Comment actions Permalink