System Property throwing error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 03:41 AM
Hello Team
We are using Below Scripts but the script throwing an error message in Service portal
Not allowed to update the property : property name
var GRPSYS_ID = 'd625dccec0a8016700a222a0f7900d06'; //Put the sys_id of the assignment group (or groups comma separated) here. Or set this in a system property and grab it here.
var lstAssigned = gs.getProperty("rr.last_assigned_to"); //Get the sys_id of the user most recently assigned to by this rule.
//Make an array of all users in the group(s), ordered alphabetically by name:
var userList = [];
var userHasGroup = new GlideRecord('sys_user_grmember');
userHasGroup.addQuery('available', true);
userHasGroup.addQuery('group', 'IN', GRPSYS_ID);
//userHasGroup.orderBy('user.name');
userHasGroup.query();
while (userHasGroup.next())
userList.push(userHasGroup.getValue('user'));
var nextUserIndex = userList.indexOf(lstAssigned) + 1;
if (nextUserIndex == userList.length)
nextUserIndex = 0;
var nextUser = userList[nextUserIndex];
current.assigned_to = nextUser;
gs.setProperty("rr.last_assigned_to", nextUser); //Update the property with the sys_id of the user most recently assigned to by this rule.
This is for Round Robin ,Any thoughts how to fix this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 11:25 PM
Yeah, that looks correct. If your issue is resolved then please mark appropriate answer as Correct or Helpful.
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 04:51 AM
Hello Abhijit
But the script is not working ,It is assigning to same user ,Could you Please look
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2022 11:03 PM
Hello Abhijit
Any Update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 05:11 AM
Did you check what value are you getting in nextUser variable after below assignment?
var nextUser = userList[nextUserIndex];
It should give other user than what you have in custom table, then you can say your issue is resolved.
Also below line :
userHasGroup.addQuery('available', true);
There is no 'available' field on ' sys_usergrpmember table, make sure you have written that part of code correctly, if you have created custom field then it should have been u_available.
Please mark answer as Correct or Helpful based on impact.
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 07:20 AM
Hello Abhijit
It is giving the same user every time I have put in my custom table value field
Could you please look and it is u_available updated in script?