Archive for category User Management

When using the salesforce connector with Sitecore, we came across the need to store user profile images as well in salesforce.
Once the connector is set up (which includes setup in Web.config / Domains.config and S4S.config), any user user profile interaction automatically happens with salesforce, and fields which are mapped in web.config with corresponding sitecore fields – will automatically get mapped / updated on these interactions!

The special case we came across, was with Profile images. Our site allowed the user to upload profile images, which we needed to store in salesforce, and additionally also wanted the image to show up in sitecore.

The solution we came up with, was to create a document folder in salesforce and upload all profile images there with the contact id as the file name as a document, and then store the url in the Sitecore user portrait field.

Once the document is added in salesforce, the document url will give you the base document url of your salesforce instance, which you can use and replace the intended document id to get the right url for each new document created. This is what the S4SHelper.GetDocumentUrl(documentId) method does.

Often when a new user is created (especially if created from the sitecore site – as an extranet user), we might find the need to have an approval process in place to ensure access to credible users only.

Code (This is reflected code from sitecore.kernel.dll with an additional method call for the notification. You could sure choose to write the code yourself for enable – after all you only need to toggle a user property at the end of the day, but this code will also handle the confirm messages and all error handling for you)

You might want to use the sitecore ASP.NET membership provider Core database to manage users for your sitecore site.

In that case, at some point during your site development, you will come across the need to create a new sitecore user from your site front end.
You might also want to have additional fields as is relevant to your application.
In this example, we are adding user address as additional custom fields.

The user template is available in the Core database of your sitecore instance.
The template is available at: /sitecore/templates/System/Security/User

You might also want to add a custom status field to be used by a site administrator – for user profile approval.

This field could point to a list of options also available in the core database:
Sample Template: /sitecore/templates/System/Security/User Profile Data/Profile Status Type

Options: /sitecore/content/Home/Data/Profile Status Types

Following is the code you could use to create the user:

Please note the code for default selection of the drop down field in the user template, and also the default ProfileItemId – which will determine which view the user will open in when you access the user from the User Manager console.