Page Activate Fun - PeopleCode Friday

UPDATE (20 Jan 2020) : The answer is at the end in the video.

It's been a while since PeopleCode Friday last appeared from me so here's a fun one to keep you on your toes!

The component processor is a powerful engine and it follows some well defined logical rules.  Have you seen this useful flow diagram before? (sorry ... can't credit the author of this as I don't know who wrote it).  It may help you to answer the question below along with the PeopleCode Event guide here.


Scenario:

A Component has 2 Pages.



Both Pages have PageActivate PeopleCode.   Both code blocks update the &msg variable.




During the Component Post-Build event we execute a  TransferPage to GRS_PA_2. (The 2nd page in the Component).


Question ???

So the big question is ....What Happens!  We know that the TransferPage during PostBuild will cause the 2nd page in the component to be displayed...  So... between the transfer being initiated and page 2 being displayed what happens ?

(A) Does Page Activate fire only on Page 1 ?

(B) Does Page Activate fire only on Page 2 ?

(C) Does Page Activate fire on both Page 1 & Page 2

(D)  Or does something else happen ?
Answers and thoughts in the comments below please.

If you think it helps here's the section in PeopleBooks for PageActivate



UPDATE 20 January 2020:  Thanks to everyone who looked at this and contributed an answer below.   And now.... for the big reveal.... The answer is ..... (watch the video)


Comments

Neil Yetman said…
It has to be (B), right! (Right??) The first page hasn't gained focus up to the point the PostBuild event fires. Though I just read up on the TransferPage function, and now I'm not so sure. :-/
Sasank Vemana said…
B.

Because PostBuild fires before PageActivate. If a transfer to Page 2 occurs in PostBuild, then Page 1 is never activated.

That is my theory. Waiting to hear the answer and secretly hoping that it is not a trick question!! :)
Ari said…
I also think the answer will be B.
Pete S said…
I'm thinking B too as the Activate is the last event to fire before the page finally displays. So even if the message was displayed from page 1 the postbuild transfer would have already kicked in and the page 1 message wouldn't have time to display.
Rob Swailes said…
I am going to be controversial and say C. On the basis that the documentation says the code fires when tabbing BETWEEN pages (so we must have a start point and end point). A transfer has to have a start point which by default on a component is the first non-hidden page. By the time PostBuild fires, the component is built in memory.
In theory if I am correct then if you created a component with three pages (with the transfer going to Page 3). Then we have Page 1 hidden, it would execute Page 2 activate (Source) then Page 3 activate (Destination).
Yogesh said…
I believe its B. The moment transferpage function is called the current peoplecode program is terminated. But as page activate is the next event to fire after the post build and control has been passed to page 2, page 2 activate event will be fired.
Raushan said…
It will go with the C option and completely agree with Rob :)
Peter said…
I think B, but based largely on intuition.. but then Peoplecode never fails to surprise and confuse.

The flowchart is an interesting insight.