Salesforce Integration - Custom Objects and Their Fields

Follow

 

This article contains a detailed list of all the custom Salesforce objects, and their fields. This documentation is designed to share with your Salesforce developers or anyone needing detailed information about Skilljar's Salesforce integration. 

Common Fields

There are a few fields that are common to many of the Skilljar objects and have special usage.

skilljar__Obfuscated_Id__c

This field represents the Skilljar ID of the object instance within the Skilljar platform.  This ID is consistent across our API, the SFDC App and our BI connector.

skilljar__Contact__c

The Contact field is an optional lookup from our Skilljar objects to a SFDC Contact.  If you’ve checked the “Link contacts” checkbox in Skilljar, then when one of these objects is updated, we look for a corresponding Contact object with the same email address as the associated skilljar__Student__c object.  If we find a Contact (or more than one) - we link to the most recently created Contact object.  If we do not find a Contact with the same email address, we create a new Contact record and link to that.

Most times, these newly created “orphaned contacts” will need to be associated to an Account.  Skilljar does not attempt to do this - as it often requires human intervention, or business-specific logic to map accordingly.  Most customers of ours write a custom Apex Trigger, or have created a process to manually assign orphaned contacts on a periodic basis.

skilljar__Lead__c

This field is deprecated and should not be used.  It will be removed in future versions of the SFDC application.  If you want to link Leads to Skilljar objects, we recommend that you extend the Skilljar object and add your own custom field for this purpose.

Custom Objects

Student

"skilljar__Student__c": {

"skilljar__Contact__c": {

"length": 18, "type": "reference", "label": "Contact" },

"skilljar__Email__c": {

"length": 80, "required": true, "type": "email", "label": "Email" },

"skilljar__First_Name__c": {

"length": 30, "type": "string", "label": "First Name" },

"skilljar__Last_Name__c": {

"length": 30, "type": "string", "label": "Last Name" },

"skilljar__Lead__c": {

"length": 18, "type": "reference", "label": "Lead" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string"

}

}

Signup Field

"skilljar__Signup_Field__c": {

"skilljar__Student__c": {

"length": 18, "required": true, "type": "reference", "label": "Student" },

"skilljar__Contact__c": {

"length": 18, "type": "reference", "label": "Contact" },

"skilljar__Domain_Name__c": {

"length": 255, "required": true, "type": "string",

"label": "Domain Name" },

"skilljar__Label__c": {

"length": 100, "required": true, "type": "string", "label": "Label" },

"skilljar__Lead__c": {

"length": 18, "type": "reference", "label": "Lead" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Value__c": {

"length": 100, "type": "string", "label": "Value" }

}

Course (Published Course)

"skilljar__Published_Course__c": {

"skilljar__Course_Id__c": {

"length": 64, "type": "string", "label": "Course Id" },

"skilljar__Course_Title__c": {

"length": 100, "required": true, "type": "string",

"label": "Course Title" },

"skilljar__Course_URL__c": {

"length": 255, "required": true, "type": "url", "label": "Course URL" },

"skilljar__Domain__c": {

"length": 255, "required": true, "type": "string", "label": "Domain" },

"skilljar__Lesson_Count__c": {

"length": 0, "required": true, "type": "double", "label": "Lesson Count" },

"skilljar__Live__c": {

"length": 0, "required": true, "type": "boolean", "label": "Live" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" }

}

Enrollment

"skilljar__Enrollment__c": {

"skilljar__Published_Course__c": {

"length": 18, "required": true, "type": "reference",

"label": "Published Course" },

"skilljar__Student__c": {

"length": 18, "required": true, "type": "reference", "label": "Student" },

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Contact__c": {

"length": 18, "type": "reference", "label": "Contact" },

"skilljar__Enrolled_At__c": {

"length": 0, "required": true, "type": "datetime",

"label": "Enrolled At" },

"skilljar__Expires_At__c": {

"length": 0, "type": "datetime", "label": "Expires At" },

"skilljar__Lead__c": {

"length": 18, "type": "reference", "label": "Lead" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Promocode__c": {

"length": 40, "type": "string", "label": "Promocode" },

"skilljar__Purchase_Currency_Code__c": {

"length": 3, "type": "string", "label": "Purchase Currency Code" },

"skilljar__Purchase_Price__c": {

"length": 0, "type": "currency", "label": "Purchase Price" },

"skilljar__Purchase__c": {

"length": 18, "type": "reference", "label": "Purchase" }

}

