- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 07:18 AM
I have a piece of code copied from a global app to a scoped app and the "setDisplayValue()" command isn't working as expected. I don't see any documentation that suggests that the behaviour of "setDisplayValue()" is different in a scoped app.
Here's my code:
//4) as a last resort, get the default email from the property
if(intakeGroup == ''){
gs.info("Prioritization and Routing Check - Default");
intakeGroup = gs.getProperty('x_enig_commcase.commercial.processing');
}
...
/* If the Current User is Web Service and the Case Status is currently not Response Received nor On Hold */
if(isWebService && current.state!='12' && current.state!='11'){
//If no matching Records on the Priorization Matrix
if(!validGA || !validPrioritization){
gs.info("Prioritization and Routing Check - Point 99");
current.assigned_to = '';
//current.assignment_group = intakeGroup;
current.assignment_group.setDisplayValue(intakeGroup);
current.state = '1';
current.u_sla = '';
return;
}
}
If I store the SYSID of the group in the property, then the assignment group is set correctly.
If I store the NAME of the group, then the assignment group is NOT set.
The original code stores the NAME. I'd much prefer to keep it as is because otherwise I'll have to see where else that property is referenced and make other updates.
Does anyone know why this isn't working?
Solved! Go to Solution.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 11:52 AM
So I had a big long post with code snippets and log statements all write and then thought, hmmm ... let me just try copy/pasting the group name into the property (again.)
Apparently it was the "again" that did the trick, because now it's working.
I must have had a typo in the property name. 10 points from me.
Thanks for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 07:34 AM
Hi there,
Interesting. Like Chuck already mentioned, the setDisplayValue like how you are applying should be oke.
Have you debugged if intakeGroup gives you the expected value? I don't see your full script, so don't know. Though you might try adding .toString() for example.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field