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

current.u_biso_head is not populating. It's a reference field and the column name in table as well as the variable name is matching. 

Thank you for this answer! I'm surprised how difficult it was for me to find out that I could simply use "producer" to access fields on it. Perhaps there is documentation somewhere I am missing? In any case, this answer saved me, truly.

SaiRaviKiran Ak
Giga Guru

Hi,

 

your code should be like:

 

var audit = producer.audit_frequency;

var gr = new GlideRecord("give table name");
gr.addQuery("sys_id", current.sys_id);
gr.query();
if (gr.next()) {

gr.audit_frequency = audit;

gr.update();

}

 

Thanks,

Ravi