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.

Get field value with column label

Habib2
Tera Expert

Hi,

I want to retrieve field values with column labels in script include, i dont have column names, please suggest if its possible.

1 ACCEPTED SOLUTION

Habib2
Tera Expert

Hi, i have a name-value pair field which has only labels, i need to populate values in value fields, 

however I'm able to achieve this with below script, thank you all for your responses 🙂

Habib2_0-1710661512711.png

 
Habib2_1-1710661867058.png

 

View solution in original post

11 REPLIES 11

Sumanth16
Kilo Patron

Hi @Habib2 ,

For field value: 

var questionText = gr1.getValue('question_text');

 

For single field:

 

 

current[currentField].getLabel();

 

In that case iterate over the array (let's call it arrFields) and use 

gr.getElement(arrFields[i]).getLabel();

 

Please refer below thread:

https://www.servicenow.com/community/developer-forum/client-script-get-variable-label-and-values-on-...

 

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

 

Thanks & Regards,

Sumanth Meda

 

Habib2
Tera Expert

Hi, i have a name-value pair field which has only labels, i need to populate values in value fields, 

however I'm able to achieve this with below script, thank you all for your responses 🙂

Habib2_0-1710661512711.png

 
Habib2_1-1710661867058.png