- 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 06:18 PM
Hi,
Glad you figured it out. As was alluded to in my post below as well...check the spelling/typo, etc.
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-11-2020 12:14 PM
Copy and paste - always a programmer's best (and worst) friend. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 07:32 AM
Hi,
As Chuck mentioned, it does work, so something else is going on. For example, I created a sys_property named "store_group_name" and ensured it was String type and value was only Service Desk...then I did this in background script on my PDI to test:
var gr = new GlideRecord('incident');
gr.addQuery('number', 'INC0000601');
gr.query();
if (gr.next()) {
var gName = gs.getProperty('store_group_name');
gs.print(gName);
gr.assignment_group.setDisplayValue(gName);
gr.update();
}
End result:
Now I know this is for Incident, but setDisplayValue should be working for scoped app as well.
I would double-check that this assignment group is eligible for selection in that reference field? And that it exists and spelled correctly?
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:33 AM
I agree with Chuck's feedback and suggest the following diagnostic activities:
1. view the values being captured in the variable in each process and compare to see if perhaps the value must be converted in order to be manipulated (e.g. convert a string to an integer as an example).
2. also I suggest expanding your focus beyond the code snippets you've included in this post, and consider that the logic assigning the value to the target variable may also have consequences on the desired outcome.
I am sorry I cannot provide the solution as the code snippet is small, but hopefully I have encouraged you to escape the "code box" and thus find success by changing your perspective on the problem.
Kind Regards,
Woody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 07:54 AM
As a novice develloper (see, I am still learning how to spell it) I have used a process whereby I automatically assign the unique value to a new column field in each record which contains the desired value in the desired format, then I can easily capture that value and use it to display/assign to a working variable or a field in a different table. But this is a sloppy approach suggested by a novice develloper, but it helped me meet a deadline...
Kind Regards,
Woody