Client script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 08:28 AM
Hi Everyone,
Hi everyone,
I am trying to make variables mandatory after the request has been submitted, if the user has the pmsubmitter rule and if a custom field additional information is set to yes. I'm attempting to do this with a onchange client script using the field additional information. Below are the 2 scripts I have tried that have gotten the closest results (tired several others with not luck) The first script results: when I impersonate a user after the request has been submitted, with the pmsubmitter role the platform is showing a black * instead of red indicating the field is required. In addition, the user that submits the request needs to be able to show these variables as required on the portal after summitted and their manager selects Yes at additional information. Unfortunately the variables are not getting set as required on the portal. Is this possible? In the past I've utilized sctasks and a flow to achieve.
first script- will only set test4 required if user with pmsubmitter selects yes at additonal informaiton. However, a user with PM role (manager) will be the one selecting yes at additional information
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (g_user.hasRoleExactly("pmsubmitter"))
if (newValue === 'Yes') //yes
g_form.setMandatory('test4', true);
else
g_form.setMandatory('test4', false);
}
second script- not making anything required
Thank you in advance for any guidance you can provide!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:46 AM
I also tried the following onchange scirpt with no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2023 03:30 PM - edited 09-10-2023 03:32 PM
@Gemma4 When you are writing onchange script please write on load for the script also as below.
onChange of Additionion informtion
- function onChange(control, oldValue, newValue, isLoading, isTemplate) {
}