- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 02:16 AM
Hi Team ,
Am using GlideAjax for my integration ,when the use click on open button in a form ,am fetching the tag number and sending to 3rd party through rest integration and getting the successful JSON .
AM pharsing the JSON and trying to insert in the tag number field ,So before inserting am trying to validate the current tag number and incoming tag number is same or not
Below is my code
function getDetails() {
var v_displayRef = g_form.getReference('display_name');
var referencedSysId = g_form.getValue('display_name');
var loadingDialog = new GlideDialogWindow('load_meter', true);
loadingDialog.setTitle('Please wait..');
loadingDialog.setSize(400, 200);
loadingDialog.render();
var assetID = referencedSysId;
var getValues = new GlideAjax('x_cenv_api_hbm_ton.FetchAdditionalDetails'); //Calling Script Include.
getValues.addParam('sysparm_name', 'GetDetailsAPI'); // Function name of the script include.
getValues.addParam('sysparm_asset', assetID);
getValues.getXML(getResponse.bind({dialog: loadingDialog}));
}
function getResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer != 500) {
var formatJSON = JSON.parse(answer);
alert("checking......." + current.u_tag);.....not getting the current field
g_form.setValue('u_tag', formatJSON.Tag);
this.dialog.destroy();
g_form.addInfoMessage("Below fileds are updated ");
} else {
this.dialog.destroy();
g_form.addErrorMessage('Error occurred, please try after some time');
}
}
Please guid me to get the current field value
in the above code I have kept alert("checking......." + current.u_tag);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 02:25 AM
since it's client side script current object won't work
you need to use g_form.getValue()
alert("checking......." + g_form.getValue('u_tag'));
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 02:25 AM
since it's client side script current object won't work
you need to use g_form.getValue()
alert("checking......." + g_form.getValue('u_tag'));
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader