Using Custom Salesforce Audit Fields With Standard Impersonation

  • Updated

Applies to Riva Cloud Corporate and Riva On-Premise.

By default, Standard Impersonation causes all changes or additions made to Salesforce by the Riva synchronization process to be recorded as having been made by the "admin connection user" account used by Riva to connect to Salesforce. This can lead to confusion as to which user was the actual author of a contact creation or modification.

Following the instructions in this article causes Riva and Salesforce to record the name of the user on whose behalf Riva has created or modified a contact, and the Salesforce contact record displays two fields: Created On Behalf Of and Modified On Behalf Of, as shown below:

SalesforceAuditOnBehalfOf (1).png

By default, the Created By and Last Modified By fields display the admin account that is being used by Riva to sync to Salesforce. The additional custom fields show the name of the user on whose behalf the account was created or last modified if it was created or modified by Riva.

To add custom fields to audit Riva Cloud Corporate or Riva On-Premise data sync activity:

  1. If Riva syncs events and tasks, then in Salesforce, create custom fields in the Activity module.
  2. In Salesforce, create custom fields for non-activity modules that Riva will sync data for.
  3. In Salesforce, modify the page layout for each module that Riva will sync data for.
  4. In Riva, refresh the Salesforce connection for it to support the custom field mappings.

Step 1: If Riva Syncs Events and Tasks, Then In Salesforce, Create Custom Fields in the Activity Module

This procedure involves creating four fields that Riva can use to display which CRM user creates or modifies an Activity item (events and tasks):

  1. Riva Created By: A text field that records the display name of the syncing user.

  2. Created On Behalf Of: A formula field that displays the name of the CRM user that the item was created on behalf of.

  3. Riva Modified By: A text field that records the display name of the syncing user.

  4. Modified On Behalf Of: A formula field that displays the name of the CRM user that the item was created on behalf of.

Add new activity module custom fields for "Created By" and "Created On Behalf Of"

To create custom fields #1 and #2:

  1. Log in to Salesforce as an admin user.

  2. Navigate to Setup > App Setup > Customize > Activities > Activity Custom Fields.

  3. On the Activity Custom Fields page, select New, and follow the wizard to create the following custom fields:

Custom Field #1: Riva Created By

  • This field is a Text field. It is used by Riva to record the UserID of the user on whose behalf Riva is creating the contact.
  • When defining the field-level security, make this field read-only for all profiles except the profile used by the Riva connection user.
  • In addition, it may be desirable to enable field-level tracking for this field for historical tracking purposes.

activity-created-by (1).png

Custom Field #2: Created On Behalf Of

  • This field is a Formula field used in conjunction with the native Salesforce CreatedBy and the Riva_CreatedByName fields.
  • This field conditionally shows the name of the user in the Riva_CreatedBy field if the CreatedBy is set to the Riva connection user.
  • This field displays the name of the user on whose behalf Riva created the contact.

activity-created-on-behalf-of (1).png

Note: In the displayed example,
IF(CreatedBy.Username = "gw-sfadmin@rivacloud.com", Riva_CreatedByName__c, ""), replace gw-sfadmin@rivacloud.com with the Salesforce username used by the Riva connection to Salesforce.

Add new activity module custom fields for "Modified By" and "Modified On Behalf Of"

Create custom fields #3 and #4.

Custom Field #3: Riva Modified By

  • This field is a Test field. It is used by Riva to record the UserID of the user on whose behalf Riva is creating the contact.
  • When defining the field-level security, make this field read-only for all profiles except the profile used by the Riva connection user.
  • In addition, it may be desirable to enable field-level tracking for this field for historical tracking purposes.

activity-modified-by (1).png

Custom Field #4: Modified On Behalf Of

  • This field is a Formula field used in conjunction with the native Salesforce LastModifiedBy and the Riva_ModifiedByName fields.
  • This field conditionally shows the name of the user in the Riva_ModifiedOnBehalfOf field if the CreatedBy is set to the Riva connection user.
  • This field displays the name of the user on whose behalf Riva created the contact.

activity-modified-on-behalf-of (1).png

Note: In the displayed example,
IF(LastModifiedBy.Username = "gw-sfadmin@rivacloud.com", Riva_ModifiedByName__c, ""), replace gw-sfadmin@rivacloud.com with the Salesforce username used by the Riva connection to Salesforce.

List of activity custom fields

When all the custom audit fields have been added, the list should look like this:

activity-custom-fields (1).png

Step 2: In Salesforce, Create Custom Fields for Non-Activity Modules That Riva Will Sync Data For

This procedure involves creating four fields that Riva can use to display which user mailbox caused the account creation or modification to occur:

  1. Riva Created By: a lookup field that records the display name of the syncing user.

  2. Create On Behalf Of: a formula field that displays the name of the CRM user that the item was created on behalf of.

  3. Riva Modified By: a lookup field that records the display name of the syncing user.

  4. Modified On Behalf Of: a formula field that displays the name of the CRM user that the item was modified on behalf of.

The same procedure is used to create the custom fields in each module that Riva will sync data for:

  • Contacts, accounts, and leads.
  • Opportunities, cases, and contracts.

A similar procedure can be used for activities, but those require slightly different fields because Salesforce does not support lookup fields for activities.

  • Events (if syncing calendar items).
  • Tasks (if syncing tasks and email).

Add New Non-Activity Module Custom Fields for "Created By" and "Created On Behalf Of"

To create custom fields #1 and #2:

  1. Log in to Salesforce as an admin user.

  2. Navigate to Setup > App Setup > Customize > Specific Module (for example, Contacts) > Fields.

  3. Scroll to the bottom of the page. In Custom Fields & Relationships, select New, and follow the wizard to create the following custom fields:

