Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get record producer sys id into a variable set ?

shabbir5
Tera Guru

Hi,

I have a variable set in that created a variable called 'price' which is a single line text.( i want to use that variable set into multiple record producers)

for the variable price i want default value as sys id of that record producer.

i tried on degault value: , javascript:current.sys_id ,and producer.sys_id but no luck , please share if you have any idea on this.

Thank you

Shabbir

1 ACCEPTED SOLUTION

RaghavSh
Mega Patron

Try with on load catalog client script:

g_form.setValue('price', g_form.getUniqueValue());


Raghav
MVP 2023
LinkedIn

View solution in original post

9 REPLIES 9

Hi,

it worked for me in native and portal both

please share your client script and the script screenshot

Regards
Ankur

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

@shabbir 

Did you accidentally mark other answer as correct?

The answer I shared works well for both native and portal.

You can mark only 1 response as correct.

So please mark appropriate response as correct so that it helps future readers.

Regards
Ankur

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

@shabbir 

Did you accidentally mark other answer as correct?

The answer I shared works well for both native and portal.

You can mark only 1 response as correct.

So please mark appropriate response as correct so that it helps future readers.

Regards
Ankur

 

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

Hi,

Refer below

I got the record producer sys_id in alert in both native and portal

Which you can then set in the variable

native

find_real_file.png

portal

find_real_file.png

Regards
Ankur

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

Ashish Bansal
ServiceNow Employee
ServiceNow Employee

This works for this: javascript:current.default_value = current.cat_item;