get the value of a select box in record producer script(service portal)

G Balaji
Kilo Guru

Hi,

I'm creating a record producer where I have a "select box" and "reference" variables. How to capture the value entered by user from "Select Box" and "Reference" type variables. I tried g_form.getValue('variable_name') but it doesn't work.

What am I missing in syntax

 

Thanks.

1 ACCEPTED SOLUTION

it should be like

 

current.field name=producer.variable_name;

 

current.audit_frequency=producer.audit_frequency;
current.biso_head=producer.sys_id;

 

https://docs.servicenow.com/bundle/london-it-service-management/page/product/service-catalog-managem...

View solution in original post

12 REPLIES 12

Harsh Vardhan
Giga Patron

g_form.getValue('variable_name');

where exactly have your written this , i believe you have added in client script.

please share the scnreeshot

 

if you are using client script make sure UI type set to ALL

Ahmmed Ali
Mega Sage

Ideally that should work.

for select box, it will give value of the option (not label) and for reference variable, it will give sys_id of the selected record (not display) name.

 

if you can post your script, it would be helpful.

 

Thanks,

Ali

If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali

G Balaji
Kilo Guru

Thanks for the response.

Following is the code,

current.audit_frequency=g_form.getValue('audit_frequency');
current.biso_head=g_form.getValue('sys_id');

 

 

it will not work

 

current does not work on client side. current will always work at server side.