When the new session is created, it typically relies on the system date rather than inheriting the session date you set previously.
To ensure that the intended session date (10/31/2024) is applied, you could explicitly pass this date through a pack
method in your controller class. While it's true that not all standard implementations use pack
and unpack
, adding these methods will allow you to transfer custom values, such as the session date, into the new session.
Here’s a basic approach:
pack
and unpack
methods in your controller class to store the session date.pack
method, add the session date to a container that can be accessed in the new session.unpack
method to retrieve the session date and apply it where needed.For example:
public container pack()
{
return [#CurrentVersion, this.sessionDate];
}
public boolean unpack(container _packedClass)
{
Version version = RunBase::getVersion(_packedClass);
switch (version)
{
case #CurrentVersion:
[version, this.sessionDate] = _packedClass;
break;
default:
return false;
}
return true;
}
Then, set this.sessionDate
to the session date when you instantiate the controller. This way, when you use DateTimeUtil::getSystemDate()
in the new session, you can substitute it with this.sessionDate
where needed.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,802 Super User 2024 Season 2
Martin Dráb 229,129 Most Valuable Professional
nmaenpaa 101,154