How to stop Mass Update by using update selected and update all context menu from the table

AdityaKPMG17
Tera Contributor

Hi All,

I want to stop the update selected Context based on the managed by group:

Ie: I should only be able to update only those CI with managed by group which i am part of:

suppose there are

5 CI with managed by group A

2 CI with managed by group B

and 3 CI with Managed by group as empty

 

Now from the table view if i select all of these CI and click on Update Selected then me being part of group A should be able to edit only those CI which have Managed by group as A.


Please provide any solution / documentation/ or insights if this is even possible or not.

Thankyou so much.

FYI:

AdityaKPMG17_0-1750422371283.png

 

 

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @AdityaKPMG17 

You need to create an ACL or add a client script where you check if the user is part of a specific group. The client script should be triggered on cell edit.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi Atul, 

The update selected opens up a new form with no values and any value filled there updates the selected record from the list side, so can there be any other solution appart from on cell edit CS ?

Hi @AdityaKPMG17 

I just learned something new — when you choose "Update Selected", it opens a new form, and you won’t see any pre-filled values initially.

That’s because you’re expected to set the values in that form manually, and all the records you selected in the list view will be updated with the values you enter in the form.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

TippaluruK
Giga Contributor

Hello,

 

1. Business Rule Setup
Table: cmdb_ci (or your custom CI table)
 
When: Before
 
Insert: uncheck
 
Update: check
 
Delete: uncheck
 
Advanced: check
 
Condition: Leave blank or add current.managed_by_group.changes() (optional)
 
Script:
 
 
// Only apply on list updates
if (!gs.hasRole('admin') && GlideScriptRecorder.get()) {
var userID = gs.getUserID();
var userGR = new GlideRecord('sys_user');
userGR.get(userID);
 
var userGroups = [];
var grGroup = new GlideRecord('sys_user_grmember');
grGroup.addQuery('user', userID);
grGroup.query();
while (grGroup.next()) {
userGroups.push(grGroup.group.sys_id.toString());
}
 
if (current.managed_by_group && userGroups.indexOf(current.managed_by_group.toString()) === -1) {
gs.addErrorMessage('You cannot update this CI. You are not part of the Managed by group: ' + current.managed_by_group.getDisplayValue());
current.setAbortAction(true);
}
}
 
 
Thanks,
Kishore.