Best Way to Break Out a Section of a Large Workflow into a Module?

Hey Retool Community,

I have a large workflow that has grown quite complex, and I’d like to break out a section of it into a module for better organization and reusability. However, since the workflow is already built, I’m wondering:

  • What’s the most efficient way to extract a section of a workflow into a module?
  • Are there best practices for transferring queries, transformers, and data dependencies?
  • Is there a way to “copy” existing workflow steps into a module, or does it have to be rebuilt manually?

I’d love to hear from anyone who has done this before—what worked well for you? Any pitfalls to avoid?

Thanks in advance!

Example attached: break out the blue stuff to a module

Hi @mascaritas,

I don't know of any "best practices", but I've had to do this a few times and my preferred method has been

  • Duplicate the workflow twice,
  • In one copy (copy A), disconnect the new chunk (blue in your case) from old - but don't delete anything right away
    -- Connect the newly disconnected chunk to the start trigger
  • In the other copy (copy B), disconnect the same (blue) chunk
    -- Modify the base part to call copy A with the required payload
  • Adjust copy A to reference the startTrigger payload in place of any old dependencies

There might be better ways, but this flow has allowed me to mess around with it while not risking breaking the large, but working, base workflow.

2 Likes

wow thanks, elegant hack!
I often embed a database call based on a primary key, in this case the whole blue section runs only on one key that will extract all other info from a db row, so your proposal is super-feasible and convenient here, thanks a lot

1 Like