making dependent

Pramod5
Tera Contributor

We have created 2 fields both are reference field.

Parent (L1)
Name (l2)

Now The Requirement is 

L2 Commodity code depends on L1. If you choose any L1 on the children of that L1 should be available to choose in the L2 reference field. 

We have excel too

 

Suppose if we are selecting from L1  Advertising & Marketing so From L2 field only below option should be available  to chose .

 

How do i achieve this ...Please help me on the same 

Many thanks 

 

5 REPLIES 5

Kavita_Bhojane
Tera Guru

Hi @Pramod5 ,

 

You can use below script in reference qualifier of "Name (l2)":

 

javascript: getNames(current.variables.parent_l1); //Filter "Name (l2)" based on Parent (L1) selected

 

function: getNames(parent){

var name_arr = [];

var name = new GlideRecord("table name where Name (l2) stored");

name.addQuery("Parent (L1) ",parent); //Replace "Parent (L1)" with field name used in glided table

name.query();

while(name.next()){

name_arr.push(name.name_l2.toString()); //Replace "name_l2" with field name used in glided table

}

return 'sys_idIN' +name_arr.toString();
 
Please mark my answer helpful if you find it useful.
 
Thanks,
Kavita Bhojane