The execution of a PeopleSoft Application Engine starts with the Main section and flows down to other sections which are called from the main section.
For calling a section from within one, we use the call section action. To do this, in the call-section action, we specify the name of the App engine and the section we wish to call. If the section is in the same App engine, then, providing the name of the App engine is optional.
How to use Dynamic Call-Section in App engine?
Often, business logic requires us to call different sections based on the occurrence of certain conditions in different scenarios and that too from the same call-section. To enable this kind of logic, we will have to make the call-section dynamic. This is how we can do it.
Dynamic Call-Section State Record
To enable dynamic call-section, we need to have a default state record that can support it. The state record, in this case, should have two extra fields – AE_APPLID and AE_SECTION. If you intend to make a dynamic call to sections that are in the same App engine as the calling section, then the state record would be good to go with just AE_SECTION.
PeopleCode for Dynamic Call-Section
Once you have the state record in place, it’s time to set the values for the extra fields – AE_APPLID and AE_SECTION. This should be done before the dynamic call section. The simplest way to implement this is to use a if-else as shown below:
if condition then
AE_APPLID = "AE_ABC_TEST";
AE_SECTION = "SEC_STATE";
else
AE_APPLID = "AE_ABC_TEST";
AE_SECTION = "SEC_CITY";
end-if;
Call-Section Action
This is the final step. Insert a Call-section action into the App engine. Check the Dynamic checkbox that states that the call-section is dynamic. On finding the dynamic check-box checked, the processor looks for the values of AE_APPLID and AE_SECTION in the state record and calls the section mentioned in AE_SECTION from the app engine that is mentioned in the AE_APPLID.
If the AE_APPLID is blank, the processor calls the section mentioned in AE_SECTION from the current application engine.
That’s detailed and complete. Thanks for sharing.
I’m new to PeopleSoft and have a question. Is there any need for the state record to be a database record in this case.
Thank you
Deepu
@Deepu – Glad that you found it useful.
To answer your question, there is NO such requirement that the state record should be a database record in this case.
Hey, thanks for sharing this information, It was helpful to me.
Thanks for stopping by and letting us know that it was helpful.
thanks, your information help me much
thanks a lot for the information. Its really useful.
Thanks. Glad to know it was useful!
But if my app engine has multiple state records and these two fields – AE_APPLID and AE_SECTION are in a state record, but not in default state record. So can i make a dynamic call in this case also?
@Vidu
Should be in the default state record.
Is it possible to either make a dynamic section call or not? I.e. I want to call a section or not call it. In your example, which I’ve tried, I left the section blank and get an error. Should I create a section that does nothing and call it?
thanks!
Bruce
@Bruce – If there’s only one section involved, why not rewire the design to handle it with a conditional statement rather than going the dynamic call section route?
Thanks for taking time and sharing this info. It really helped me.
@Santhosh – Happy to know that!
It helps me as i am beginner in Peoplesoft technical
I am using tools 8.55.11 and I don’t see the dynamic checkbox. The only checkbox I see is Active. What am I missing?
@Chini – Are you looking at the Call-section action rather than a section.
Call-section actions do not have an active checkbox – the only checkbox present is the Dynamic one.
The post was really helpful in understanding the usage of dynamic call section. I have couple of queries.
Does AE_SECTION have to be a key field in state record? Also, as asked earlier, is it necessary to put AE_SECTION field in default state record?
Thanks in advance!
@Naina,
The only key in a state record is the Process Instance.
More on State records here.
Yes, the fields should be in the default state record.