- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi All,
I'm hoping someone can help me with this.
I have a requirement to be able to populate the description of the request item/catalog task based on what was chosen in a variable.
For example, I have a variable called Team which has 10 different options. If Team 1 is selected, I need the description to say something like "Please assign the following roles: Role1, Role2, Role3". If Team 2 is selected, I need the description to say "Please assign the following roles: Role3, Role4, Role5" and so on.
What would be the best way for me to do this?
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
you can use Advanced Script in Catalog Task Activity of workflow and set the Description of SC Task
var val = current.variables.variableName; // give variable name here
// use the correct choice values to compare
if (val == 'Team1')
task.description = 'Please assign the following roles: Role1, Role2, Role3';
else if (val == 'Team2')
task.description = 'Please assign the following roles: Role3, Role4, Role5';
// and so on
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Thank you - this worked best for my purposes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Hi @Cat ,
Please check below script maybe it will help you
(function execute(current, previous) {
var team = current.variables.team; // Replace 'team' with your variable name
if (!team) {
return;
}
if (team == 'team1') {
current.description = "Please assign the following roles: Role1, Role2, Role3";
current.update();
}
else if (team == 'team2') {
current.description = "Please assign the following roles: Role3, Role4, Role5";
current.update();
}
else {
current.description = "Team selection captured. Please review assignment needs.";
current.update();
}
})(current, previous);
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Thank you - Where would I apply this script? Is it in the workflow? Before or after the task is created?
