ログインユーザーをデフォルト値にしたい

慶吾岡
Tera Expert

User[sys_user]テーブルを参照しているフィールドのDefault valueをログインしているユーザーにしたいのですが、どうすれば実現できますか?

Client scriptなどカスタマイズを実施せずに実現することが理想です。

2 ACCEPTED SOLUTIONS

@慶吾岡 

 

Syntax used is incorrect, it should be 

 

Bhuvan_0-1761637105693.png

 

Refer below link for more details

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0718092

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

you have use javascript. it should be " javascript : "

javascript: gs.getUserID(). I have attached the image open the link in incognito once

RaviGaurav_0-1761637508090.png

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

9 REPLIES 9

Ravi Gaurav
Giga Sage
Giga Sage

Hi @慶吾岡 

 

 

you can do it without using client scripts by setting the Default value field in the variable or dictionary entry to:

 

javascript:gs.getUserID()
RaviGaurav_0-1761633954300.png

 

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

あなたの提示した方法を試してみたのですが、「Invalid default value」と表示され正常に実行できませんでした。

原因に心当たりはありませんか?

Can you send me the screenshot of the error.. and did you give the proper default value? what is the type of column you are using.. 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

PDIで作成したテーブルで検証しています。

フィールドの設定は添付画像を確認してください。

_0-1761636419844.png