- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 07:14 AM
There is a check box variable in task 1, If check box value is set to 'true' then we need to create new task from workflow.
1st task short desc is (verify users license)
Need help guyz?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 07:47 AM
you can use IF activity in workflow with this script
Output of Yes -> Catalog Task
Output of No -> Next activity
answer = ifScript();
function ifScript(){
if(current.variables.variableName == 'true')
return 'yes';
else
return 'no';
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 07:42 AM
Sound like you just need to do a if after task 1 is closed to see if that variable is set to true. If it then you create the 2nd task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 07:44 AM
Hello @mastan babu ko1
What have tried? Is there any challenge?
See once your task 1 is complete/incomplete/skipped just proceed ahead and check with if activity whether value of variables as required or not if yes then create task 2 else skip task 2 creation.
Give a try and let us know if still any blocker.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 07:47 AM
you can use IF activity in workflow with this script
Output of Yes -> Catalog Task
Output of No -> Next activity
answer = ifScript();
function ifScript(){
if(current.variables.variableName == 'true')
return 'yes';
else
return 'no';
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 03:37 AM
But not sure but below script is always taking "No" even if previous field value is 'Yes'
Can any one suggest ?
function ifScript() {
var taskRec = new GlideRecord('sc_task');
taskRec.addQuery('request_item', current.sys_id);
taskRec.addQuery('short_description', 'Verify licensed users');
taskRec.query();
if (taskRec.next()) {
var rec = taskRec.variables.are_already_licensed_users;
if (rec == 'yes') {
return 'yes';
} else if (rec == 'no') {
return 'no';
}
}
var answer = ifScript();