Client Script – Approval Remark Control
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
1.If logged-in user does NOT have Travel Approver role, make Approval Remark field read-only.
2. Users with approver role should be able to edit it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @foramp
function onLoad() {
g_form.setReadOnly(
'approval_remark',
!g_user.hasRole('travel_approver') ? true : false
);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @foramp ,
Please refer this code :
function onLoad() {
//Type appropriate comment here, and begin script below
if(!g_user.hasRoleExactly('itil'))//add your required role here
{
g_form.setReadOnly('u_short_description',true)//add your required field here
}
}
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
use this and give correct field name and role name
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setReadOnly('approval_remark', !g_user.hasRoleExactly('travel_approver')) // your field name here
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
