Display mrvs in a single line text field

Matt25
Tera Guru

Hello, I have a form (project resource request) that uses a multirow variable set to collect dates along with other fields, once submitted a ticket is raised, this form works fine.  

 

I have a second form (project resource amendment) that has a drop list which displays the the request numbers of any requests made using the first form, How can I get this form to lookup the request number and display any dates that have been submitted using the multi variable set?

2 REPLIES 2

Brad Bowman
Kilo Patron

You may run into a character limit on a single line variable if you dump the MRVS contents (JSON) as-is, so you may want to change this to a multi-line, and/or parse the JSON to only display the desired data, but in any event you can do this after a RITM is selected via the select box variable by using an onChange Catalog Client Script.  This script will use GlideAjax to call a Script Include.  The SI will simply lookup the RITM and return the contents of the ritm.variables.mrvs_internal_name.  Once back in the client script you can set the value returned to the text variable.  Give the scripts a go and post them using the insert code icon </> if you get stuck.

 

Here's an excellent guide on GlideAjax if you are unfamiliar.  It's a bit more than you need in this case with the ability to return multiple values, but it's a good tool to have in your belt, and works the same if you're only returning one value (the JSON of the MRVS in this case)

 

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

Thanks for your reply Brad, I will give this a look over and let you know how I get on.