Custom Field #1: Riva Created By

  • This field is a Lookup field with a relation to the User record type. It is used by Riva to record the UserID of the user on whose behalf Riva is creating the contact.
  • When defining the field-level security, make this field read-only for all profiles except the profile used by the Riva connection user.
  • In addition, it may be desirable to enable field-level tracking for this field for historic tracking purposes.

RivaCreatedBy (1).png

Custom Field #2: Created On Behalf Of

  • This field is a Formula field used in conjunction with the native Salesforce CreatedBy and the Riva_CreatedBy fields.
  • This field conditionally shows the name of the user in the Riva_CreatedOnBehalfOf field if the CreatedBy is set to the Riva connection user.
  • This field displays the name of the user on whose behalf Riva created the contact.

CreateOnBehalfOf (1).png

Note: In the displayed example,
IF(CreatedBy.Username = "gw-sfadmin@rivacloud.com", Riva_CreatedBy__r.FirstName & " " & Riva_CreatedBy__r.LastName, ""), replace gw-sfadmin@rivacloud.com with the Salesforce username used by the Riva connection to Salesforce.

Add new non-activity module custom fields for "Modified By" and "Modified On Behalf Of"

Create custom fields #3 and #4.

Custom Field #3: Riva Modified By

  • This field is a Lookup field with a relation to the User record type. It is used by Riva to record the UserID of the user on whose behalf Riva is creating the contact.
  • When defining the field-level security, make this field read-only for all profiles except the profile used by the Riva connection user.
  • In addition, it may be desirable to enable field-level tracking for this field for historic tracking purposes.

RivaModifiedBy (1).png

Custom Field #4: Modified On Behalf Of

  • This field is a Formula field used in conjunction with the native Salesforce LastModifiedBy and the Riva_ModifiedBy fields.
  • This field conditionally shows the name of the user in the Riva_ModifiedOnBehalfOf field if the LastModifiedBy field is set to the Riva connection user.
  • This field displays the name of the user on whose behalf Riva modified the contact.

ModifiedOnBehalfOf (1).png

Note: In the displayed example,
IF(LastModifiedBy.Username = "gw-sfadmin@rivacloud.com", Riva_ModifiedBy__r.FirstName & " " & Riva_CreatedBy__r.LastName, ""), replace gw-sfadmin@rivacloud.com with the Salesforce username used by the Riva connection to Salesforce.

List of non-activity module custom fields

When all the custom audit fields have been added, the list should look like this:

contact-custom-field-list (1).png

Step 3: In Salesforce, Modify the Page Layout for Each Module that Riva Will Sync Data For

After adding the custom fields to each module, you can adjust the page layout for each module that Riva will sync data for to display the newly added custom fields:

page-loyout-contact-form (1).png

Step 4: In Riva, Refresh the Salesforce Connection for It to Support the Custom Field Mappings

Implementation for Riva Cloud CORPORATE

Advise Riva Cloud support that you have implemented custom audit fields and need your Salesforce connection modified. Complete a Contact Us form or send an email to support-cloud@rivasync.zendesk.com with the following information:

Subject: Other

For our Riva Cloud CORPORATE subscription registered to <Riva Cloud admin login user name>, please complete the following changes for our custom Salesforce audit fields:

  1. Refresh the metadata.

  2. Set the following:

    • Created By Id = Custom field API name, for example, Riva_CreatedBy__c
    • Modified By Id = Custom field API name, for example, Riva_ModifiedBy__c
    • Created By Name = Custom field API name, for example, Riva_CreatedByName__c
    • Modified By Name = Custom field API name, for example, Riva_ModifiedByName__c

Implementation for Riva On-Premise 2.4.47 or higher

  1. In the Riva Manager application, on the menu bar, select Setup.

  2. In the right pane, double-click the Salesforce connection object.

  3. On the Object Definition page, for every module that you added custom audit fields to in Salesforce, add the fields to the Selected Fields box. For more information, see Object Definition.

  4. On the Impersonation page, near the bottom, select Configure Custom Audit Fields.

    The Custom Audit Fields window appears.

    47-Custom-Audit-Fields (1).png

Custom Audit Fields

  1. In the Custom Audit Fields window, in the list box, select a Salesforce module.

  2. Under Options, select the appropriate custom field for each audit purpose for the selected module:

    • None: The sync for the selected module uses no custom audit fields. All Riva sync changes made in the module are recorded against the Riva connection user.

    • Riva Predefined: The sync for the selected module uses the custom audit fields created in Salesforce as described in this article, at the major steps 1 and 2. The read-only names of the custom fields are displayed in this window in the Created By and Modified By fields. All Riva sync changes made in the module are recorded against those custom audit fields.

    • Custom By Id/User Reference: The sync for the selected module uses other custom audit fields created in Salesforce to refer to the users by ID or user reference. In the Created By and Modified By fields, select the custom audit fields to use. All Riva sync changes made in the module are recorded against those custom fields.

    • Custom By Name: The sync for the selected module uses other custom audit fields created in Salesforce to refer to the users by name. In the Created By and Modified By fields, select the custom audit fields to use. All Riva sync changes made in the module are recorded against those custom fields.

  3. To select the custom audit fields for another module, repeat steps 1 and 2.

  4. Select or clear the Set native 'Created By' field to sync the user checkbox. Selecting this check box overrides the selections made in step 2. For more information, see the 'Created By' field.

  5. Save the Salesforce connection.

  6. Sync data of each type from the email system to Salesforce.

  7. In Salesforce, confirm that every synced item reflects the correct Created ByCreated On Behalf OfModified By, or Modified On Behalf Of value.

Was this article helpful?

/

Comments

0 comments

Article is closed for comments.