Reference Qualifier on the same table

danielbartholom
Mega Expert

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?

1 ACCEPTED SOLUTION

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

View solution in original post

32 REPLIES 32

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi Daniel,



So you want to auto populate path into other variable once the Technical System changes.



Technical System is a Reference field right and new field in which you want to copy path is a single line text?



This can be done using Onchange Client script.


Let me know variable names and i will give you script.



Thank you,Ashutosh munot


Hi,



Thank you for getting back to me so quickly. So here are the details:



On the Technical System table I have created a String field, when I open up each Technical System I add the network path required.



No on the cat item form I have the following



Reference variable > called technical_system > Pointing to the Technical System table


String variable > called network_path



When the technical system is selected the network path variable should find the path for that particular Technical System and display the path on the form



Should I be changing the variable type for network_path so it can reference the string field on the Technical System table?



I am hoping I am making sense?



Thanks


Hi Daniel,



You are on right Path. Give me a sec and i will give you the code:



Thank you,




Ashutosh munot



Please Mark it Helpful. This helps.


Hi Daniel,



Please try below code:



Client Script :



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);


}



Script Include:



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



Please Hit Correct, Helpful or like,if you are satisfied with this response.