Skip to content

Instantly share code, notes, and snippets.

@cgillis-aras
Last active May 3, 2019 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgillis-aras/a925e60fcf77d9b0a582ea703f1eab8f to your computer and use it in GitHub Desktop.
Save cgillis-aras/a925e60fcf77d9b0a582ea703f1eab8f to your computer and use it in GitHub Desktop.
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