Monday, 13 November 2017

Part 2 of Dynamics Portals Web Forms - Edit and Read-Only mode from a single Web Form

This is part two of my Dynamics Portals Web Form series where in my last vlog I provided some insight on how to replicate a save and close of an application and how to submit an application using Dynamics Portals configuration methods. And yes, I'm still using my awesome Game of Thrones themed portal #winteriscoming #oneseasontogo

Recap

My Game of Thrones themed portal is based on recruitment in Westoros. An individual applies for a position in one of the seven kingdoms. Two Web Forms were used,
  1. Create Application
  2. View Application
In each Web Form, Web Form Steps were applied to guide the user in the application process. I showed that by relabeling the buttons and using a redirect Web Form Step to provide the sense of an application being saved, followed by a workflow to allow the application to be submitted. Have a read and watch my vlog if you haven't already done so.

This time round I'm showing you how to achieve having an edit and read-only mode of an application in Dynamics Portals.

Can't I do this already?

It's not immediately apparent. Allow me to explain. In a Dynamics Portals Entity List, there are two fields that reference Web Pages. The first is Web Page for Details View, the other is Web Page for Create.


These two fields will reference a Web Form where you can configure the desired output. For example you can set the Web Page for Create to point to a Web Page that will load an entity form to allow the portal user to create a record.

The Web Page for Details View is what will load when the record is opened from the Entity List. This means the Web Page will point to a Web Page that will load an entity form to allow the user to edit the record.


What I'm about to explain next is a follow-on user path from my previous vlog.

The user scenario is that sometimes a business requires their customers to be able to go back and edit the application which I demonstrated previously. However after the user submits the application, the application should be in read-only mode as it needs to be reviewed by the business. If a user goes back to a submitted application and opens it, what happens?

Since a Dynamics Portals entity list can only reference a single Web Page as defined in the Web Page for View Details field in the Entity List, the end user experience will be that they can edit the application as the Web Form Steps previously configured will come into play. My first step was to load the fields that allow a user to select the Kingdom they want to apply for. It wouldn't load the form in read-only mode because it hasn't been told to do so.

The user can edit the application even though they shouldn't due to the Application Web Form referenced in the Web Page as defined in the Web Page for View Details field in the Entity List.

Please say more...

What you can do to achieve edit vs read-only mode is to use a conditional Web Form Step in the Web Form that is associated to the Entity List as defined by the Web Page for View Details field. Check-out my vlog for a step-by-step guide.


How to achieve edit mode or read-only mode from a single Web Page for Details View

The key here is to use a mixture of conditional Web Form Step with a read-only Web Form.

The recipe is as follows:

  • Update the existing Dynamics 365 entity form to have a dedicated Tab for the common fields. In my vlog I use Application ID, Created On and Status Reason and called the Tab General.
  • In the View Applications Web Form, you'll need to create three new Web Form Steps.
  • Update the View Applications Web Form first step to be the Loading of the General tab and the next step to be the Condition Web Form Step.
These three Web Form Steps are
  1. A Web Form Step that will load the General tab of the Entity Form
  2. A Web Form Step that will check the Status Reason of the Application
  3. A Web Form Step that will load the Application Entity Form in Read-Only mode

1. Load the General tab

This Web Form Step will be the first step that will load common information for an unsubmitted and a submitted application and is only referencing the General tab.


2. Status Reason of the Application

This Web Form Step will be a conditional check. A Condition Web Form Step allows Dynamics Portals to check the value of a field before presenting the next logical Web Form Step. What we are creating here is a fork basically, I want the user to view their Application in read-only if the status reason of their application does not equal "Unsubmitted."

 Otherwise if the the user's Application does equal Unsubmitted then I want the user to proceed with the first Web Form Step in editing their Application.


3. Application Entity Form in Read-Only mode

The last Web Form Step is to Load the application in Read-Only mode. This will be what the user sees when the conditional Web Form Step is executed where the application does not equal
"Unsubmitted."


Update View Application Web Form

The final jigsaw puzzle is to update the Start Step to point to the Load General Tab Web Form Step in the View Application Web Form


The next step from the Load General Tab Web Form Step is the Conditional Web Form Step. This will then either load the Edit Web Form Steps or the Read-Only Application Web Form Step.


BONUS TIP

When Naming Web Form Steps, use sequential numbering as this will help you and anyone else who is will be administering the Dynamics Portals long term. You understand immediately the ordering of the Web Form Steps.

  1. Steps 0.X represents the pre-load of the Application. 
  2. Steps 1.X represents the Edit steps of the Application should the condition of Application does equal "Unsubmitted" is met. 
  3. Steps 2.X represents the Read-Only outcome should the condition of the Application does not equal "Submitted."

Hammer time

Once completed, clear the portal cache and create a brand new application to test it out.

Load the application and the condition web form step will check in where it will recognize the status reason is unsubmitted. The next steps that will follow shortly after is the Edit web form steps. Go through the Edit steps and then Save and Close the application.


Now submit the application and when you navigate to the submitted application, it will now load the application in Read-Only mode.


Summary

As mentioned in my last vlog - once you get past the basics of Dynamics Portals and start exploring to find out what else you can do without code it actually becomes fun. Well I think it's fun but maybe that's cause I'm a Dynamics nerd at heart :)

I combined different configuration methods to achieve an Edit vs Read-Only Application for a single Web Form that is associated to the Web Page of the "Web Page for Details View" field in the Entity List. By default, this field can only load one Web Page where the Web Page references a single Web Form.

By configuring the Web Form to have a conditional Web Form Step to have two outcomes allows the Edit vs Read-Only concept. Based on the Application Status Reason, the next process will either be the Edit Web Form Steps as demonstrated in my previous vlog or the Read-Only Web Form Step.

Thanks for reading and watching my vlog.

Big thanks to those who have left comments on my YouTube channel in the last year, always makes me smile when someone posts nice feedback. I do this with the hope of helping some other soul out there.

Don't forget to follow me on Twitter, I have a low count of Followers as a newbie. Thanks again for those who have started to follow me.

 Till next time, toodles.

No comments:

Post a Comment