[SalesForce] How to add custom fields to SAML response

In the scenario where Salesforce is configured as Identity Provider, how can the SAML assertion returned to authenticating Service Providers be modified to include additional attributes? I cannot see any option for adding custom fields when creating a new connected app and likewise I cannot see any options for doing this when editing an existing connected app – I guess I'm not looking in the right place?

Thanks

Best Answer

When you edit an existing connected app, there should be a section down the bottom called Custom Attributes.

enter image description here

Here you can set custom fields, and a formula for the values of those fields, to be returned in the SAML response.

From the documentation:

Each custom attribute must have a unique key and must use fields available from the Insert Field menu. For example, assign a key name, such as country and insert the field $Organization.Country. When using SAML, attributes are sent as SAML attribute statements. When using OAuth, attributes are available as a custom_attributes object in the user’s Identity URL.

For more information, see https://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_edit.htm

Related Topic