- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 10:30 PM
Hi all,
I am new to scripting and trying to get my head around with this. I am trying to copy single line text variable value available on the form to another single line text variable value which is only visible in VEditor. Below is the Client script with type onSubmit but it doesn't seem to work.
function onSubmit() {
//Type appropriate comment here, and begin script below
var businessPhone = g_form.getValue('business_phone');
var testPhone = g_form.getValue('test_phone');
if (testPhone =='');
g_form.setValue('test_phone', businessPhone);
}
I will be extending this script to include multiple single line text variables and copy them to another single line text variables so onChange might not work as i would have to create multiple scripts.
Please let me know how can I go about this.
Thank you
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 06:46 PM
Hi
I used the onSubmit script and it did update the another single line text variables.
Is that a good solution ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2022 10:43 PM
Hi,
don't use onSubmit
Please use workflow run script to set the other variable
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 01:33 PM
is there any other way instead of using workflow ? i would ideally like to use catalog client scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 06:33 PM
then why not use onChange client script on the business phone variable
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 06:46 PM