6. Advanced Settings

Objective

Here are described more advanced technics. It’s not necessary to read this in order to configure simple login scenario, but if your users already can sign in, here you can find info how to adjust or optimize that process.

6.1. Role Mapping

Objective

Explains how to push Salesforce user roles to corresponding DNN user profile.

Note

In example below we created mapping for three Salesforce user roles: “Intranet”, “Editors”, “Administrator”. Naturally plugin can sync any other role.

“Salesforce Authentication SPI” allows copy Salesforce roles to DNN user profile on login process. If role doesn’t exist in DNN, it will be automatically created. Salesforce user roles are trasfered to DNN via two custom properties:

  • first property of a type Picklist (Multi-Select), that contains list of Salesforce user roles,
  • second property of a type Formula that will dynamically populate property above, depending on whether or not user belongs to role,

Below is explained how to create these properties.

6.1.1. Property “RoleNames”

  1. Go to: Build-> Customize-> Users-> Fields, see figure below

    _images/advanced-settings-role-mapping_01.png
  2. Scroll down to section “User Custom Fields” and click on button New. This will start simple wizard that will create new user property.

  3. For “Data Type” select Picklist (Multi-Select) and click Next, see figure below.

    _images/advanced-settings-role-mapping_02.png
  4. Set property label to RolesNames, select option “Enter values, with each …”. Then enter role names and click Next, see figure below.

    _images/advanced-settings-role-mapping_03.png
  5. On the “Step 3. Establish field-level security” click Next, see figure below.

    _images/advanced-settings-role-mapping_04.png
  6. On the “Step 4. Add to page layouts” click Save, see figure below.

    _images/advanced-settings-role-mapping_05.png
  7. Newly created property object is avaialble in section “User Custom Fields” (under the “Build-> Customize-> Users-> Fields”). Check the “API Name”, this value will be used to create second property, see figure below.

    _images/advanced-settings-role-mapping_05a.png

6.1.2. Property “RoleValues”

  1. Go to: Build-> Customize-> Users-> Fields, see figure below

    _images/advanced-settings-role-mapping_01.png
  2. Scroll down to section “User Custom Fields” and click on button New. This will start simple wizard that will create new user property.

  3. For “Data Type” select Formula and click Next, see figure below.

    _images/advanced-settings-role-mapping_06.png
  4. For “Filed Label” enter RoleValues and for “Return Type” select Text, then click Next, see figure below.

    _images/advanced-settings-role-mapping_07.png
  5. For the textbox named “Role Values(Text)” enter following code snippet and click Next

    Warning

    In our case “API Name” for property “RoleNames” is “webadv__RoleNames__c”. Please be aware that for your Salesforce instance this could be vary.

    IF ( INCLUDES ( $User.webadv__RoleNames__c, "Intranet" ), "Intranet|+|; ","Intranet|-|;") &
    IF ( INCLUDES ( $User.webadv__RoleNames__c, "Editors" ), "Editors|+|; ","Editors|-|;") &
    IF ( INCLUDES ( $User.webadv__RoleNames__c, "Premium" ), "Premium|+|; ","Premium|-|;")
    
  6. See image below.

    _images/advanced-settings-role-mapping_08.png
  7. On the “Step 4. Establish field-level security” click Next, see figure below.

    _images/advanced-settings-role-mapping_09.png
  8. On the “Step 5. Add to page layouts” click Next, see image below.

    _images/advanced-settings-role-mapping_10.png
  9. If everything is correct, under section “” should be two new properties, see figure below.

    _images/advanced-settings-role-mapping_11.png

6.1.3. Configure “Connected App”

This section will show how to expose newly created properties outside of Salesforce. To do that we will add profile mappings. This task is very similar to Profile Mapping.

  1. Go to Setup-> Build-> Create-> Apps

  2. Scroll down to section “Connected Apps” and click on your connected app. In this case “Connected Apps” name is “For my DNNv9.2”, but it could vary for your Salesforce instance.

    _images/base-config-salesforce-profile-mapping_01.png
  3. Scroll down to section “Custom Attributes” and click on New button, see figure below.

    _images/base-config-salesforce-profile-mapping_02.png
  4. In panel “Create Custom Attribute”, for textbox Key enter value Roles, and click on button Insert Field, see figure below.

    _images/advanced-settings-role-mapping_12.png
  5. Inside popup “Insert Field”, click on $User> then RoleValues and click on button Insert, see figure below.

    _images/advanced-settings-role-mapping_13.png
  6. Click on Save button, see image below.

    _images/advanced-settings-role-mapping_14.png
  7. The mapping was successfully created and “Connected App” will export Salesforce user roles to DNN. From DNN perspective this propety will be visible as Roles.

    _images/advanced-settings-role-mapping_15.png