sys_original
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2019 04:28 PM
Hello,
I am working to implement a service request that I need to populate a field with a default value... it is easy but I don;t know why it is happening this:
I am using an script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('NAM_Query');
ga.addParam('sysparm_name','NAM_Query');
ga.addParam('sysparm_sr_table', 'u_cmdb_ci_sccm_software');
ga.addParam('sysparm_sr_field', 'asset_tag');
ga.addParam('sysparm_sr_id',"17478dc8dbcf3bc4da832539489619a6");
ga.getXML(SP_Query_Response);
function SP_Query_Response(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('u_select_application2', answer);
}
}
*********
variable is a reference field and in the console I can see this:
Primaverra P6 is the value that I need it....
IO:d8b4b30edbb8fb048471a7c74896196c = Primavera P6 Professional Proj Mgmt
js_includes_concourse.jsx?v=07-09-2019_1217&lp=Thu_May_30_06_19_11_PDT_2019&c=29_550:23785 sys_original.IO:d8b4b30edbb8fb048471a7c74896196c =
and I don;t know sys_original blanks the value the only way that I can see the value is making disabled the field: include none..
Please help!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2019 05:45 PM
Hello,
If the u_select_application2 is a reference field, return the sys_id of the Primavera P6 Professional Proj Mgmt record from your script include.
I believe the function NAM_Query from NAM_Query script include is returning the name of the application. Since the target field is a reference field, it will accept the sys_id of the to be referenced record. Modify the script include function to return the sys_id, and it should fix your issue.
Hope this helps!
Cheers,
Manish