# Adding Template to Recipe logic using script

**URL:** <https://forum.inductiveautomation.com/t/adding-template-to-recipe-logic-using-script/73509>\
**Category:** 3rd Party Modules\
**Tags:** sepasoft\
**Created:** [May 10, 2023, 4:03am UTC](https://forum.inductiveautomation.com/t/adding-template-to-recipe-logic-using-script/73509 "2023-05-10T04:03:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user66](https://avatars.discourse-cdn.com/v4/letter/u/b487fb/32.png) [@user66](https://forum.inductiveautomation.com/u/user66)\
**Post date:** [May 10, 2023, 4:03am UTC](https://forum.inductiveautomation.com/t/adding-template-to-recipe-logic-using-script/73509/1 "2023-05-10T04:03:52Z")

</div>

Hi all,  
I'm creating a recipe using scripting functions. I'm trying to add a template that is present in **Batch Recipe Editor** to recipe logic using addStep() function.  
Is there a way to get the Template in such a format that I can pass it as argument to addStep() so that it get's added to the recipe?

---

<div class="post-metadata">

**Author:** ![mark.french](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mark.french/32/4781_2.png) [@mark.french](https://forum.inductiveautomation.com/u/mark.french)\
**Post date:** [May 11, 2023, 7:14pm UTC](https://forum.inductiveautomation.com/t/adding-template-to-recipe-logic-using-script/73509/2 "2023-05-11T19:14:31Z")

</div>

Hi user66,

I'd recommend consulting our [Recipe Creation Script examples like this one.](https://help.sepasoft.com/docs/display/SEPA/Create+Recipe+with+Serial+Steps)

Also, feel free to reach out to [support@sepasoft.com](mailto:support@sepasoft.com) and we can schedule a call to look at your use case and apply best practices.

Best regards,  
Mark

---

<div class="post-metadata">

**Author:** ![user66](https://avatars.discourse-cdn.com/v4/letter/u/b487fb/32.png) [@user66](https://forum.inductiveautomation.com/u/user66)\
**Post date:** [May 17, 2023, 5:15am UTC](https://forum.inductiveautomation.com/t/adding-template-to-recipe-logic-using-script/73509/3 "2023-05-17T05:15:39Z")

</div>

Is there scripting functions that can be used to perform the similar operation as dragging and dropping a template from **Palette** to design space?

I tried doing this using some scripting function and it was working but when I delete the recipe the template is also getting deleted along with it. But when I do the same in recipe editor without using the scripting functions it does not get deleted from the template.

I think this might have something to do with the way I'm setting the ref UUID.  
I'm currently using the function [system.mes.batch.recipe.loadTemplate(name, parentLink) - MES Platform 3.0 - Sepasoft MES Help Documentation](https://help.sepasoft.com/docs/pages/viewpage.action?pageId=51120476&src=sidebar) and getUUID() then later setting the same to the added step using setLogicRefUUID().
