# Split (modularize) action's code

**URL:** <https://community.auth0.com/t/split-modularize-actions-code/66697>\
**Category:** Get Help\
**Created:** [July 23, 2021, 6:46pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697 "2021-07-23T18:46:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alfredo.anderson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alfredo.anderson/32/25669_2.png) [@alfredo.anderson](https://community.auth0.com/u/alfredo.anderson)\
**Post date:** [July 23, 2021, 6:46pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697/1 "2021-07-23T18:46:36Z")

</div>

Hi guys, sorry if this is a silly question but I can’t find related information.

There is a way to modularize the action’s code ?

Let’s say, chain actions (ie. run action A and, if A is successful, run action B) or split the action’s code in multiple source files ?

The question is because we are using and action to do a lot of things when a user logs in for the first time (as part of a lazy migration scheme) and the action code is getting too big and we like to split it some way.

Regards

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 23, 2021, 10:18pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697/3 "2021-07-23T22:18:08Z")

</div>

Hi @alfredo.anderson,

You can create multiple actions, this should probably be the approach you take.

Chaining actions in the way you suggest doesn’t make a lot of sense with how we have them set up. If an action wasn’t successful, you would probably be denying the user access, meaning you should break from authentication.

Will multiple actions work for you?

---

<div class="post-metadata">

**Author:** ![alfredo.anderson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alfredo.anderson/32/25669_2.png) [@alfredo.anderson](https://community.auth0.com/u/alfredo.anderson)\
**Post date:** [July 26, 2021, 4:01pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697/4 "2021-07-26T16:01:41Z")

</div>

Hi Dan, thanks for the answer.

I create two post login actions and it seems they gets executed in order (if so) yes, this is exactly what I was looking for.

Thanks!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [July 26, 2021, 4:33pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697/5 "2021-07-26T16:33:08Z")

</div>

Glad that worked for you!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 10, 2021, 4:33pm UTC](https://community.auth0.com/t/split-modularize-actions-code/66697/6 "2021-08-10T16:33:11Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
