Skip to content

Instantly share code, notes, and snippets.

@cgillis-aras
Created August 21, 2018 20:01
Show Gist options
  • Save cgillis-aras/c475865454101a90fbe3dddbc45b80f2 to your computer and use it in GitHub Desktop.
Save cgillis-aras/c475865454101a90fbe3dddbc45b80f2 to your computer and use it in GitHub Desktop.
Example code that will successfully add a sibling Document from an onBeforeAdd on the Document ItemType using fake proeprties
Innovator inn = this.getInnovator();
if (this.getProperty("is_sibling") == "1") {
return this;
} else {
Item newDoc = inn.newItem("Document", "add");
newDoc.setProperty("item_number", this.getProperty("item_number") + " - Design");
newDoc.setProperty("name", this.getProperty("name") + "'s Sibling");
newDoc.setProperty("is_sibling", "1");
newDoc = newDoc.apply();
}
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment