Skip to content

Instantly share code, notes, and snippets.

@NithinMahesh1
Created July 26, 2023 14:56
Show Gist options
  • Save NithinMahesh1/d8516dc2eaad08029d8c664d8450b66b to your computer and use it in GitHub Desktop.
Save NithinMahesh1/d8516dc2eaad08029d8c664d8450b66b to your computer and use it in GitHub Desktop.
Custom Event Handler Retrieval Method
Item relationships = this.getRelationships();
int eventItemsCount = relationships.getItemCount();
/* for each event in this batch, get the event details and perform
custom publishing logic */
for (int i = 0; i < eventItemsCount; i++) {
Item eventItem = relationships.getItemByIndex(i);
var data = eventItem.node.SelectNodes("./data");
string dataXml = string.Empty;
if (data.Count > 0) {
dataXml = data[0].InnerXml;
}
string subject = eventItem.getProperty("subject", string.Empty);
string type = eventItem.getProperty("type", string.Empty);
string eventId = eventItem.getProperty("id", string.Empty);
string time = eventItem.getProperty("time", string.Empty);
string source = eventItem.getProperty("source", string.Empty);
// add your publishing logic here
}
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment