cancel
Showing results for 
Search instead for 
Did you mean: 

Best Practice for Actions

AndrewPascal
Level 5

I'm reviewing our coding standards and would like some clarification on the use of actions, please.

We currently ban Actions from calling other Actions in the same Business Object. The reason is, basically, that a second copy of the object will be loaded in memory. As well as causing unwanted memory load, it also means that any global data items may have different values in the two different instances of the object, which is a recipe for unexpected side-effects.

We also ban Actions from calling other Actions in the same Business Object as Pages. On the face of it, I can't see any reason for this rule. Aside from making it harder to trace dependencies, is there any reason not to call a published action as a page?

3 REPLIES 3

Anton__Hosang
Level 5

Calling actions within the same VBO as a page is the way to go. As you said, no second instance is created then, and even BP-authored VBOs have this setup (actions calling pages). e.g. Outlook, Excel etc.

PvD_SE
Level 12

Hi Andrew,

The first one seems obvious so that stand.

The second one seems dubious to me. As Anton correctly points out, even the out of the box objects are built that way.
A typical example for is the Attach page that attaches to the application if this is not already the case. We call the Attach page from almost every other page in the same object right after the Start stage. 

Happy coding!
Paul
Sweden

Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

AndrewPascal
Level 5

Thanks, @AntonHosang1 and @Paul JHM van Doorn. I couldn't see any reason for the rule, but I just wanted to check whether I had missed something!

Have a great weekend.