System Property throwing error

Hemant Kumar Ch
Kilo Sage

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 

19 REPLIES 19

Muhammad Khan
Mega Sage
Mega Sage

It could be because of (Can update configuration of sys_properties table)

MuhammadKhan_0-1667822230640.png

or (Write roles configuration of your property)

MuhammadKhan_1-1667822271485.png

 

Hello

Can update is enabled and i cannot give write property,This is for incidents many user will raise an incident 

Abhijit4
Mega Sage

You may try using GlideRecord on sys_properties table and update it.

 

Setting value of system property may lead to performance issue. Please read below.

 

 

The GlideSystem method gs.setProperty() sets the value of a system property from a server-side script. Use gs.setProperty with EXTREME caution. It causes cache flushes which can lead to performance issues during the flush. Property values should be set manually.

Source : https://developer.servicenow.com/print_page.do?release=tokyo&category=course-module&identifier=app_s... 

 

Please mark answer as Correct or Helpful based on impact.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Hello Abhijit

Could you please help me in updating the script? 

 

Please ,Its somewhat urgent 

 

If updating through GlideRecord,will solve the issue?