We are here to help.

Custom Object (Contests) Setup Guide

Overview & Requirements
  • You must be logged in as a system administrator and should be familiar with creating custom Triggers* as a Trigger development experience is necessary when following these steps.
  • You will be creating a custom Trigger for the Custom Objects you would like to include as part of the Contest Engine Wizard
  • Triggers need to be created in your Sandbox first
  • You will need to run unit tests against this new Trigger in order to promote it into your Production org.
*Trigger is a Salesforce term for code that executes on one of your objects when data is created, changed or deleted in that object.
Step 1:

Go to the Setup section, expand the Create section and click on Objects

User-added image
Step 2:

Find the object you want to make available within a competition and click on the Object Name. In our example, the Custom Object name is Shiny

User-added image

Step 3:

Scroll down to the Triggers section and click "New"

User-added image
Step 4:

Your Trigger will start out looking like the screen below. Replace <name> with the name of your custom Trigger. We recommend using the following naming convention: objectname_scblogic. You will then replace <events> with the following: after insert, after update, after delete

User-added image

Using our Shiny object as the example, below is what this will look like before moving to the next step:

User-added image
Step 5:

In the second line, insert the text below. Note the bolded text in red which should be replaced with the name of your custom object

Copy: ePrize_Zemzu.SCBCustomContestEvaluator.evaluate('Shiny__c',Trigger.new,Trigger.old);

After inserting the text, press Save. 

User-added image
Step 6: Apex Class
  • Salesforce will require you to code a unit test for your Trigger when deploying from a Sandbox into Production. Due to the unique business rules that you may have in place around your object, we cannot tell you exactly what needs to be in your unit test
  • At a minimum, you'll need to provide 75% code coverage of your Trigger
  • This can be done through a simple unit test/apex class which inserts one of you Objects
  • Using our Shiny Trigger as an example below is an example unit test. You'll have to write an appropriate one for your environment, the test below is designed to show how we insert a new Shiny Object which requires an Opportunity. Your environment, objects, and business rules will be different. Your Salesforce Administrator will know more about the constraints around creating an Object
@isTest (SeeAllData=true)
private class TestShiny_SCBLogic {
static testMethod void runTest() {
Opportunity opp = [Select Id From Opportunity Limit 1];
Shiny__c obj = new Shiny__c(Name='ePrize Test', Opportunity_Name__c = opp.Id);
insert obj;
System.assert(obj.ID != null);

Step 7: Deploy to Production

Follow the normal process for deploying custom Triggers to Production
  • Outbound Change Sets
In the Sandbox:
  • Deploy--Outbound Change Sets--Click "New" and create a Change Set
  • Under Change Set Components (find your new Apex Trigger and Apex Class)
  • Upload into your Production Org
  • Inbound Change Sets
In Production:
  • Deploy--Inbound Change Sets--Click on Change Set and Deploy
Step 8: Make Your Custom Object Available
  • Go to your "All Tabs (+)" page and select Contest Engine  Support
User-added image
  • Click Custom Contest Configuration
User-added image
  • Select the Custom Object you created a Custom Trigger for and Click Add
User-added image

The added object is now available on the Wizard step

That's it, you're done!

Below is what the custom object will look like: (name of the object__c)

User-added image
Still need assistance? Email gethelp@leveleleven.com
Have more questions? Submit a request