- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 12:52 AM - edited 12-03-2024 03:40 AM
Hi Experts,
Could you please help me making the fields of Update ALL/Update selected form read only using Client script or UI policy.
As we do not want user to update particular fields using bulk update functionality.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 08:19 AM
Hi @Harshal Aditya ,
How about this.
create a new view and remove the field that you don't want the users to edit and update the "Update all" and "Update selected" context menu (sys_ui_context_menu) and put the force the users to be new view by setting
sysparm_view to new view that's created.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 01:12 AM
Not 100% sure, but did you try oncell edit client script?
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 01:14 AM
Hello @Harshal Aditya
You can try this code in client script:
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getTableName() === 'sys_user') { //update table name
// List of fields to restrict
var restrictedFields = ['first_name', 'last_name', 'email']; //update field names
// Loop through restricted fields and make them read-only
restrictedFields.forEach(function (field) {
g_form.setReadOnly(field, true);
});
}
}
"If you found my answer helpful, please give like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 06:42 AM
Hi @Juhi Poddar - Thanks for the update. Client script and UI policy are not working on the update all/update selected form.
Is there any way we can enable it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 08:19 AM
Hi @Harshal Aditya ,
How about this.
create a new view and remove the field that you don't want the users to edit and update the "Update all" and "Update selected" context menu (sys_ui_context_menu) and put the force the users to be new view by setting
sysparm_view to new view that's created.
Regards,
Chaitanya