how to set a variable that is not on the form

samadam
Kilo Sage

I have a look up select box, once the user selects the value I want to pull the sys_id of the selected value to another variable which is not on the form. How can I do that? I dont think I can use Catalog client script since the field is not on the form.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sam,



Is it catalog item which you are referring.


Yes you cannot use catalog client script for this unless and until it is present on the form i.e. visible or invisible



As an approach I would suggest to have this field on form and hide using catalog onLoad script so that you can set it using g_form.setValue();



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Sam,



You can set the value of the field on the form is hidden via UI policy.


I am hiding state field in UI policy (based or logged in user) and trying to set that field in UI action but its not working ! Do i have to unhide and set then hide?