- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 07:25 AM
Create location in cmn_location table, Whenever user will select others in the location field, new field will display to provide new location details like street, city, state, country, postal code. For this requirement I am using onSubmit catalog client script and script include but this is not working.
Client Script:
Kindly guide if anyone implemented something similar to this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 11:29 PM
Hi @Dipika4 ,
For me its working fine in my pdi you can check from your end.
Scoped Application Script Logging. gs.print() and gs.log() are older and not available in scoped applications, whereas gs.debug(), gs.info(), gs.warn(), gs.error() work in both scoped applications and global.
Please mark it helpful and solution proposed.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 07:52 AM
Hi @Dipika4 ,
If you want to create record onSubmit then go with record producer inplace of catalog item with above script.
Take below script as refrence
function onSubmit() {
var ga = new GlideAjax('UserOnboardingNonTGELocation');//name of script include
ga.addParam('sysparm_name', 'createLocation');//name of function on script include
ga.addParam('sysparm_user_location', g_form.getValue("new_location"));//name of field on the form I want to pass value for
ga.addParam('sysparm_user_line1', g_form.getValue("new_line1"),);//name of field on the form I want to pass value for
//add all fields like above
ga.getXML(getLocationDetails);
function getLocationDetails(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer.toString());
}
}
function in my script include
createLocation: function(){
var loc_name = this.getParameter('sysparm_user_location');
var line_name = this.getParameter('sysparm_user_line1');
var gr = new GlideRecord('cmn_location');
gr.initialize();
gr.first_name = loc_name;
gr.u_tda_location_code = line_name;
gr.insert();
var locationId = gr.sys_id.toString();
return locationId;
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 11:03 PM
Hi @Anand Kumar P ,
I tried implementing script mentioned by you, but the thing is client script is not hitting the script include. In first line of script include I ran gs.log but even that it didn't logged anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 11:11 PM
Hi @Dipika4 ,
Make sure client callable checkbox in script include to true and application scope--All in script include.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 11:13 PM