help with onLoad client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a catalog item with the following checkbox. My requirement is to create onLoad client script that is if the 'Requested for' job code is 40 and above to show the Copilot checkbox, otherwise hide the field. Can someone help me with that client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
g_form.setVisible(“var_name”,false);
var code = g_form.getReference(“requested_for”,callback);
function callback(code)
{
if (code.job_code>=40)
g_form.setVisible(“var_name”, true);
}
Note: please verify and replace the field and variable names.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Jen11
Give this a try
function onLoad() {
g_form.setVisible('copilot_checkbox', false);
g_form.getReference('requested_for', function(user) {
if (user && user.job_code >= 40) {
g_form.setVisible('copilot_checkbox', true);
}
});
}
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I actually miss spoke, I meant approval lever is 40 and above and job code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
So where is that approval lever field? On user table? If yes same code will work you just need to use the correct field.
Raghav
MVP 2023