Flow designer

sreekeerthi
Tera Contributor

Hi,

 

I wanted to create multiple HR Cases after a record producer is submitted. I tried to achieve this using a flow designer using record producer action on the same record producer. But it throws an error "PlanRecursionException: Plan recursion has been encountered". However, This error is not impacting anything as of now . Am just concerned to move this to production as it might create a performance issue. 

 

Please guide me a way through which I can avoid this recursion error.

 

Thank you.

3 REPLIES 3

Drisya Nair
Tera Contributor

Hi,

 

Please go through this link mentioned below.

https://www.servicenow.com/community/service-management-forum/error-messages-in-the-flow-designer/m-...

 

Hope it helps!
Please Mark Helpful/Correct if applicable.
Regards.

Amit Gujarathi
Giga Sage
Giga Sage

HI @sreekeerthi ,
I trust you are doing great.

To address this issue, we can modify the flow designer and implement a workaround. Here's a suggested approach:

  1. Open the Flow Designer in your ServiceNow instance.
  2. Locate the flow that is associated with the record producer causing the recursion error.
  3. Identify the point in the flow where the record producer action is triggered.
  4. Remove the direct reference to the record producer action from the flow.
  5. Instead, add a Script action after the record producer action.
  6. In the Script action, write a script to create the multiple HR cases programmatically based on the submitted record producer.
    • You can utilize the GlideRecord API to create new HR cases.

    • Ensure you define the necessary conditions and mappings to populate the HR cases accurately.

 

var hrCaseGR = new GlideRecord('sn_hr_core_case');
hrCaseGR.initialize();
hrCaseGR.short_description = 'New HR Case';
hrCaseGR.description = 'Details about the HR Case';
// Set other required field values
hrCaseGR.insert();

 

  • Save the flow after adding the Script action.
  • Test the modified flow thoroughly to ensure it creates the desired number of HR cases without encountering the recursion error.
  • Once you're satisfied with the results, move the modified flow to the production environment.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



sreekeerthi
Tera Contributor

Hi @Amit Gujarathi ,

 

Thanks a lot for the guidance.

 

There is a challenge we have here. The cases which are been created as part of this must include the record producer variables as well. The Variables of record producer should match the original case. There is a tab in the HR Case form which displays the values of the record producer on the form.

 

Can we achieve this using this method? I have tried it but could not achieve it.

 

Thank You