Record Producer question default value to get current user

VL10
Tera Expert

In a record producer I want to have a Question:

Requester:
(have the current user default, but changeable to any user in the user table)

 

I set Question type Choice and Question subtype Dropdown (values from a table) and I mention the User table on the Additional details tab.


I am stuck on the default value - what syntax to put here?   I can't just type in gs.getUserID() is there something else to use?

*************
Apologies I know this is a newbie question.  Is there some place I can learn this type of syntax quickly?   (i.e, without multiple hours of Now Learning.  Sample AES apps to download and play with or a quick reference guide or some good short videos would be ideal.

*************

 

4 REPLIES 4

Eswar Chappa
Mega Sage
Mega Sage

Hi @VL10 the below URL's will really help you to understand with your question

 

https://thesnowball.co/how-to-set-a-default-field-value-in-servicenow/#

https://www.servicenow.com/community/developer-forum/how-set-default-value-of-a-variable-using-javas...

 

Cheers, hope that helps

Eswar Chappa

*** Please mark as "Correct" or "Helpful" as appropriate ***

 

SwarnadeepNandy
Mega Sage

Hello @VL10,

 

Don't use variable type as choice for this

You can use this new ServiceNow feature.

Use Variable type - "Requested For"

This does exactly the same as you are looking for.

If your field is meant to capture the requestor or requested on behalf of, this variable type is the perfect solution for it. And it's completely OOTB, no Code solution.

 

Kind Regards,

Swarnadeep Nandy

How do I use that?  You can't just paste it in the box like this in the Record Producer config?

 

VL10_1-1692401315307.png

 



Hi - still waiting for how to use this!