OnChange Client script on variable in a variable editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 09:14 PM
Hi All,
Has someone found a solution to build a client script on change of value in a variable which is part of a variable editor?
Basically, I want to dynamically hide/display variables in a variable editor based on the change of value of a Numeric Scale type variable in the variable editor.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 09:26 PM
Write an OnChange client script/catalog client script to show/hide variables? What is the challenge you are facing for your issue? Can you share the script and elaorate your scenario on what needs to be achieved?
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 09:48 PM
Hi Shloke,
Thanks for the response.
Catalog client scripts work on the actual catalog item and not on the variable editor as far as I know. The scenario that I have a question about is - User fills a form on portal and submits the form. It creates a request in ServiceNow. Details filled by the user on the portal are captured as part of variables in a variable editor and displayed on the request created in ServiceNow. Now, user needs to modify value in the variable in this variable editor based on which corresponding variables in the editor should be displayed/hidden.
When you open a new OnChange client script for a table, you can build the script for actual form fields like state, priority etc. but not on the variables which are captured in the variable editor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 04:18 PM
Hi,
You can do your validations for Variable editor also. As mentioned above a catalog client script should work on variable editor also(Make Sure you have marked the following checkboxes on the catalog client script form as TRUE (Applies on Requested Items & Applies on Catalog Tasks) as shown below. For reference, go through the below scenario:
1) I have a sample catalog item with a Variable called "Select Choices" having value as Test1 & Test 2.
2) Submitted the form with the value selected for Select choices variable as "Test 1".
3) Post Submission, If I change the value of this variable to "Test 2", based on which I am hiding another variable called Location in Variable Editor.
4) Please refer the below screenshot for a sample script, similarly you can build your own logic for the requirement needed.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 04:57 PM
Hi Shloke,
Apologies, I did not make it clear earlier that I'm using a record producer which creates a record in a custom module. The moment you select a record producer as the catalog item in a new catalog client script, you can see only 'Applies on Catalog Item view' option. Applies on Requested Items & Applies on Catalog Tasks cannot be seen in this case (There is an OOB client script which hides these options if you are using a record producer)