Utility functions in the Core Framework can make common tasks much easier. These are available only for Tasks and Targets. To use the function call
Utils.<function-name>(<params>), for example
|Returns true if the given date is after the start date and before the end date of the event.
|Returns a new Date set to midnight the given number of days after the given date. If no date is given the date defaults to today.
|Attempts to work out the LMP from the given doc. If no LMP is given it defaults to four weeks before the reported_date.
|Returns the task schedule with the given name from the configuration.
|Returns the reported_date of the most recent of the reports with form ID matching the given form.
getMostRecentTimestamp but returns the report, not just the reported_date. From CHT v3.14.0, it also accepts an array of forms.
isFormSubmittedInWindow(reports, form, start, end)
|Returns true if any of the given reports are for the given form and were reported after start and before end.
|Returns true if the firstReport was reported before the secondReport.
|Returns the current Date.
|Returns the value of the specified fieldPath. The fieldPath is a period separated json path.
|A constant for the number of milliseconds in a day.
Please open an issue if you’d like other functions included.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.