- 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-10-2022 08:15 PM
But is it getting saved when you open the submitted RITM?
if yes then it should be fine.
If not then use onChange
If my response helped please mark it correct and close the thread so that it benefits future readers.
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 08:27 PM
After saving the form the values are updated on another variables. So will utilise onSubmit.
Thanks for your help.