Skip to content

Instantly share code, notes, and snippets.

@cgillis-aras
Created January 12, 2021 17:42
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/3a2254990ad36109bad0ab779fda3d7a to your computer and use it in GitHub Desktop.
Save cgillis-aras/3a2254990ad36109bad0ab779fda3d7a to your computer and use it in GitHub Desktop.
Sample code for a generic version of an action that will get the name of the User who has claimed any ItemType
Innovator inn = this.getInnovator();
// Check to see if this item is claimed at all
if (this.isLocked() == 0)
{
return inn.newResult("No one");
}
// Query to make sure that we have the locked_by_id property
string selectedType = this.getType();
Item selectedItem = inn.newItem(selectedType, "get");
selectedItem.setID(this.getID());
selectedItem.setAttribute("select", "locked_by_id(keyed_name)");
selectedItem = selectedItem.apply();
// Get the name of the user who locked this part
Item claimer = selectedItem.getPropertyItem("locked_by_id");
string claimerName = claimer.getProperty("keyed_name");
return inn.newResult(claimerName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment