Skip to content

Instantly share code, notes, and snippets.

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/ec354b80f9bc368d03df917f9c834f3d to your computer and use it in GitHub Desktop.
Save cgillis-aras/ec354b80f9bc368d03df917f9c834f3d to your computer and use it in GitHub Desktop.
Demonstrates how a single Method can be used both as a custom action and as a server event.
string actionName = this.getAction();
string thisMethodName = "labs_CalculateDynamicDate"; // Set this to the name you are using for your method
if (actionName == thisMethodName)
{
// If we get here, this is being used as a custom action, so switch to a get and return the results of that.
this.setAction("get");
return this.apply();
}
// If we get here, we are running in a server event, so just return this as normal
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment