Need to get the records for a reference field based on another fields value

Yesh
Tera Contributor

Hi Team,

I have field named Category which is a reference type field, referencing table contains two fields: Category and Plant. I have another Field called Plant Name in the current table, it is also a reference type field. By selecting the plant name, I need the records for category in which the selected plant name matches with the Plant which is there in Category table.

Current Table:

find_real_file.png

 

Category Table:

find_real_file.png

Is there any suggestion, how to achieve this?

Thanks,

Yesh

1 ACCEPTED SOLUTION

Nikhil65
Mega Guru

Hi @yesh ,

 

Please create a new script include with the following function, also make sure its client callable:

getCategory: function(plant) {
var refQuery = '';
refQuery = 'category=plant';
return refQuery;
},

 

After this, use advanced reference qualifier and use the below code for calling your script include:

javascript: yourScriptIncludeName().getCategory(current.variables.plantName);

 

However, if its a scoped application, then you will have to append the application name before yourScriptIncludeName() in reference qualifier

 

Note: Make sure that you change the variable name as per the name in your system.

 

Mark as correct if helpful!

 

Thanks,

Nikhil.

View solution in original post

12 REPLIES 12

Hi Rahul,

I have tried using the script you have given. It is not returning any records.

Thanks,

Yesh

Can you please share field name in form and field name in the table?

Regards,
Rahul

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Both are u_plant only.

Regards,

Yesh

Try using,

javascript:"u_plant=" + current.variables.u_plant;

Regards,
Rahul

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi Rahul,

I have tried it. It is not even returning a single record.

Thanks,

Yesh