need help in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2024 10:42 PM
Hi Team ,
can anyone please help me with this issue
In RITM form i have configured custom fields
I have wirtten business rule and cilent script for this
cilent script
function onLoad() {
//Type appropriate comment here, and begin script below
var b = g_scratchpad.ritmvisble; //Value from BR -Checking if user is part of tech hub or Operations team- if logged user is member of either AVN-TechHub-SUP / CFS_ITOperations_OPS_APR or not.
if (b) {
// g_form.setDisplay('u_escalation', true);
// g_form.setDisplay('u_escalation_comments', true);
g_form.setReadOnly('u_escalation', false);
g_form.setReadOnly('u_escalation_comments', false);
g_form.setReadOnly('u_esc_by_ritm', false);
g_form.setReadOnly('u_esc_date_time_ritm', false);
} else {
g_form.setReadOnly('u_escalation', false);
g_form.setReadOnly('u_escalation_comments', false);
g_form.setReadOnly('u_esc_by_ritm', false);
g_form.setReadOnly('u_esc_date_time_ritm', false);
}
}
That escalted field should only enable only for Tech hub team .
'while doing testing 'Gunjan ' is the tech hub team , i have impersonated with his profile
I am getting this error
And form saving fields should be gerdout
Can anyone please help me with this?
Please provide me the updated script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2024 11:37 PM
Hello @nameisnani
There are few points from your script and configuration shown in the screenshots:
- Business rule will get triggered when state is pending or work in progress
- Your RITM is in state open therefore business rule will not get triggered
- The onload client script is setting the read-only fields false for both the if-else condition.
As per my understanding you want fields to be read-only when the RITM form loads and state is pending or work in progress. This can be achieved by client script or UI policy alone.
"If you found my answer helpful, please 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
12-09-2024 06:42 AM
https://www.servicenow.com/community/developer-forum/need-help-in-script-v1/td-p/3122846
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark