Populate Reference Variable Based on Another Variable Selection in Service Catalog.

manishtyagi
Tera Contributor

Hi Community, I’m working on a Service Catalog item and need some help with a dynamic reference field. I have two variables Department and Doctor (Reference) When a specific department is selected, the Doctor variable should only display doctors who belong to that selected department. Can anyone guide me on how to achieve this? Should I use a Reference Qualifier or a Catalog Client Script?

2 ACCEPTED SOLUTIONS

GlideFather
Tera Patron

Hi @manishtyagi 

let's go with a reference qualifier on the Doctor variable.

 

Try something like:

javascript: 'department=' + current.variables.department

 

EDIT: Please note that's automatica transcript, it shall be "javascrip t :" (no spaces) not javascript:

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


View solution in original post

mayankkumar
Tera Sage

Hi @manishtyagi,
----------------------------------------------------------------------------------------------------------------------------------------------------
Yes, you can definitely achieve this using Reference Qualifier (Advanced)
and you can write it like ->

javascript: "u_department="+current.variables.department //replace the variable names with your original ones.

Now what it will do is that it will fetch the only doctors which belonged to the selected department
If you need further help do let me know.
--------------------------------------------------------------------------------------------------------------------------------------------------
Please mark my response Helpful and Accept as solution
Thanks & Regards
Mayank

View solution in original post

9 REPLIES 9

GlideFather
Tera Patron

Hi @manishtyagi 

let's go with a reference qualifier on the Doctor variable.

 

Try something like:

javascript: 'department=' + current.variables.department

 

EDIT: Please note that's automatica transcript, it shall be "javascrip t :" (no spaces) not javascript:

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


mayankkumar
Tera Sage

Hi @manishtyagi,
----------------------------------------------------------------------------------------------------------------------------------------------------
Yes, you can definitely achieve this using Reference Qualifier (Advanced)
and you can write it like ->

javascript: "u_department="+current.variables.department //replace the variable names with your original ones.

Now what it will do is that it will fetch the only doctors which belonged to the selected department
If you need further help do let me know.
--------------------------------------------------------------------------------------------------------------------------------------------------
Please mark my response Helpful and Accept as solution
Thanks & Regards
Mayank

@mayankkumar if it is a variable it will most likely not be "u_department", otherwise you wrote exactly what I did, so I must agree 😁💯

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @GlideFather,
I'm referring "u_department" to the field on the table from where doctor field is referenced not variable.
Why and where would I mention "u_department" as a variable? You can clearly see it's "current.variables.department" and "u_department" is assumed to be a field on referenced table. Maybe you're confused here. And I did not write what you wrote even I didn't know that you already posted a response here when I start writing this post has 0 responses
So, don't say that I wrote from your response.
---------------------------------------------------------------------------------------------------------------------------
Please mark my responseHelpfulandAccept as solution
Thanks & Regards
Mayank