How to create an incident in flow designer with script

Community Alums
Not applicable

Hi,

I am trying to create an incident using Flow Designer via scripting. Can you please show me how it can be done? Kindly help.

 

1.png

 

Regards

Suman P.

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Community Alums 

 

https://developer.servicenow.com/dev.do#!/learn/courses/utah/app_store_learnv2_flowdesigner_utah_flow_designer/app_store_learnv2_flowdesigner_utah_notifications_in_flow_designer/app_store_learnv2_flowdesigner_utah_creating_inbound_email_flows

 

https://www.youtube.com/watch?v=KZpZDqbRKU4

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************
In this video, you'll learn how to process an inbound email with Flow Designer and update an existing record. Flow Designer: https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/flow-designer/concept/flow-designer.html Flow Trigger Types: ...

Madhav Rao D V
Tera Expert

Hi @Community Alums ,
To create an incident from the flow (Flow designer) you don't need to create it via script. In the actions space, Click on the Action. Find a action called "Create Record"

MadhavRaoDV_0-1704451800974.png

After selecting the button, You can configure the record by changing the table name to incident, and set the necessary values as mentioned here

MadhavRaoDV_1-1704451906121.png

 

https://developer.servicenow.com/dev.do?_escaped_fragment_=/learn/learning-plans/orlando/citizen_developer/app_store_learnv2_flowdesigner_orlando_adding_actions_to_a_flow

Community Alums
Not applicable

Hi @Dr Atul G- LNG  @Madhav Rao D V ,

I know how to do this using existing actions, I am trying to use scripting in Flow Designer.

Regards

Suman P.

Hi @Community Alums ,
So if you wanted to do create an incident through Scripting in flow designer. There are two places in the flow designer to do this.

  1. Inline Script.
  2. Custom Actions.

The syntax to create an incident through script is the below code snippet. This syntax can be used in places like Business Rules, Script include etc.

var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = "....";
gr.description = "...";
gr.insert();


Inline Scripts: https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/concept/inline-scripts.html

The inline scripts space is used to return values to the actions/set values/conditions through scripts instead of using the data pill. You can create incident record in that space and return value of the data pill through script/some other value.

Create custom actions:
https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/concept/actions.html

You can create a simple custom action with one input, script step, one output. In the script step, You can create a incident record.