Help with editing Change Request states via rest API

Jens Mogensen
Kilo Guru

Hello everyone

 

I need some advice. We have a consultant working on integrating our change workflow with an external alert system. I've made an API account for them which has regular ITIL rights as well as the various Rest API roles. We want this account (to begin with) to be able to transition change requests from state New to Scheduled but the consultant can't get it working. They believe "something" in our setup isn't standard since this works with their other clients.

 

Now I have almost no knowledge when it comes to scripting so I can't really debug what the consultant is doing, only try changing things on my end from his instructions or look into what I can find regarding access rules etc. But I am at a loss so hopefully someone here has experienced something similar. Also, the person who did our initial config of Servicenow 8 years ago is no longer with the company so my knowledge of what is OOTB functionality and custom is limited since I have never altered anything related to this myself.

 

Here's the way we work today:

 

Change is created.

Various mandatory fields are filled out, among them the schedule.

After filling out the schedule, the user is able to use the button/UI action "Schedule" at the top:

phases.png

 

This is where the scripts of the consultant stall. They have tried going directly for the state field in order to change the state to "Scheduled" and also tried triggering the UI action itself but no luck there either.

 

I've edited the ACL "change_request.state" to let the rest_api_explorer role (which the API account has) have write access but that made no difference either:

ACL.png

 

So two questions:

What exactly is making the State field on a Change Request be greyed out - where is this controlled?

Any idea what is preventing the API account from changing the state or triggering the UI action/button?

 

State field is greyed out always. Not a problem for agents since they use the UI actions to transition the change requests.

State.png

 

The workflow for the change looks like this:

Workflow change.png

 

Thanks for any suggestions.

1 ACCEPTED SOLUTION

Jens Mogensen
Kilo Guru

I found the solution. Changed the form to not have the field be read only and used an ACL to give rest_api_explorer write access on the field 🙂

 

Sometimes writing these things out gives you the inspiration to find a solution.

View solution in original post

3 REPLIES 3

J Siva
Tera Sage

Hi @Jens Mogensen 

What exactly is making the State field on a Change Request be greyed out - where is this controlled? It's not the OOB setup/configuration. We can make the field read-only in different ways which includes Dictionary config, UI policy, Client script, ACL & Data policy. 

Any idea what is preventing the API account from changing the state or triggering the UI action/button? Are they getting any error when trying to update the state?

 

Regards,
Siva

 

Jens Mogensen
Kilo Guru

Oh wait. I feel silly now. The reason why the field is greyed out is a setting on the form. Of course it is.

 

I might have an idea how to solve this now.

Jens Mogensen
Kilo Guru

I found the solution. Changed the form to not have the field be read only and used an ACL to give rest_api_explorer write access on the field 🙂

 

Sometimes writing these things out gives you the inspiration to find a solution.