How to get field value sys id into system property

Abhijit Das7
Tera Expert

Hi everyone,

My requirement is to get sys_id of the field value from cases table to system property . Then I want to get this system property into widget and script include.

Does getValue work on system property .

find_real_file.png

My field name is "consumer " in cases table .

Thanks in advance

cc: @Ankur Bawiskar

1 ACCEPTED SOLUTION

Voona Rohila
Kilo Patron
Kilo Patron

Hi Virendra

Try this

var callerCSM = gr1.getValue(consumer_contact.toString());


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Members already shared the syntax on how to get system property value

what's the challenge in using that?

Regards
Ankur

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

Hi @Ankur Bawiskar 

I am aware of the syntax on how to get system property . Kindly understand my requirement.

My requirement;

1. I have one field called "consumer " on cases table . This is reference field and stores user's name .

2. Now I have created system property as you have seen above to get string consumer into widget .

3. In widget I have to draw system property , which I have done .

find_real_file.png

4. I have to get sys_id of that user which is in consumer field using system property

find_real_file.png

so in above code when I am using : var callerCSM = gr1.getValue('consumer_contact');

My expectation is to get sys_id of that user which is stored in consumer field . But I am getting null .

 

And I know many will suggest that I can directly access that field from widget without using system property but my requirement is in such a way that I have to use system property.

Thanks 

@Ankur Bawiskar 

Hi,

since that field is reference then it will always hold sys_id

are you sure "consumer_contact" field name is correct on work order table?

Are you sure data is present in that field?

Regards
Ankur

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

Hi @Ankur Bawiskar 

 

Field is "consumer" on cases table . But I have to get consumer string into system property and then I am calling system property using consumer_contact . Then the using consumer_contact to get sys_idof that user. consumer_contact is variabl

Hi,

system property holds field name

So update as this

var callerCSM = gr1[consumer_contact];

Regards
Ankur

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