Pre-filling customer details
This guide describes how to prompt a user to sign into their account in order to pre-fill their customer details, and how make the relevant form fields pre-fill.
- Creating a sign in prompt
A sign in prompt is a block of text in a 'grid' that contains an instruction and link for the user to sign in to their Hantsweb account. To add one to your form page, you first need to create the grid.
Go into Common Content > Grids > Signinforms in Sitecore Content Editor.
Create a duplicate of an existing sign in grid (example):
Re-name it to something that relates to your form.
The grid will contain an info block like this:
Edit the ‘sign in’ URL so that the callback will return the user to your form page, once they have signed in, e.g.:
- Adding the sign in prompt to your page
1. Find your form page in the Sitecore content tree and go into Experience Editor (Publish>Experience editor)
2) Insert a component. To do this go to Home>component. Select an appropriate placeholder, and click 'Add here'. Then choose Rendering>building block>Navigation>Grids>12.
3) Select 'Select existing content' and select the grid you created earlier
4) Your grid will now appear on the page
- Making the sign in prompt disappear once the user is signed in
In Experience Editor, click on the personalization icon (the 3 people ) above your sign-in grid.
You will get a Personalize box. Click on the plus sign to add a new rule.
Give the rule a name, e.g. ‘SignedIn’, then click the Edit rule button .
You will get a Create Rule box. Select ‘where predefined rule is true’:
This will add a rule into the Edit rule box below. Click on the link ‘predefined rule is true’:
Then select ‘visitor is signed in’ and OK the rule.
You then need to use the ‘Content:’ box to browse for your grid. Once, you’ve found it it will appear as below:
Finally, click on the ‘Hide’ radio button, so that the grid will be hidden when the visitor is signed in:
You also then need to set the Default condition to show your grid if none of the other conditions are met, as below:
- Forcing users to sign in
In rare situations, you may need to force the user to sign into their account before using your form.
An example of this is the Concessionary Travel Pass Replacement form. The customer must be identified as the owner of a travel pass before they can get a replacement. Signing in enables this.
You need to set personalization rules on the page your form is on to say that the user must be signed in to view the page.
In Sitecore Content Editor go to the Security tab and select Assign
Click on Add and wait a while for the ‘Add an Account’ box to appear.
Select the Role ‘extranet\Access Level 1’ (if you want customers with access level 1 to use the form) and click OK. Set the permissions for this role to match the permissions shown below:
Click Add again and select Users to add the extranet\Anonymous user:
Set the permissions for this user to match the permissions shown below:
The permissions for Everyone should look like this:
OK these permissions, save and publish the page. When the user goes to the URL for your page, they will be redirected to a screen like this:
Once they have signed in, they will be directed to your page and will be able to use the form.
- Pre-filling details from the Customer Account into the form fields
Find the form field you want to pre-fill in Sitecore Content Editor, e.g. First Name, and go into the dropdown list on the field property called ‘Default value datasource’. Select the data item you want to pre-fill the field with, e.g. C4CFirstNameFromProfile.
Note: All the fields available from the customer’s profile are prefixed with ‘C4C’.
A quick way to achieve the pre-filling of customer contact details in your form is to copy a form step containing pre-filled contact details from another form.
Note: there is currently a bug about prefilling the address field. Once resolved, the information will be added here on how to do that.