Populating Field in Service Portal Based on Previous Selection

jmiskey
Kilo Sage

So, I am creating a Form for our Service Portal.   I had to create a few Custom Tables for this endeavor.

One such table is called "IT Portfolio" (u_it_portfolio).   It has a few field, the most important being:

u_it_portfolio

u_it_portfolio_mgr

The u_it_portfolio field is simply a String field (and this is the Display field).

The u_it_portfolio_mgr field is a Reference field back to sys_user.

So, basically, this table shows each IT Portfolio and who the manager is of each one.

On the Service Portal, we created a variable named itPortfolio, which is a reference field back to the u_it_portfolio table.

There is another read-only variable on the Service Portal named itPortfolioMgr.

The intention is that when the user selects a value from the itPortfolio question, based on that selection, it will populate the itPortfolioMgr variable with the corresponding value from the u_it_portfolio_mgr field in the u_it_portfolio table.

I know that this will be a Catalog Client Script which runs on the onChange event of the itPortfolio variable.   But I am having issues figuring out the correct syntax to return a value from the same record in the reference table (but returning a different field from that record).

I have a feeling that this is probably an easy one, and I am going to kick myself for not being able to come up with it myself once I see the solution!

Thanks

1 ACCEPTED SOLUTION

I figured it out!   Working in conjunction with the Client Script code I posted earlier that is returning a sys_id, I just need to make the variable a Reference variable, and it will return the User's name.



I had tried this earlier, but I was trying to make it a Reference variable to my u_it_portfolio table.   But I since discovered that the sys_id that it was returning was actually from the sys_user table.   When I changed it to be a reference to the sys_user table, it worked!


View solution in original post

7 REPLIES 7

Your best be is to use ajax to read the required information. Async getReference will only return the sysid for the manager.





Your best be is to use ajax to read the required information. Async getReference will only return the sysid for the manager.


Do you have any examples of what that might look like?   I haven't really done much with AJAX yet, so I will need to look it up.



Thanks


I figured it out!   Working in conjunction with the Client Script code I posted earlier that is returning a sys_id, I just need to make the variable a Reference variable, and it will return the User's name.



I had tried this earlier, but I was trying to make it a Reference variable to my u_it_portfolio table.   But I since discovered that the sys_id that it was returning was actually from the sys_user table.   When I changed it to be a reference to the sys_user table, it worked!