- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:00 PM
Hi Folks,
I have run into a issue with Workflow Run Script Conditions. The Conditions are not working.
Run Script Code
answer = ifScript();
function ifScript() {
var ftest = workflow.scratchpad.cait;
if (ftest == '3')
{
return 3;
}
if(ftest == '4')
{
return 4;
}
if(ftest == '12')
{
return 12;
}
}
I need the activity.result output based on the code conditions and i'm passing the value from scratchpad variable. Any help is appreciated.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:07 PM
change the first line to activity.result = ifScript() and you should be good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:07 PM
change the first line to activity.result = ifScript() and you should be good.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:09 PM
Hi Venkat,
How did you defined cait variable
The workflow scratchpad can store multiple data types, including:
- Primitives such as integers, boolean values, or strings.
- JavaScript Objects such as user data.
- Scriptable Java Objects such as GlideRecord or GlideDateTime.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 12:15 PM
// This script needs to set answer to 'yes' or 'no' to indicate the state of the activity.
//
// For example,
//
workflow.scratchpad.result = ifScript();
function ifScript() {
var result = {thr:false, fou:false, twe:false, none:false};
if (JSUtil.notNil(workflow.scratchpad.deployedBy)) {
if (workflow.scratchpad.cait == '3') {
result.thr = true;
}
if (workflow.scratchpad.cait == '4') {
result.fou= true;
}
if (workflow.scratchpad.cait == '12') {
result.twe = true;
}
}
if (!(result.twe || result.fou || result.thr)) {
result.none = true;
}
return result;
}
Add this below code in condition field of if condition blocks:
workflow.scratchpad.result.twe == true