Course Progress

"skilljar__Course_Progress__c": {

"skilljar__Published_Course__c": {

"length": 18, "required": true, "type": "reference",

"label": "Published Course" },

"skilljar__Student__c": {

"length": 18, "required": true, "type": "reference", "label": "Student" },

"skilljar__Certificate_Code__c": {

"length": 24, "type": "string", "label": "Certificate Code" },

"skilljar__Certificate_Validation_Url__c": {

"length": 255, "type": "url", "label": "Certificate Validation Url" },

"skilljar__Completed_At__c": {

"length": 0, "type": "datetime", "label": "Completed At" },

"skilljar__Completed_Lesson_Count__c": {

"length": 0, "type": "double", "label": "Completed Lesson Count" },

"skilljar__Contact__c": {

"length": 18, "type": "reference", "label": "Contact" },

"skilljar__Credit_Unit_Plural__c": {

"length": 40, "type": "string", "label": "Credit Unit Plural" },

"skilljar__Credits_Earned__c": {

"length": 20, "type": "string", "label": "Credits Earned" },

"skilljar__Enrolled_At__c": {

"length": 0, "type": "datetime", "label": "Enrolled At" },

"skilljar__Latest_Activity__c": {

"length": 0, "type": "datetime", "label": "Latest Activity" },

"skilljar__Lead__c": {

"length": 18, "type": "reference", "label": "Lead" },

"skilljar__Lesson_Count__c": {

"length": 0, "type": "double", "label": "Lesson Count" },

"skilljar__Max_Score__c": {

"length": 0, "type": "double", "label": "Max Score" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Score__c": {

"length": 0, "type": "double", "label": "Score" },

"skilljar__Success_Status__c": {

"length": 255, "type": "picklist", "label": "Success Status" }

}

Offer

"skilljar__Offer__c": {

"skilljar__Currency_Code__c": {

"length": 3, "required": true, "type": "string",

"label": "Currency Code" },

"skilljar__Description__c": {

"length": 100, "required": true, "type": "string",

"label": "Description" },

"skilljar__Domain_Name__c": {

"length": 255, "type": "string", "label": "Domain Name" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Price__c": {

"length": 0, "required": true, "type": "currency", "label": "Price" },

"skilljar__Published_Course__c": {

"length": 18, "type": "reference", "label": "Published Course" },

"skilljar__Sku__c": {

"length": 255, "type": "string", "label": "Sku" },

"skilljar__Type__c": {

"length": 255, "type": "picklist", "label": "Type" }

}

Purchase

"skilljar__Purchase__c": {

"skilljar__Student__c": {

"length": 18, "required": true, "type": "reference", "label": "Student" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Offer_Currency_Code__c": {

"length": 3, "required": true, "type": "string",

"label": "Offer Currency Code" },

"skilljar__Offer_Price__c": {

"length": 0, "required": true, "type": "currency",

"label": "Offer Price" },

"skilljar__Offer_Sku__c": {

"length": 255, "type": "string", "label": "Offer Sku" },

"skilljar__Offer__c": {

"length": 18, "type": "reference", "label": "Offer" },

"skilljar__Order_Id__c": {

"length": 20, "type": "string", "label": "Order Id" },

"skilljar__Payment_Processor_Order_Id__c": {

"length": 128, "type": "string", "label": "Payment Processor Order Id" },

"skilljar__Payment_Processor_Purchase_Data__c": {

"length": 32768, "type": "textarea",

"label": "Payment Processor Purchase Data" },

"skilljar__Payment_Processor__c": {

"length": 255, "type": "picklist", "label": "Payment Processor" },

"skilljar__Promo_Code_Price__c": {

"length": 0, "type": "currency", "label": "Promo Code Price" },

"skilljar__Promo_Code_Quantity__c": {

"length": 0, "type": "double", "label": "Promo Code Quantity" },

"skilljar__Promo_Code__c": {

"length": 18, "type": "reference", "label": "Promo Code" },

"skilljar__Purchased_At__c": {

"length": 0, "required": true, "type": "datetime",

"label": "Purchased At" },

"skilljar__Quantity__c": {

"length": 0, "required": true, "type": "double", "label": "Quantity" },

"skilljar__Refunded_At__c": {

"length": 0, "type": "datetime", "label": "Refunded At" },

"skilljar__State__c": {

"length": 255, "type": "picklist", "label": "State" },

"skilljar__Tax_Price__c": {

"length": 0, "type": "currency", "label": "Tax Price" }

}

