This is the final part of my blog series on Adxstudio portals (soon to be called Dynamics CRM portals).
These are the first three parts:
I was lucky enough to be in a Service Cloud Bootcamp last week which covered all things Dynamics CRM Service, including Dynamics CRM portals. The good news is everything I have written in my previous articles will apply in the new version, except for how demos are provisioned but the process in Part One still applies at the time of writing this article.
In this part I will talk about setting up a Web Form. This is like an Entity Form but has multiple pages and can be across multiple entities. In some ways it is like the Business Process Flow of portals.
For my example I will set up a Web Form which allows us to create a new Account record in CRM and then loop through creating Contacts against it until we are done.
Planning Out the Web Form
The first step is planning out the forms. In my case, the flow will be:
- Go to a form which allows me to capture a new Account
- On the form have a flag which the portal user uses to say whether they want to create a new Contact or not
- Make a decision, based on the value of this flag and either end the Web Form process or show the Contact form to capture a new Contact
- If we have entered a new Contact, return to the Account form, rinse and repeat.
Creating the Entry Forms
So we will need an Account form and a Contact form in CRM to display in the portal. This is my Account form:
This things of note are in the second column. I have a two option field to mark if I want to create a new Contact or not and a Sub-Grid of the Contacts associated to my Account.
This is my Contact form.
Nothing special here, just out of the box Contact fields.
Setting up the Web Form Record
Similar to the Entity Form, we go to CRM – Portals – Web Forms and create a new one. Key fields to populate are:
- Name: A name for the record
- Start Step: We will come back to this a couple of steps down but, in essence, this is the first form we show when the Web Form is shown on the portal Web page. In our case the Account Form
- Start New Session on Load: This means that when the Web Page loads, the Account Form will be blank and ready for a new Account to be entered; we are not reloading a previous, unfinished session.
- Web Form Steps: This is a sub-grid on the form which contains the steps of our Web Form.
In this case I have three steps:
Two of these are the forms (an Account and Contact form) and one is a Condition Step to check whether we want to create another Contact or not.
Setting up the Web Form Steps
Let us start with the first step in the process: the Account Form.
The key fields are:
- Name: Name for the Web Form Step
- Web Form: The parent Web Form (already filled out)
- Type: There are five types available: Condition, Load Form, Load Tab, Redirect and Load User Control. In this case, we select Load Form. We will use Condition for the decision point later. Load Tab loads the tab of a CRM Form, Redirect goes to a different web address, and Load User Control loads a custom control
- Target Entity Logical Name: The entity associated to the CRM Form which will be loaded. In this case, Account.
- Next Step: Where we go next. In this case, we go to the Condition Step to see if we need to create a new Contact. As we have not created the Condition Step yet, we will need to complete this later
- Mode: How the Form will act in the Web Page. The options are Insert (create a new record), Edit (change an existing one) and Read Only (display an existing record). We select Insert, as we are inserting a new Account record.
- Form Name: The form to load from the target entity. In this case, it is our custom CRM Account Form.
Even though our next step is the Condition Step, let us do the Contact Form Step to get it out of the way.
Key fields here are:
- Name: Name for the Web Form Step
- Web Form: The parent Web Form
- Type: Again, we select Load Form
- Target Entity Logical Name: Here we select Contact.
- Next Step: Where we go next. In this case, we loop back to our Account form
- Mode: I accidentally left this blank and it worked but I imagine it should be Insert as we are creating a new Contact
- Form Name: The form to load from the target entity. In this case, it is our custom CRM Contact Form.
- Set Entity Reference On Save: This allows us to link our newly created Contact to the Account in the first step so we select Yes
- Relationship Name: LEAVE THIS BLANK!! It presents as a free text field so I thought it wanted some kind of name but it just generates errors if you do. Leave it blank and save yourself hours of debugging grief
- Target Lookup Attribute Logical Name: A complicated name for lookup on the Contact record you want to populate to link the Contact to the Account. In our case, it is the Parent Customer lookup
- Populate Lookup Field: I also imagine this should be ticked but, again, in mine it was not but still seems to work
- Entity Logical Name: This may seem unnecessary but as the Parent Customer lookup can be a Contact or Account, we need to say which one we want to link to (Account)
- Source Type: We can specify Query, as with the Entity Form, or, in our case, Previous Step
- Reference Entity Step: The previous step which holds the record we want to link to. In our case it is the step we created before
Finally we create our Condition step used to decide whether we are creating a new Contact or not.
The key fields are:
- Name: As before
- Web Form: As before
- Type: Now we select Condition
- Target Entity Logical Name: The flag we are checking is on our Account form so we select Account.
- Next Step: If the flag is measured to be True then we want to create a new Contact so we select the New Contact Step
- Condition: This is used as the test for whether the Condition values as True or False. In our case we specify “lt_newcontact = true” where “lt_newcontact” is the name of the flag field
- Next Step If Condition Fails: Leave this blank and the Web Form process will finish. Please also note that if you reverse your condition, populate this one and set the Next Step field as blank you will get an error
And that is it. All that is left is to create our web page.
Setting Up The Web Page
This follows the same process as the Entity Form and View. We go to the portal, log in as the Administrator and create our page on, say, the home page as a child page, linking to the Web Form.
The Final Result
If we have set it up right, we start on a Web Page showing the Account Form.
We populate it and, if we select ‘Yes’ for New Contact, we go to the New Contact form which we fill in.
Hitting the Next button as the bottom returns us to the Account form and the Contact now appears in the sub-grid.
We can either select ‘Yes’ on the New Contact flag to create more Contacts or select ‘No’ and end the process.
While a little more complex than Entity forms, there is far more control with Web forms in terms of process flow and data entry. In terms of providing forms and lists of CRM records on a web portal, it is difficult for me to think of a reason why you would not use what is now known as Dynamics CRM portals. With these blogs to guide you, give it a try for yourself.