- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 06:30 AM
when state is close complete then it should make the field readonly after saving the form on sc_task
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 07:05 AM
Use Below onLoad Client Script:- It will work after saving the record
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('state') == '3') {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
// by default the mandatory fields can not be set as readonly
// Make the field non-mandatory before making it readonly
g_form.setMandatory(fields[x], false);
g_form.setReadOnly(fields[x], true);
}
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Gunjan Kiratkar
Consultant - ServiceNow, Cloudaction
Rising Star 2022
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 07:02 AM
But i want after saving the form it should make fields readonly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 07:23 AM
Yes, Ater the form is saved the form gets reloaded and above logic works
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP