The CreatorCon Call for Content is officially open! Get started here.

Script in record producer's variable field default value is not working

mohammadtaneem
Tera Contributor

hiii iam working on record producers i  am getting the issue while  fetching values based on currently logged in user through default value variable.Help me to resolve the bug

9 REPLIES 9

Shashank_Jain
Kilo Sage

@mohammadtaneem ,

 

Use this  -  gs.getUserID(); 
D should be capital

Hope it works!

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

@mohammadtaneem , if this helps could you please mark it as helpful and close the thread.

If this works, please mark it as helpful/accepted — it keeps me motivated and helps others find solutions.
Shashank Jain

Rafael Batistot
Kilo Patron

Hi @mohammadtaneem 

 

RafaelBatistot_2-1754934718777.png

 


RafaelBatistot_0-1754934338667.png

RafaelBatistot_3-1754934748557.png

 

RafaelBatistot_1-1754934456583.png

 

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@mohammadtaneem 

As others having pointed out there is a syntax error in your function

Another way is to use onLoad catalog client script and set the values.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

M Iftikhar
Giga Sage

Hi @mohammadtaneem ,

You have 2 options here:

  1. Fix the syntax → use gs.getUserID() (capital D).

  2. Best practice → don’t use scripts in the Default Value field . Instead, use an onLoad Catalog Client Script and set values with g_user or GlideAjax.”

 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.