Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample code for an onBeforeGet server event to replace the string "yesterday" in a date property with code that will search on yesterday's date.
Innovator inn = this.getInnovator();
string createdOn = this.getProperty("created_on", "");
if (createdOn == "yesterday")
{
DateTime yesterday = DateTime.Today.AddDays(-1);
DateTime eodYesterday = yesterday.AddHours(23).AddMinutes(59).AddSeconds(59);
this.setPropertyAttribute("created_on", "condition", "between");
this.setProperty("modified_on", String.Format("{0} and {1}",
yesterday.ToString("yyyy-MM-ddTHH:mm:ss"),
eodYesterday.ToString("yyyy-MM-ddTHH:mm:ss")));
return inn.newError(this.node.OuterXml);
}
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.