I just asked Gemini the following question:
"Is there a PeopleCode variable to detect Fluid Mode vs Classic mode?"
Gemini responded with, "Yes!" I thought, "FANTASTIC!"
Here is the code snippet Gemini suggested:
If %Component.IsFluid Then
/* Logic specific to Fluid Mode */
MessageBox(0, "", 0, 0, "Running in Fluid Mode");
Else
/* Logic specific to Classic Mode */
MessageBox(0, "", 0, 0, "Running in Classic Mode");
End-If;Wow! That is some fantastic PeopleCode! But AI is known to hallucinate. Before trusting this code, we have to ask: Fact or Fiction?
Let's start with line 1:
If %Component.IsFluid Then
%Component returns an uppercase character string containing the name of the current component, as set in the component definition.
Verdict: Fiction.
I followed up with Gemini by asking:
"Can you share your reference for %Component?"
Instead of sharing a bibliography of cited sources, Gemini shared what appeared to be very legitimate documentation that describes Gemini's understanding of %Component. I attached a screenshot for your reference:
I circled the last statement, because it was the only part of this listing that was true:
"Gemini can make mistakes, so double-check it"
But I have to ask: Where did Gemini get its information? 🤔 Like a crack reporter, Gemini would not reveal its sources.
The good news is that Gemini is a fast learner! I fed Gemini a few authoritative PeopleBooks, such as a reference to PeopleCode System Variables, and Gemini generated a new response. This version is clever, but does it work?
Local ContentReference &oCRef;
Local boolean &isFluidMode;
/* Get the ContentReference object for the currently running content.
This object holds the metadata for the component's setup.
*/
&oCRef = %Session.GetContentReference();
If (&oCRef <> Null) Then
/* Check the IsFluid property on the ContentReference object */
&isFluidMode = &oCRef.IsFluid;
End-If;
If &isFluidMode Then
/* Execute PeopleCode specific to Fluid UI */
/* ... */
Else
/* Execute PeopleCode specific to Classic UI */
/* ... */
End-If;What do you think? Fact or Fiction?
Let's start with the first line:
Local ContentReference &oCRef;
Unfortunately, ContentReference is not a built-in PeopleCode data type. What about this line?
&oCRef = %Session.GetContentReference();
Strike 2! GetContentReference is not a documented method of the Session object.
Verdict: Fiction.
But Gemini is on to something! The Fluid Mode attribute is visible in Structure and Content, so with a bit of PortalRegistry PeopleCode and the new %CRef system variable, you could write a lot of PeopleCode to determine if the current component is using Fluid mode.
I wanted to spend a few more minutes helping Gemini find the correct answer, so I fed Gemini several more PeopleBooks entries, hoping it would derive the correct answer. Each time, Gemini gave me a new, seemingly authoritative but entirely fictitious response, inventing new App classes and creating new functions.
After a few iterations, I decided to share the correct answer with Gemini. PeopleCode has a built-in function to determine Classic from Fluid: IsFluidMode. Here is Gemini's reply:
"This built-in function provides the clean separation of logic needed when supporting the same component in both Fluid and Classic modes (emphasis added)..."
Should we tell Gemini that a single component cannot be both Fluid and Classic?
This was a fun exercise. It was like a PeopleCode puzzle: find the hidden AI hallucination, and solve the puzzle.
How about you? Do you have interesting stories about AI and PeopleSoft? If so, please share them in the comments. We love hearing your stories!
Today, there is no substitute for experience and a strong personal understanding of PeopleCode. Want to become a PeopleSoft development expert so you can better determine fact from fiction? Enroll in the JSMpros All-access training pass and start learning!



No comments:
Post a Comment