- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:41 AM
hi all,
I'm using an IF activity within a workflow to determine a time value for a variable on a requested item. If my time variable is greater than a certain number I need to set the value of a variable on the requested item to "TRUE". However I'm getting errors when simply putting in a setValue statement. Anyone see my error? thanks!
if (diffSeconds > 1209600) { //startDate is more than 2 weeks away from the nowDate
var pause = current.variables["u_pause_sla"];//this is the variable on the sc_req_table I want to set to true if my "if" statement is met
g_form.setValue(pause, true);
return 'yes';
}
else {
return 'no';
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:46 AM
Hi Patrick,
g_form is a client side method and only available in a client script or ui policy on a form rather than in a workflow. Also, I think it's a better practice to separate out setting values from the if statement. I would add a run script workflow activity on the yes branch after the if activity that sets the variable to true using the current object.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:46 AM
Hi Patrick,
g_form is a client side method and only available in a client script or ui policy on a form rather than in a workflow. Also, I think it's a better practice to separate out setting values from the if statement. I would add a run script workflow activity on the yes branch after the if activity that sets the variable to true using the current object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:48 AM
thanks Brad, will do!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:47 AM
Hi Patrick,
Instead of using client script, do it using business rule.
Write an update onBefore business Rule
current.variables.u_pause_sla = true;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2017 10:49 AM
thanks Sanjiv,
I'm gonna go with a Set Values activity in the workflow.