Adxstudio Portal Primer Part Four: Web Forms

Standard

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:

Part One: Setting Up a Portal Demo

Part Two: Configuring the Portal

Part Three: Entity Forms and Lists

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:

image

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.

image

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:

image

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.

image

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

image

image

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

image

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.

image

The Final Result

If we have set it up right, we start on a Web Page showing the Account Form.

image

We populate it and, if we select ‘Yes’ for New Contact, we go to the New Contact form which we fill in.

image

Hitting the Next button as the bottom returns us to the Account form and the Contact now appears in the sub-grid.

image

We can either select ‘Yes’ on the New Contact flag to create more Contacts or select ‘No’ and end the process.

image

Conclusions

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.

Advertisements

4 thoughts on “Adxstudio Portal Primer Part Four: Web Forms

  1. Yeldarb

    Question, based on these steps could I do the same thing from a case form, in other words when a user is entering a case I want them to be able to create a new contact or account? I have lookups on my forms now, however it doesn’t seem as if the default lookups allow a user to create a new contact or form as they would in Dynamcis CRM? Greatly appreciate any feedback!

    Like

  2. Sahithi

    Hi,
    A great post. I have done all the steps but unable to load the New Accounts and Contact form.
    Do I have to enable anything in the Web form side?
    It’s taking too long to load and ultimately I’ve been facing timed out error.
    It’d be great if I can get help.

    Like

    • leontribe

      CRM Portals is not great with error messages. A timeout is likely a configuration issue (or a server caching issue) but as the settings are fiddly it will be really hard to diagnose the issue in this forum. My suggestion would be to find someone locally who can review what you have set up. Also, check out my recent post on the Metadata settings which may provide an alternative approach.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s