Promo Code Pool

"skilljar__Promo_Code_Pool__c": {

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Purchase__c": {

"length": 18, "type": "reference", "label": "Purchase" }

}

Promo Code

"skilljar__Promo_Code__c": {

"skilljar__Promo_Code_Pool__c": {

"length": 18, "required": true, "type": "reference",

"label": "Promo Code Pool" },

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Code__c": {

"length": 40, "required": true, "type": "string", "label": "Code" },

"skilljar__Max_Uses__c": {

"length": 0, "required": true, "type": "double", "label": "Max Uses" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Use_Count__c": {

"length": 0, "required": true, "type": "double", "label": "Use Count" }

}

Access Code Pool

"skilljar__Access_Code_Pool__c": {

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Domain_Name__c": {

"length": 255, "type": "string", "label": "Domain Name" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Purchase__c": {

"length": 18, "type": "reference", "label": "Purchase" }

}

Access Code

"skilljar__Access_Code__c": {

"skilljar__Access_Code_Pool__c": {

"length": 18, "required": true, "type": "reference",

"label": "Access Code Pool" },

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Code__c": {

"length": 40, "required": true, "type": "string", "label": "Code" },

"skilljar__Max_Uses__c": {

"length": 0, "required": true, "type": "double", "label": "Max Uses" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" },

"skilljar__Use_Count__c": {

"length": 0, "required": true, "type": "double", "label": "Use Count" }

}

Domain Membership

"skilljar__Domain_Membership__c": {

"skilljar__Student__c": {

"length": 18, "required": true, "type": "reference", "label": "Student" },

"skilljar__Access_Code__c": {

"length": 18, "type": "reference", "label": "Access Code" },

"skilljar__Active__c": {

"length": 0, "required": true, "type": "boolean", "label": "Active" },

"skilljar__Domain_Name__c": {

"length": 255, "type": "string", "label": "Domain Name" },

"skilljar__Expires_At__c": {

"length": 0, "type": "datetime", "label": "Expires At" },

"skilljar__Obfuscated_Id__c": {

"required": true, "label": "Skilljar Id", "length": 64, "externalId": true,

"unique": true, "type": "string" }

}

Schema Diagram

The following diagram shows the Skilljar Custom Objects and the relationships between them.


Screen_Shot_2017-05-02_at_1.45.04_PM.pngScreen_Shot_2017-05-02_at_1.44.51_PM.png

Appendix A: Example Payment Processor Purchase Data

Each payment gateway that Skilljar integrates with returns a different set of fields related to the transaction.  Skilljar places the payment processor data in a JSON dictionary and includes this data in the skilljar__Payment_Processor_Purchase_Data__c field of the skilljar__Purchase__c object.

 

The following JSON blob is an example of the Payment Processor Purchase Data field returned from Cybersource:

 

