Adding / Changing Attributes in Apty SFDC Connector

PREREQUISITES:

1.   As an Admin, log into the Salesforce instance that has the Apty Connector Package installed. At the top right corner of the screen click the Gear icon and from the menu select Developer Console.

2.   The Developer Console opens. In the Console 2 files should be accessed for editing: 

  • aptySalesforceController.apxc
  • aptySalesforceController.js

The following 2 steps provide the paths to open these files and instructions on what shall be modified in them.

3.   Open the aptySalesforceController.apxc file:

  • At the top left corner of the screen clickFile > Open Resource.
  • In the opened window enter "apty" as a keyword for searching for a required file.
  • In the filtered list find the aptySalesforceController.apxc file and double click it or select it and click Open at the bottom of the screen.

4. Modify the class as needed. For example, if you want to add a given account’s attributes to the user object (assuming that the user owns only one account) then you can add the highlighted lines of code.

In the example below we are selecting 2 standard Salesforce Account entity attributes: 

  • LastViewedDate, and
  • Name.

 

  • Custom field attributes can be pulled in this query as well. For more details on how custom fields are added in Salesforce, refer to this article.
  • Once modified, make sure to save the changes in a file.

5.   Open the aptySalesforceController.js file:

  • At the top left corner of the screen click File > Open Resource.
  • In the opened window enter "apty" as a keyword for searching for a required file.
  • In the filtered list find the aptySalesforceController.js file and double click it or select it and click Open at the bottom of the screen.

6.   Declare and initialize the account variable as shown below:

var account = storeResponse.account[0];

Define attributes added in Step 4 for the userInfo variable as shown in the picture (definition depends on the context).

Once modified, make sure to save the changes in a file.

8.   You can test if the connector works as expected by navigating to https://yourSFDCDomain.force.com/c/aptySalesforceIntegration.app and verifying that the returned JSON object contains the data you need.

For more details on how to modify a class, refer to Apex Code Best Practices