Server Administration > Automate Tasks and Calculate Data Using Event Triggers > Using the Windchill RV&S API in Event Triggers > API Trigger Code
  
API Trigger Code
The following API trigger code performs the equivalent functionality of the
si createcp --issueID=101 command:
//Get the bean
var eb=bsf.lookupBean ("siEnvironmentBean");

//Create an API session bean
var apiSession = eb.createAPISessionBean();

//Create the command
var command = new Packages.com.mks.api.Command("si", "createcp");
command.addOption (new Packages.com.mks.api.Option("issueId", currentID));

//Execute the command and get the response
var response = apiSession.executeCmd (command);