Question
Offline Mobile Date Function Support
Hi all,
I'm trying to get current datetime within the offline mobile application. Requirement is that a certain field in UI should capture current date and time by default and user will have the ability to change it. Is this achievable in offline mobile?
I've tried using @getCurrentTimeStamp() as the "Default Value" for the property in section. But that gives me the timestamp of last full sync - not the current time stamp. Also tried using the function in pre-flowaction DT. But pega fails to run that DT as there is a function call in it.
Appreciate any suggestions on this..
***Edited by Moderator: Pallavi to update platform capability tags***
Hi Tarun,
You can try below two approaches.
1. You can have a Page type Data Page for example D_ServiceDate and source it from a Data Transform. You can set the Date property .ServiceDate property inside Data Transform using functions for example @dateTime.CurrentDate("yyyyMMdd",pxRequestor.pyUseTimeZone). You can use D_ServiceDate.ServiceDate as property for the control in section.
2. You can set the value to clipboard property using java script before displaying the section.
var serviceDate = pega.functions.DateTimeLibrary.getCurrentTimeStamp(); workPage = pega.ui.ClientCache.find("pyWorkPage"); workPage.put('ServiceDate', serviceDate);
Both these approaches should be returning proper date/time values. Please try and let us know if you face any issues.