- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 07:35 AM
Hey everyone,
I have a service catalog item where I created a new Yes/No field called "Have you tried the "Forget Your Password" option on the SF Login Site?" If the user selects "No" then a popup should display with directions.
I created an onChange client script and it does not do anything. I've confirmed that Active and Global are checked, the UI type is All, it's in the sc_cat_item table, type is onChange, and the script is below. What could I be missing?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//User selects NO, this is the message they see
if (newValue === 'have_you_tried_the_forget_your_password_option_on_the_sf_login_site' == NO){
alert(getMessage('Please use the password reset from the SF Login Site before submitting this request.'));
}
}
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:55 AM
Hi @nebula,
Make sure you have created Catalog Client scripts instead if Client scripts.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:00 AM
Hi @nebula,
Select the variable name that you have created. It will work.
Take a look at - Catalog client scripts / Client scripts
Note- onChange() — runs when a particular field value changes on the form. The onChange() client script must specify these parameters/ field/ variable.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:36 AM
@Sagar Pagar thank you for your support. When I go to the Field name drop down, it does not show the variable name I had created in the list. If I go to the portal, it does display so I know it is active.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 08:55 AM
Hi @nebula,
Make sure you have created Catalog Client scripts instead if Client scripts.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 09:28 AM
That was it!! A very valuable lesson I've learned. Thank you @Sagar Pagar for your support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 07:42 AM
Try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//User selects NO, this is the message they see
if (newValue == 'No'){
alert(getMessage('Please use the password reset from the SF Login Site before submitting this request.'));
}
}