- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 06:30 AM
Can someone please help?
I have a FD that calls an Action to create 2 new records and apply a Form Template to each record > this works.
But I need to return the Record that was created for Case and the Record that was created for Incident, back to my Flow.
Here is my Action Script Step:
var grCase = new GlideRecord('sn_customerservice_case');
grCase.initialize();
grCase.applyTemplate('Case Template 1');
outputs.record = grCase.insert();
var grINC = new GlideRecord('incident');
grINC.initialize();
grINC.applyTemplate('INC Template 1);
outputs.record = grINC.insert();
Can someone help me update this code and provide the Output type that is needed?
I need to return type Record to my Flow so I can access its values.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2022 09:41 AM
I figured out the solution. I had to update the Script Step in the Action, use a String Field in both outputs and in the Flow > use a Look Up Record and Update Record.
Here is the full solution:
(function execute(inputs, outputs) {
var grIMS = new GlideRecord('interaction');
grIMS.initialize();
grIMS.applyTemplate('Template 1');
grIMS.insert();
outputs.record = grIMS;
outputs.record1 = grIMS.getValue('number');
var grCase = new GlideRecord('sn_customerservice_case');
grCase.initialize();
grCase.applyTemplate('Template 2');
grCase.insert();
outputs.record = grCase;
outputs.record2 = grCase.getValue('number');
var grINC = new GlideRecord('incident');
grINC.initialize();
grINC.applyTemplate('Template 3');
grINC.insert();
outputs.record = grINC;
outputs.record3 = grINC.getValue('number');;
})(inputs, outputs);
Script Step Outputs:
Action Output Outputs:
In the Flow:
Call the Action
Look Up Record
Update Record
(for all 3 records types)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 06:44 AM
You can create multiple output variables to your flow as shown in the below screenshot.
Hope this helps.
*Please mark this as useful based on the impact*
Regards,
Kashyap G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 06:56 AM
Hi @Kashyap G
With the code I have, type String as an Output does not return the Record...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 07:34 AM
Hi @Susan Sellmeye1 ,
Try to use the Reference type of Output Variable.
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 08:43 AM