- 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:22 AM
Hi, per documentation:
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideElement-setDisplayValue_Object
Scoped equivalent:
To use the setDisplayValue() method in a scoped application, use the corresponding scoped method: setDisplayValue().
Which then links you to:
So you have to use the scope in conjunction with it, it appears.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 07:25 AM
I've used setDisplayValue() plenty of times in scoped apps, using properties in this same scenario (Assignment group even). It suggests the error is elsewhere. Have you looked in the logs to see if there is any trace of problem there?
- 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 11:59 AM
Thank you for the reply. I was just copy pasted your setDisplayValue method and it does work for me in Scoped App, i was keep thinking what went wrong.