- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2017 06:39 AM
I'm a ServiceNow beginner and I'm wondering if someone could help me with this please.
I have to create a task for a particular team if the user chooses 'yes' for a condition on the form. Any suggestions would be great.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2017 07:58 AM
Hello,
If you want this for Service catalog then You need to do this in Workflow. Create a if block with the below condition and create task if condition is yes.
Here is the sample screenshot:
Script:
answer = ifScript();
function ifScript() {
if (current.variables.field_name == 'true') { // Update the field name with original field name
return 'yes';
}
return 'no';
}
Thanks,
Arindam

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2017 06:41 AM
you can use if condition activity in your workflow and set the condition there. based on it add catalog task activity.
Condition Activities - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2017 06:43 AM
You can do this in a couple of ways. The first one that comes to mind is a business rule. This can be triggered when the record is saved (thus recognizing the value "Yes".) Something like:
Name: Create task on Yes
Table: Your table where you are watching for the record to change to "yes"
Advanced: true
Insert: true
Update: true
When: After
Condition: current.fieldname.changesTo("yes") // where fieldname is the field you are changing to yes
Script:
(function executeRule(current, previous /*null when async*/) {
var newTask = new GlideRecord('task_table_name'); // change to your task table name
newTask.newRecord();
newTask.short_description = 'This is an auto generated task';
// set other fields with newTask.fieldname = value; here
newTask.insert();
gs.addInfoMessage('New task created');
})(current, previous);
Reference:
Docs: Business Rules
Developer: Business Rules Technical Best Practices Overview
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2017 07:58 AM
Hello,
If you want this for Service catalog then You need to do this in Workflow. Create a if block with the below condition and create task if condition is yes.
Here is the sample screenshot:
Script:
answer = ifScript();
function ifScript() {
if (current.variables.field_name == 'true') { // Update the field name with original field name
return 'yes';
}
return 'no';
}
Thanks,
Arindam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2017 06:04 AM
If I answer your question, Can you Please Mark the answer correct to remove this from unanswered list.
Thanks,
Arindam