client script on dot walk fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 10:21 AM
Hi,
Is there a way to run a client script against a dot walk fields? I have a client script to check the format of requiter's phone number. It works well when user change phone number from the requester form.
But , this field is dot walked into the main case form via the requester reference field, when user change the phone number from the main case from, it goes through to the requester record without check the format, I try to get the client script on the main case form, but could not find the field (no dot walk from the field list for client script)
could some suggest a way to check the phone format on the dot walked field? Or I missed something?
Thanks!
Jerry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 11:39 AM
Question 1: Did the change translate from the "main case" form to the "requester form"?
Question 2: Is the "main case" form a record of the table User?
Question 3: What the client script looks like?
Question 4: What the client script does for your development?
If you answer "yes" to questions 1 and 2, you should use a business rule to validate the User table telephone format to stop any users put in different format. Then, you do not need a client script to check the format of a requester's phone number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 11:50 AM
HI yitsal,
Yes to 1, The main case form is something like a incident form
Business rule react only after the user click save,
we do need to client script on the requester form, which will also be used fpr creating,, modify requester records directly on the form.
Thanks!
Jerry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 11:42 AM
Hi Jerry,
I don't think it's possible to create onChange Client Script script on dotwalking field. You need to use g_form.getReference in your client script. You can create the onChange Client script on your main field (requester) and then getrefernce to phone number to validate if it's valid or not, Please find below sample and references that will help you.
functio
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading)
return;
// If User is empty, clear
if (newValue == '') {
g_form.setValue('u_phone_number', '');
return;
}
// getReference will run an ajax call to the server to get the data. When the data is returned, setManager is executed as the callback function
var caller = g_form.getReference('caller_id', setManager);
}
// caller contains the record fields retrieved by getReference when the callback is executed
function setManager(caller) {
if (caller)
g_form.setValue('u_user_manager', caller.mobile_number);
// Have your code here to validate the phone number
}
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#getReference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 11:54 AM
Hi Shishir,
They may not change the requester, but simply change the phone number associated directly. I thought make those read only and force they to open the requester record for any updae, but client prefer to update these without another 1 or 2 click...
May need to sue the web object instead?
Thanks!
Jerry