Create Change Using Model From Flow or Script

Zach N
Tera Guru

Hello!

 

I'm currently working on an integration between ServiceNow and Jira, and one of the requirements is to create a Change Request using a Change Model from a Jira record.

 

The challenge I've been running into is creating the Change and applying the Model. Does anyone know if it is possible to create a change using a model with Flow designer or Javascript? My goal is to be able to utilize the State Transitions and Record Presets from the model.

 

So far I've attempted the following methods with no success:

 

  • Create Change Request using Create Record flow action.
    • The Change Model field doesn't appear when using the flow action.
  • Create Change in Javascript and set the Change Model field on insert.
    • Gets aborted by the "Change Model: Check State Transition" business rule.
  • Create Change in Javascript and set the Change Model field AFTER insert (on update).
    • Doesn't apply the State transitions or Record presets.
  • Searched Flow designer for any OOTB actions, flows or subflows.
    • From my review, none exist. The closest is the Create Standard Change Request action, but it doesn't utilize change models and is an "example" according to the description.
  • Searched for templates associated to the change model.
    • None appear to exist.
  • Hours searching Google, Docs and Community.
    • To no success.

So far the only solution I've found is using the Change Management API, but this is designed to be used for external systems and not locally (And so far I haven't found a way to execute this on the local instance). Our integration is established using a webhook, so directly calling the Change API isn't really an option.

 

I'm kinda at a loss on this one, and any help would be appreciated! Seems odd to me that there isn't an obvious method or solution for this.

 

Cheers,

-Zach

1 ACCEPTED SOLUTION

Hey Priyanka!

Thanks for your response! Unfortunately the Evaluate Change Model action doesn't execute state transitions or record presets on a newly created change. I tested this by setting setWorkFlow(false) in a background script (to ignore the State Transition business rule), creating the change, and then running the action.

 

I did discover that the Model field is available when using the Create Record flow action. This was an oversight on my part as I was searching for "Change Model" and not "Model."

 

Ultimately my solution was to use a Look up Record action on the sttrm_state table, where Model is the desired Change Model, and Initial State = true. Then I use the state_value from the lookup as the State when creating the change. This will pass the Change Model: Check State Transition business rule and create the change correctly.

Cheers,

Zach

View solution in original post

3 REPLIES 3

Priyanka_786
Tera Guru
Tera Guru

Hi @Zach N , In flow designer, under ITSM spoke , there is one action available "Evaluate Change Model". Use that action  by passing change request ID created  by using create record step. Try it if it works.

https://docs.servicenow.com/bundle/vancouver-it-service-management/page/product/change-management/co...

Hope it helps. Kindly mark helpful and accepted if it helps.

Regards,

Priyanka Salunke

Hey Priyanka!

Thanks for your response! Unfortunately the Evaluate Change Model action doesn't execute state transitions or record presets on a newly created change. I tested this by setting setWorkFlow(false) in a background script (to ignore the State Transition business rule), creating the change, and then running the action.

 

I did discover that the Model field is available when using the Create Record flow action. This was an oversight on my part as I was searching for "Change Model" and not "Model."

 

Ultimately my solution was to use a Look up Record action on the sttrm_state table, where Model is the desired Change Model, and Initial State = true. Then I use the state_value from the lookup as the State when creating the change. This will pass the Change Model: Check State Transition business rule and create the change correctly.

Cheers,

Zach

Mathieu Lepoutr
Mega Guru

Hello @Zach N 

 

Given your requirements and the obstacles you've faced, you might want to consider exploring a third-party solution like Exalate. Exalate offers a flexible synchronization tool designed specifically for use cases like yours, facilitating the integration between ServiceNow and Jira. It enables the creation and synchronization of issues, including Change Requests, across different platforms while allowing for the customization necessary to handle complex workflows and model applications.

With Exalate, you can configure the synchronization to respect the specific fields and states required by your Change Model, potentially overcoming the challenge of applying State Transitions and Record Presets post-creation.

 

It's designed to work in both directions, ensuring that updates in either ServiceNow or Jira are accurately reflected on the other side.