Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Scripting using Script Editor or Script Input field or use Actions in flow designer

JinuJ
Tera Contributor

Hello,

I want to create a subflow in Flow designer where I need to create a Json based on subflow inputs or result of previous action and pass this Json as input to next action. Is using Script Editor or Script Input field to build this Json ok or should an action be used to create the Json and pass it to next action? For eg: I need to create a Json like below where identity is taken from subflow inputs


var json = {
    name: 'xxxxxx',
    identity: fd_data.subflow_inputs.item,  
    identityBy: 'name'
};
return JSON.stringify(json );
 
this is then the input to next action. So I am adding this in Script Editor or Script Input field of the input of the action. Will this script in script editor be lost in upgrades or is it bug prone?
1 ACCEPTED SOLUTION

Sanjay191
Kilo Patron

Hi @JinuJ 
  using inline scripting in Flow Designer to build JSON is not safe becuase some time what happened is if we are adding more steps on that flow before this step (JSON) it will get lost. But script will not be lost during upgrades.

  • Too much inline scripting = harder to maintain
  • Debugging becomes messy

    insteed of these you try the below 

    Best practice:

    • Use custom action if:
      • JSON is complex
      • Reused in multiple places
    • Use script input if:
      • Simple one-time transformation



        If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
        Thank You

 

 

View solution in original post

1 REPLY 1

Sanjay191
Kilo Patron

Hi @JinuJ 
  using inline scripting in Flow Designer to build JSON is not safe becuase some time what happened is if we are adding more steps on that flow before this step (JSON) it will get lost. But script will not be lost during upgrades.

  • Too much inline scripting = harder to maintain
  • Debugging becomes messy

    insteed of these you try the below 

    Best practice:

    • Use custom action if:
      • JSON is complex
      • Reused in multiple places
    • Use script input if:
      • Simple one-time transformation



        If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
        Thank You