All Collections
Integrations Hub
Integrations Hub - SSO: Mapping Multiple Values to a Single Field
Integrations Hub - SSO: Mapping Multiple Values to a Single Field
Eric Wind avatar
Written by Eric Wind
Updated over a week ago

There are some cases in which you will want to map multiple values to a single field in a user's profile. This article assumes that you have already set up your SSO. If not, please search for the help article relevant for your organization's SSO connector and set that up first.

To get started on mapping multiple values to a single field:

1. In your SSO connector, tab to the Field Mapping section

2. Click on the field where you would like to map multiple values

3. Select the relevant field(s)

4. Click Save, Publish and Test


At this point, you'll notice the values will have been mapped to the field but they are appearing in raw JSON in the User Profile. You will need at least a basic level of Javascript understanding to format the field for public display.

1. After you test and confirm this is the data you want in the field, go back to the Field Mapping section and click on the Code icon under Actions.

2. Select Add Conditions

3. A coding box will appear, which will have some basic Javascript. Do not delete the pre-existing code; your code should go within the pre-written function.

4. Once setup, click Save. You can test the validity of the code by clicking Test.

5. If it passes, exit out of the box and test your SSO from the utility bar again.

Below is an example script for formatting two values (First Name and Last Name) within a single field:

/** Please DO NOT remove/change the function signature**/

function getCustomValue (fieldValue) {
let result = fieldValue;

if(typeof fieldValue === 'string' && fieldValue.trim() !== ''){

const parsedData = JSON.parse(fieldValue);

if(parsedData.firstname && parsedData.lastname){
result = parsedData.firstname + ' ' + parsedData.lastname;
} else {
result = JSON.stringify(parsedData, null, 2);
}

}

return result;
}

Did this answer your question?