how to get pre-populate country code before phone number in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 12:08 AM
Hello Experts,
Can anyone help me in getting the Country code pre-defined in Phone number field and changes with change in country in record producer. Desired requirement is given below FYI:
thanks in advance.
Regards,
Prathap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 12:22 AM
Hi Pratahp
Please follow below step.
1) Have the mapping of the country and country codes in a lookup table (could be country table itself).
2) Create an Onchange Catalog client script.
3) Pick the value of the country from country field, then pass it on to the server with glide ajax and then from server return the country code (through script include).
4) Use g_form.setValue to append the country code returned from server to the phone number field.
Let me know if you need help with the script.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2017 08:58 PM
Hello Gaurav ,
Can you please help with the code for country code as asked in the above query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 02:18 AM
Can u help me script please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 12:22 AM
Hi,
Please follow the below step.
1) Add a new field to the country table as phone code.
2) Populate values of phone codes for each of the countries in this new field ( This will work as a lookup).
3) Add two variables to the Record producer e.g. Country (a reference to county table) and phone Number ( SIngle line text).
4) Create a new catalog client script to auto-populate the.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var response=g_form.getReference('Country',CodeCallBack);
}
function CodeCallBack(response){
var phoneCode=response.u_phone_code;
phoneCode ="+"+phoneCode;
g_form.setValue('phone_number',phoneCode);
}
You can always modify the script as per your need as this is just a sample script to demonstrate the basic example.
Thanks
Gaurav