When you create a rule in the Setup or use Screen Designer, TeamConnect provides customization options in the user interface. If the user interface does not offer the type of customization you want, you use the API classes to create custom code and upload the code to TeamConnect. The TeamConnect API allows you to create the following types of custom code:
•Conditions—You add conditions to the Qualifier page of a rule or the General tab of a condition. Custom conditions are also known as automated qualifiers.
•Actions—You add actions to the Action page of a rule and the Actions page of a wizard. Custom action are also known as automated actions.
•Blocks—You upload custom blocks to the Screens directory under the Documents tab and select them from the Blocks tab to add them to a specific object definition. Custom blocks are also known as custom screens.
•Wizard blocks—You upload custom blocks to the Screens directory under the Documents tab and select them from the wizard's Page Components tab. Wizard blocks are also known as wizard custom screens.
•Scheduled actions—You upload scheduled actions to the Scheduled Actions directory under the Documents tab and select them from the Scheduled Actions tool under the All tab.
•Tools—You upload custom tools to the Tools directory under the Documents tab and select them from the Administer Custom Tools page.
Use the sample code in this topic as a starting place for each previously mentioned code type.
This code provides a sample for a custom action on a contact rule. It also includes code for logging Debug messages.
import com.mitratech.teamconnect.enterprise.api.custom.CustomAction; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class ContactCustomAction extends CustomAction<Contact> {
@Override public void action(final Contact contact) { logDebug("contact="+contact); } } |
This code provides a sample for a custom action with parameters on a contact rule.
import com.mitratech.teamconnect.enterprise.api.custom.CustomAction; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class ContactCustomAction extends CustomAction<Contact> {
@Override public void declareParameters() { getParameters().addTextParameter("name", "Label", "Default Value"); }
@Override public void action(final Contact contact) { logDebug("Parameter="+getParameters().getTextParameterValue("name")); } } |
This code provides a sample for a custom condition on a contact rule or condition. It also includes code for logging Debug messages.
import com.mitratech.teamconnect.enterprise.api.custom.CustomCondition; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class ContactCustomCondition extends CustomCondition<Contact> {
@Override public boolean condition(final Contact contact) { logDebug("contact="+contact);
return true; } } |
This code provides a sample for a custom block for a contact record. It also includes code for custom initialization.
import com.mitratech.teamconnect.enterprise.api.custom.CustomBlock; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class MyCustomBlock extends CustomBlock<Contact> { @Override public void initialize(java.util.Map<String, String> pageArgs) { // Perform some custom initialization }
public String getText() { Contact contact = getRecord(); // Display something on screen
return contact.getDisplayString(); } } |
This code provides a sample for a custom block for a contact wizard. It also includes code for parameters and custom initialization.
import com.mitratech.teamconnect.enterprise.api.custom.WizardCustomBlock; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class MyCustomBlock extends WizardCustomBlock<Contact> { @Override public void initialize(java.util.Map<String, String> pageArgs) { // Perform some custom initialization getParameters().addTextParameter("name", "Label", "Default Value"); }
public void action() { Contact contact = getRecord(); logDebug("Parameter=" + getParameters().getTextParameterValue("name")); logDebug("Contact=" + contact.getDisplayString()); } } |
This code provides a sample for a scheduled custom action for a contact. It also includes code for logging Debug messages.
import com.mitratech.teamconnect.enterprise.api.model.Contact; import com.mitratech.teamconnect.enterprise.api.custom.ScheduledCustomAction;
public class SampleActionClass extends ScheduledCustomAction { @Override public void action() { logDebug("message"); } } |
This code provides a sample for a custom tool. It also includes code for logging Debug messages.
import com.mitratech.teamconnect.enterprise.api.custom.CustomTool; import com.mitratech.teamconnect.enterprise.api.model.Contact;
public class MyCustomTool extends CustomTool { @Override public void initialize(java.util.Map<String, String> pageArgs) { // Perform some custom initialization }
public void action() { Contact contact = getRecord(); logDebug("Contact=" + contact.getDisplayString()); } } |