- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:04 AM
Hi All,
I'm using a scripted rest api to create change from third party tool.
If the user trying to create change from third party is available in ServiceNow users table , then only the change should be created.
If it's not there then change request creation action should be aborted.
Please help what is the function that has to be placed to abort the action in scripted rest api. I tried even with abort but still change request is getting created.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:14 AM
Do you mind sharing screenshot of what you have tried in scripted APIs?
In scripted rest APIs under the operation there are few options which I will recommend to use when you want to restrict external calls:
1. Requires authentication
2.Requires ACL authorization : you can here specify ACL and in that can also validate if user is present in servicenow and have sufficient roles
3. you can also do handling in script section before inserting a change request and after validating the user is not present in servicenow then something like,
eg. return new sn_ws_err.BadRequestError("user not found");
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 07:14 AM
Do you mind sharing screenshot of what you have tried in scripted APIs?
In scripted rest APIs under the operation there are few options which I will recommend to use when you want to restrict external calls:
1. Requires authentication
2.Requires ACL authorization : you can here specify ACL and in that can also validate if user is present in servicenow and have sufficient roles
3. you can also do handling in script section before inserting a change request and after validating the user is not present in servicenow then something like,
eg. return new sn_ws_err.BadRequestError("user not found");
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 06:38 PM
Thanks, I have kept this and worked well.
return new sn_ws_err.BadRequestError("user not found");