Get reference field values based on another field

Lemajeur
Mega Expert

Hello,

 

I have a requirement where the catalog item has 2 fields, A and B ( both of type reference), I want to build an onChange script where when a user select a value in A, field B should only populate values that are in relationship with choice in field A.

 

How do I achieve this?  My code is currently failing.

1 ACCEPTED SOLUTION

Shambhu5
Kilo Guru

Hi Leandre,

I too had a similar requirement, in which I had to select the Manager in 1 reference field, and his (selected  manager's) related members only needed to be shown in other Reference Field.

For this, I made use of Reference Qualifier and called them in Script include.

For Manager reference field, I used Advanced reference qualifier, in Reference qualifier javascript:getManager()

Its Script include is as per the screenshot:

find_real_file.png

Similarly, to get members, used Advanced Reference Qualifier, in Reference qualifier javascript:getMember()

Members Script include is as per the screenshot:

find_real_file.png

 

It worked fine for me.

Please mark my answer as Correct or Helpful, if in case it resolved your query.

 

Regards,
Vishrut

find_real_file.png

www.DxSherpa.com

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

View solution in original post

5 REPLIES 5

Richard P
Mega Guru

Ideally you should do this with a glideajax call to on the client script to a script include. it can be done with a query or populating a scratchpad, but isn't best practice and you could end up slowing your instance down depending on what tables, and data you need. 

what are your reference fields and tables you are querying.