Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

REST API Allow Logged In user to update own profile details

prasadpotale
Mega Expert

1. Created user using "api/now/table/sys_user" API

2. Able to login using "/oauth_token.do" API, received access and refresh token

3. Trying to update user with "api/now/table/sys_user/sys_id" without providing user_admin role, getting success but no update

4. Provided "user_admin" role, user updated successfully

 

Is there any way to update own user details by passing own access token?

1 ACCEPTED SOLUTION

kps sumanth
Mega Guru

Hello @prasadpotale ,

 

You are using Table API you can have control if your are using a scripted rest api.

You can write your script as below.

var usr = New GlideRecord('sys_user');

usr.get(gs.getUserID())

below you can have your update based on your payload.

View solution in original post

2 REPLIES 2

kps sumanth
Mega Guru

Hello @prasadpotale ,

 

You are using Table API you can have control if your are using a scripted rest api.

You can write your script as below.

var usr = New GlideRecord('sys_user');

usr.get(gs.getUserID())

below you can have your update based on your payload.

Thanks, this worked for me.