- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 05:35 AM
Hello developers,
i want catalog task to get assigned to various groups based on configurations on UI. i have stored the assignment group in a scratchpad variable, when im trying to assign it to catalog task
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 08:44 AM
Hi @servicenow14710,
Hmmm, interesting, but this may also point to the issue in that you're actually retrieving an object. Obviously, without first-hand sight, these are just thoughts out loud.
See and try the below slight tweak.
var spAmsGroupValue = workflow.scratchpad.amsGroup.toString(); //converting to a String object
var tskAmsGroup = spAmsGroupValue.trim(); //removing any white space
task.assignment_group = tskAmsGroup;
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 05:47 AM - edited 02-03-2025 05:48 AM
Hi @servicenow14710,
The syntax used to call the scratchpad value looks correct. Thinking out loud based on your confirmation and checking the logs, there maybe inadvertent/accidental white space either at the start or the end of the value.
Can you try something similar to the below just to be sure:
var spAmsGroupValue = workflow.scratchpad.amsGroup;
var tskAmsGroup = spAmsGroupValue.trim(); //removing any white space
task.assignment_group = tskAmsGroup;
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 07:49 AM
Hello @Robbie : I tried trim the assignment group id , but it throws error. attached in screen shot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2025 07:57 AM
try to use toString() and trim
task.assignment_group =workflow.scratchpad.amsGroup.toString().trim();
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-03-2025 08:44 AM
Hi @servicenow14710,
Hmmm, interesting, but this may also point to the issue in that you're actually retrieving an object. Obviously, without first-hand sight, these are just thoughts out loud.
See and try the below slight tweak.
var spAmsGroupValue = workflow.scratchpad.amsGroup.toString(); //converting to a String object
var tskAmsGroup = spAmsGroupValue.trim(); //removing any white space
task.assignment_group = tskAmsGroup;
To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie