Sync Salesforce Objects to WordPress | WordPress Object Sync for Salesforce

Sync Salesforce Objects to WordPress | WordPress Object Sync for Salesforce


Salesforce is a popular CRM (Customer Relationship Management) and cloud-based IT application provider which has solutions in various sectors like marketing, analytics, and customer service. Alongside its suite of applications, Salesforce also has its own Community Portal for its users. With its wide range of services and applications, Salesforce becomes a partaker in several use cases across several domains such as CRM, customer service & management, etc. - for direct consumers using simple CMSs like WordPress, to large enterprises as well. Consider the following use case with WordPress, for example where you want to sync Salesforce objects to your WordPress site.

Scenario

You have a WordPress site wherein your users are created. Salesforce provides some information about these Users like Account Name and “Account Number”. When the user is registered on the WordPress site the user information should be synced on Salesforce where the paid members will be able to login into Salesforce through their Salesforce Community Portal which would allow them to make changes in their Salesforce profile which will be reflected back on WordPress. To access their Salesforce profile the users will receive an email regarding their Password (either Password itself or Password reset link).

Requirements

  1. SSO into WordPress to access Salesforce Community: WordPress is set up as a portal from where authenticated users can access the Salesforce Community Portal.
  2. Object Sync after Single Sign-On: Object sync is setup to update the user details in the WordPress database on the basis of details sent (updated) by Salesforce.

Components Involved

Note: You will require the Premium version of both the plugins to implement the Salesforce Sync solution. To test the basic functionality of the plugins, you can download their free versions from the links given below.

If you want the premium version of the plugins or have any questions related to your use-case you can contact us at samlsupport@xecurify.com.

  1. Login using WordPress Users is used here to authenticate the user using WordPress to access the Salesforce Community Login Page.

  2. Login with WordPress users to any application. SAML SSO or WSFED SSO into Tableau, Zoom, Moodle LMS, etc using WP users. [24×7 SUPPORT]

     Tested with 5.9.1

  3. With the help of the Object Data Sync Salesforce plugin updated user details are synced into the WordPress database to update the user information.

  4. WordPress Salesforce Object Sync | Sync Salesforce Objects bidirectionally with WordPress. Enable real-time sync, scheduled sync, Salesforce Sync with Workflows Automation, sync leads from WordPress to Salesforce, Salesforce ACF/CPT UI integrations, and more.

Solution

This use-case can be solved using Login using WordPress Users plugin, Object Data Sync for Salesforce plugin, and Apex triggers.

WordPress as IDP plugin will be installed in WordPress this enables SSO from WordPress as IDP [ Identity Provider ] and Salesforce as SP [ Service Provider ]. We will enable JIT (Just in Time provisioning) in Salesforce this will allow us to create new community portal users in Salesforce and existing users will be logged into their account.


Salesforce WordPress object sync | Salesforce Sync Flow
  1. When an unregistered user tries to access the Salesforce Community portal, the user first has to be registered on the WordPress site.
  2. Upon registration, the users will be authenticated by WordPress itself, and these users will be allowed to log into the Salesforce Community portal via a link to the Community page.
  3. To facilitate this, we will enable JIT (Just in Time provisioning) in Salesforce, which will allow us to create new Community portal users in Salesforce and existing users will be logged into their account.
  4. If the users change/update their user profile attributes in Salesforce, Apex triggers will be triggered to send the updated user profile attributes to the Object Sync plugin in WordPress, which will then process and send the updated data to the respective attributes in the WordPress database.

However, to allow JIT, WordPress as IDP plugin needs to send a few required attributes in SAML assertion. The following points decide if a user needs to be created or if it already exists.

Salesforce JIT flow

Federation ID is matched with the NameID in the SAML response. This will decide if a user object exists in Salesforce or not. If not it will try to create a user with the attributes received in the SAML response.

If the username in the SAML response matched with any salesforce it will give an error about a duplicate username. The same error can be given when you provide the wrong profile ID for an existing salesforce User.

Mapping the Required Profile Attributes in the SAML Response

Source Attribute Name released from WordPress as IDP plugin Representation of Released attribute in Salesforce Data validation at Salesforce end
NameID Federation ID is_email
Contact.Email Email of Contact object linked to the user object is_email
Contact.LastName LastName of the contact object linked to the user object string
Account.AccountNumber AccountNumber of the account object in the To be obtained from Salesforce; needs to be populated from the Salesforce data
Account.Name Account Name of the account object linked to the user object in salesforce To be obtained from Salesforce; needs to be populated from the Salesforce data
User.userName username in user object is_email
User.email Email in user object is_email

To facilitate the syncing of Salesforce objects with WordPress, Apex triggers exist on the Salesforce side, which when triggered, make API calls to WordPress to carry out the synchronization. These Apex triggers are triggered when any changes are made to the attributes of the Salesforce objects. The triggers then call the WordPress APIs which then reflect the same changes to their respective user attributes in the WordPress database. Consider for example, the ‘email’ attribute of the ‘Contact’ Salesforce object. This attribute is linked to the ‘user_email’ attribute in the WordPress database table. When changes are made to the ‘Contact.Email’ object attribute in Salesforce, the Apex triggers call the WordPress APIs which then reflect the same changes in the ‘user_email’ attribute in the WordPress database tables. Thus, with the Object data sync for Salesforce plugin you can configure which object attributes in Salesforce should be mapped to which WordPress attributes, which can enable the synchronization of all the objects and attributes within Salesforce and WordPress.

Contact "Before update" trigger on will be used to sync data from salesforce to WordPress [ This data consists of the [contact’s old email and Contact email ], Also we will change User.email, User.userName, and User.FederationId ensures that User details are matched with WordPress users.

End User Experience

The User logs into the WordPress site using this information, eligible users (Paid Members) will see a link (Link to Salesforce Community Portal).Once a user is created in the WordPress site, an email will be sent to the User regarding their Password (either Password itself or Password reset link).

If the user clicks on this link, the user should be able to access the Salesforce Community Portal. Users will be able to edit their profile in Salesforce and these changes will be reflected in WordPress.

Conclusion

With the Login Using WordPress Users (WP as SAML IDP) plugin, users can authenticate with their WordPress credentials and log into the WordPress site, where only eligible users will be able to then access the Salesforce Communities. The WordPress Object Sync for Salesforce plugin facilitates mapping of the Salesforce objects to the respective objects in WordPress by using Apex triggers on the Salesforce end. This allows for all the mapped objects to sync changes in the data from Salesforce to reflect the same in WordPress.

Additional Resources

Why Our Customers choose miniOrange WordPress Single Sign-On (SSO) Solutions?


24/7 Support

miniOrange provides 24/7 support for all the Secure Identity Solutions. We ensure high quality support to meet your satisfaction.

Sign Up

Customer Reviews

See for yourself what our customers say about us.
 

Reviews

Extensive Setup Guides

Easy and precise step-by-step instructions and videos to help you configure within minutes.

Watch Demo


We offer Secure Identity Solutions for Single Sign-On, Two Factor Authentication, Adaptive MFA , Provisioning, and much more. Please contact us at

 +1 978 658 9387 (US) | +91 97178 45846 (India)   samlsupport@xecurify.com

Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com