- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2017 06:35 AM
Hi I am looking for some help please
I have a Cat Item on the Service Portal that has a lookup select box variable that references the technical system table.
I would like to create a new column on the technical system table called Data Tool Network Path. When I open the form for a selected Technical System
I will then enter the correct path here. There will be different paths for different Technical Systems.
What I am looking for is the correct reference qualifier to present the following on the cat item form
When someone selects a Technical System that has a path applied is there a way I can have this come up a a string field so the requester can see
the path for review on the form?
So on the form, the requester selects a Technical System from the lookup select box
The correct path should then appear in a new variable (string maybe?) below.
To date this has been completed by Catalog UI policies but I am hoping I can streamline this some what.
I hope the above makes sense and any help would be most appreciated. Happy to provide more information if anything is unclear. Even if this does not work on a string variable I am still interested to know how you can run a ref qual on the same table?
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2018 04:54 AM
HI,
I saw your New thread. Will look into this and reply asap.
Can you close this thread by marking answer as correct.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 01:10 AM
Hi,
Thank you for this code. Before I try this out can I ask some questions please:
Can you confirm why I need to have the getUserEmail?
I am not seeing any reference in the code to any of the variables on the form is this correct?
Am I simply applying this as a Catalog Client Script (OnChange)?
Thank you so much for your help thus far. Looking forward to your response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 02:14 AM
Hi Daniel,
getUserEmail is name of script include;
newValue is a your onChange Field that is your Technical system Field. So this will pass sys id to script include and script include will query your table i.e. technical system table and return the path. So gr.path will return you path. Replace Path with your field name where you have store the path.
Thank you,
Ashutosh Munot
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 02:43 AM
OK not sure if I am doing this right so here are the steps:
· Opened the cat item
· Catalog Client Script > Created a New one (see Screen 1 attachment)
· In the filter navigator I searched for Script Include > System UI
· Created a new one (see Screen 2 attachment) > You will see there are some errors in the code. Have I done this correctly?
Also will this work on the Service Portal as I would like the path to appear on the form see screen 3 attachment
Apologies for all the questions, I really appreciate your help.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 03:11 AM
HI Daniel,
I cant see your attachments.
Steps should be below:
1) GO to catalog item;
2) Open New catalog client script:
3) Select Type as on change and UI type as ALL
4) Field should be Technical System.
5) Write below code into script section:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('getUserEmail') ;
ga.addParam('sysparm_name','getApp');
ga.addParam('sysparm_app',newValue);
ga.getXMLWait();
var answer = ga.getAnswer();
//alert(answer);
g_form.setValue('network_path',answer); //network_path is your variable where you want to store path
}
6) Go to scrpit include:
Tick client callable as true and paste below code:
var app = this.getParameter('sysparm_app');
var dis;
var gr = new GlideRecord('cmdb_ci_appl'); //Replace cmdb_ci_appl with your table name
gr.addQuery('sys_id',app);
gr.query();
if(gr.next())
{
return gr.path; //Path should be replaced with you field which contains Path on technical system table
}
Thank you,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 03:26 AM
OK I think we are very nearly there
Step 1 I have done on the Cat Item and this saves correctly
Step 2 Script Include I have done the following
Created New
Name = getUserEmail
Client callable = True
Accessible from = All application scope
Removed all default script and pasted the following, you will see I have updated the table name and also added the field name on the technical system table
var app = this.getParameter('sysparm_app');
var dis;
var gr = new GlideRecord('u_technical_systems'); //Replace cmdb_ci_appl with your table name
gr.addQuery('sys_id',app);
gr.query();
if(gr.next())
{
return gr.u_data_tool_network_location; //Path should be replaced with you field which contains Path on technical system table
}
When I click save I receive the following error:
Could not save record because of a compile error: JavaScript parse error at line (9) column (7) problem = invalid return (; line 9)
Line 9 = return gr.u_data_tool_network_location;
Where have I gone wrong?