Last active
May 3, 2019 14:07
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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