- 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
@Cat , you can achieve this by creating a decision table and using it within your flow. The decision table can map each Team option to its corresponding description.
Then, in your flow, use the decision table output to update the RITM and Catalog Task descriptions accordingly.
Decision Tables in ServiceNow 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Thank you. The current form uses the Workflow Editor - is there a way to use the decision table with that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
@Cat , No decision table can't be used in workflow. try adding Run Script activity in your workflow and write a script like below
// Get the current RITM record
var ritm = current; // In a workflow, 'current' refers to the sc_req_item record
// Get the selected team variable (replace 'team' with your actual variable name)
var team = ritm.variables.team;
// Define the role descriptions for each team
var descriptions = {
"Team 1": "Please assign the following roles: Role1, Role2, Role3",
"Team 2": "Please assign the following roles: Role3, Role4, Role5",
"Team 3": "Please assign the following roles: Role2, Role5, Role6",
"Team 4": "Please assign the following roles: Role7, Role8, Role9"
// Add more mappings as needed
};
// Get the description based on selected team
var desc = descriptions[team] || "Please assign the appropriate roles as per the team selection.";
// Update the RITM description
ritm.description = desc;
ritm.update();
// Update all related Catalog Tasks
var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item', ritm.sys_id);
sctask.query();
while (sctask.next()) {
sctask.description = desc;
sctask.update();
}
- 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
 
					
				