gs.getUserId return value 'system'

amber
Tera Contributor

Hello Experts, 

I feel strange when I'm using Glide system API method gs.getUserID in script include, it just returns 'system' instead of the sys_id of the current user. And also other methods related all return 'system'. Do you know the reason for it? 

 

Thanks & Regards

Amber 

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Amber,

Can it be that Script Include is being executed from email? gs.getuserID() will return sys_id of the currently executing user. In case of email or scheduled jobs, this can be "system".

See simiilar question in the following thread.

https://community.servicenow.com/community?id=community_question&sys_id=f216ff81dbbe805814d6fb243996...

View solution in original post

7 REPLIES 7

It works well in background script.

Well then, Ankur replied before I did. It's the "Run As" property.

Open the flow and click on "..." at the top right corner and select "Properties"

find_real_file.png

The "Run As" is probably "System User". That's why gs.getUserID() is "system".

find_real_file.png

Hitoshi Ozawa
Giga Sage
Giga Sage

Amber,

Can it be that Script Include is being executed from email? gs.getuserID() will return sys_id of the currently executing user. In case of email or scheduled jobs, this can be "system".

See simiilar question in the following thread.

https://community.servicenow.com/community?id=community_question&sys_id=f216ff81dbbe805814d6fb243996...