{"req_transaction_type": "sale", "req_item_1_code": "published_course", "req_item_0_code": "published_course", "req_item_1_name": "Example Course Title", "reason_code": "100", "req_card_expiry_date": "12-2020", "req_bill_to_surname": "Smith", "req_item_1_tax_amount": "1.25", "req_card_number": "xxxxxxxxxxxx1111", "message": "Request was processed successfully.", "req_bill_to_address_city": "Big Valley", "auth_response": "00", "bill_trans_ref_no": "778514404XFZ3IZ4GT8JV", "auth_amount": "157.50", "req_tax_amount": "7.50", "auth_avs_code": "2", "decision": "ACCEPT", "req_line_item_count": "2", "req_item_0_unit_price": "100.00", "req_device_fingerprint_id": "a5b496655f9a41cdb54073e761b23474C06B8942-AACE-488E-8F1A-2B59BAB56793", "auth_avs_code_raw": "0", "req_locale": "en", "req_promotion_code": "test-promocode", "req_bill_to_address_country": "CA", "req_bill_to_address_line1": "33 Broadway St #8539", "req_card_type": "001", "req_bill_to_address_postal_code": "T0J 0G0", "req_item_1_quantity": "2", "utf8": "\\u2713", "auth_code": "0XXXXA", "req_transaction_uuid": "0cebf852-6382-4b3c-94b2-880dab358240", "req_currency": "USD", "req_bill_to_forename": "Jane", "req_item_1_unit_price": "25.00", "req_item_0_tax_amount": "5.00", "request_token": "Ahj//wSTCQlz9DjBAYgrFCrdu4asWjRg0sRrTOTaaR6jiVWS5HeaQegFLkd5pB60gd7DNzUMmkmWLr4GGxBgTkwkJc/Q4wQGIKwAIQWQ", "req_amount": "157.50", "req_item_0_sku": "wty5crj2uhdo", "req_item_1_sku": "wty5crj2uhdo", "req_item_0_quantity": "1", "auth_time": "2017-03-07T171353Z", "req_bill_to_email": "jane.smith@example.com", "req_access_key": "975bb97f0503379f97202a302fbcdbdf", "req_reference_number": "63F2UHHG", "signed_date_time": "2017-03-07T17:13:53Z", "req_profile_id": "C06B8942-AACE-488E-8F1A-2B59BAB56793", "transaction_id": "4889068336026287704107", "req_item_0_name": "Example Course Title", "req_bill_to_address_state": "AB", "req_payment_method": "card"}

 

In this example, 3 copies of a $100 course were purchased, a promo code was used to reduce the price (test-promocode - reduced price to $25) only had 2 uses - so it was applied to 2 out of the 3 items.  The total tax amount charged to the user ("req_tax_amount") was "7.50".  Much of this data is contained in the root skilljar__Purchase__c object as well, but extra information like "transaction_id" is only included within this JSON field since it is specific to this particular payment processor.

Accessing Payment Processor Data via Apex Code (Example)

In Salesforce Apex code, JSON can be easily parsed by the JSONParser class.  The following example shows how to retrieve a value (in this case, the transaction_id) from th the skilljar__Payment_Processor_Purchase_Data__c field:

 

skilljar__Purchase__c purchase = [SELECT skilljar__Payment_Processor_Purchase_Data__c FROM skilljar__Purchase__c WHERE skilljar__Obfuscated_Id__c = 'abcd12345'];

 

String responseData = purchase.skilljar__Payment_Processor_Purchase_Data__c;

 

Map<String, Object> data = (Map<String, Object>)JSON.deserializeUntyped(responseData);

 

String transactionId = (String)data.get('transaction_id');

 

Apex Trigger to add Transaction ID to Purchase (Example)

You may extend the Skilljar custom objects with your own fields.  Building on the previous section, if you added a custom “Transaction ID” field (Transaction_Id__c) to the skilljar__Purchase__c object, you could write an Apex Trigger to automatically set the new field value after a skilljar__Purchase__c was updated:

 

trigger addTransactionId on skilljar__Purchase__c (after insert, after update) {
   List<skilljar__Purchase__c> p = [SELECT Id, Transaction_Id__c, skilljar__Payment_Processor_Purchase_Data__c FROM skilljar__Purchase__c WHERE Id IN: Trigger.newMap.keySet()];
   for (skilljar__Purchase__c purchase: p) {
      if (purchase.Transaction_Id__c == Null && purchase.skilljar__Payment_Processor_Purchase_Data__c != Null){
           String responseData = purchase.skilljar__Payment_Processor_Purchase_Data__c;
           Map<String, Object> data = (Map<String, Object>)JSON.deserializeUntyped(responseData);
           if (data.containsKey('transaction_id')) {
               String transactionId = (String)data.get('transaction_id');
               purchase.Transaction_Id__c = transactionId;
               update purchase;
           }
       }

   }
}

Have more questions? Submit a request

Comments

Powered by Zendesk