Is Dot-Walking Supported in g_form.setReadOnly() in OOTB Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hello Team,
Below is an out-of-the-box (OOTB) client script. While reviewing it, I noticed a potential issue.
The client script uses dot-walking on a reference field to make it read-only. Is this the correct approach, or is this a ServiceNow bug? Based on my experience, the syntax looks incorrect to me, as we cannot use dot-walking in the g_form.setReadOnly() method.Could someone please guide me or share their inputs on this?
thank you.
Client Script name:LockGoal.strategyFieldAndHideOldGoal
Table:pm_project
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setReadOnly('primary_goal.strategy', true);
if (g_scratchpad.hasAtleastOneGoalOrStrategy) {
g_form.setVisible('goals', false);
g_form.setVisible('strategic_objectives', false);
g_form.hideRelatedList('goal');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited an hour ago
Hi @Mark Wood
I tested it and g_form.setReadOnly() makes dot walking on reference field read-only
Before script my incident form:
script used :
Validation ->After on load script :
If you find the answer helpful please mark the solution accepted/helpful
Regards,
Mohammed Zakir
