Subflow Create Record Sys ID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a subflow that creates a record using "Create Record" action. Unfortunately this subflow does not have any output variables. I am trying to get the sys_id of the record created by this flow so I can use it in a reference field down the track.
When I go to the step where this subflow is used; I only see "Context" and I am not sure how to get the sys_id of the record. I tried the "sys_id" field under the context and also the "Source Record" field under the context but that doesn't work.
As I have multiple steps following the subflow, I don't want to change subflow at this moment as otherwise I will need to change the reference in multiple steps below and may also have to redo these steps.
Any hints?
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In you Subflow, add 'Assign Subflow Outputs' and capture the created record details. This can be used in main flow for subsequent Subflows or actions. This will not have any impact to existing flows since you are not introducing additional actions
Below is sample for reference
Refer below documentation for more details
I hope you appreciate the efforts to provide you with detailed information. If my response helped to guide you or answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Did you get a chance to review this as I believe the information provided should answer your question
If my response helped to guide you or answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
that's OOTB behavior, you cannot grab that.
You will have to assign that newly created Record sysId to the Output variable and then use this in your main flow from where you are calling that.
Assign subflow outputs flow logic
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @AmolJ ,
Unfortunately, OOB if your subflow doesn’t define an output variable for the created record, the main flow will not be able to directly grab the sys_id that the Create Record action generates....
Best practice is to add the output variable in the subflow. I know you said you don’t want to edit it because many downstream steps refer to it, but adding an output variable usually doesn’t break those. Once you do that, you can reference the sys_id in the calling flow....
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/