Top Banner
Developer Student Guide Liquid Templating
20

Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Jan 21, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Developer Student Guide

Liquid Templating

Page 2: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Table of ContentsLesson: Liquid Templating........................................................................................................................... 3

Exercise: Add Liquid to the Copy Page...................................................................................................3

Edit the copy of a Web Page...............................................................................................................3

Add some basic Liquid content............................................................................................................4

Exercise: Create a new Snippet and render it using Liquid.....................................................................5

Create a Snippet record....................................................................................................................... 5

Edit the copy of a Web Page...............................................................................................................5

Exercise: Add Liquid to a front-side-editable Snippet..............................................................................7

Edit a Snippet through front-side editing..............................................................................................7

Add a greeting to the current user.......................................................................................................7

Exercise: Add Liquid to a front-side-editable Snippet..............................................................................8

Add a new Web Template Record in the CRM....................................................................................8

Page 3: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Lesson: Entity Forms

In this lesson, we will practice Using Entity Forms, one of the fundamental building blocks of an Enterprise-Level Adxstudio Application. We’ll look at a few basic scenarios that will demonstrate basic form functionality, as well as alternate record source types, sub-grids, and so on.

Exercise: Create an Entity Form on the Portal

In this Exercise, we will create an entity form which will render out a lead Capture form on the portal – used in a “Contact Us” scenario.

Edit a CRM for a Lead

In CRM, first we will create the CRM form itself:

1. Open Internet Explorer and navigate to your CRM online trial org2. Navigate to the Settings Area of the Site Map

3. Under the Settings area, click Customizations

4. Click Customize the System5. Select Lead from the list of entities on the left navigation of the solution editor window

3

Page 4: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

6. Click Forms

7. Open the form titled Web Form8. Click to Save As…9. Name the form New Contact Us Form10. Customize the form to your desire (add a field or rearrange something)11. Save and Close the form again.12. Reorder the forms so that the new form you create is not the default form:

a. Click Form Orderb. Click Main Form Setc. Move the newly created form to the bottom of the listd. Click OK

4

Page 5: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

13. Click Publish All Customizations – if this option isn’t shown, click to “information” on the left-hand side of the main solution window

Add The Entity Form record in the CRM

In Dynamics CRM, Navigate to Portals

Navigate to Entity Forms

Create a new Entity Form:

Name Entity Form Contact Us (or whatever you want)Entity Name LeadForm Name New Contact Us FormMode Insert

Add a new Web Page through front side editing

Now we’ll add a new web page through front-side editing. We can add it as a child of the Workspace page, if it exists, or we can add it as a child of the Content page if it does not. Note that before you can tie the Entity Form you created to the Web page, you’ll likely need to clear the cache of your website, unless you have been using your demo builder or SAAS-hosted portal.

1. Navigate to either the Community Portal application, or your Training Portal Application

5

Page 6: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

2. Sign in as administrator3. Navigate to the Content Page, or the Workspace.4. Click New > Child Page on the upper right-hand toolbar

5. Give the page a name. You can name it whatever you want, but from here on we will assume you named it Contact Us.

6. The Page Template used by this page can be any ASP.NET web forms page template. You won’t be able to use a Liquid Template. The suggestion is for you to stick with the basic Page Page Template (the default)

7. Finally, you’ll need to actually select the Entity Form that you created earlier!8. Click Save. The rest of the values can be left at their defaults.

The Page should look something like this:

6

Page 7: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Test the Form

On the Portal, fill out the form. Once you have done this, navigate to the CRM and confirm that a Lead record has been generated in the CRM (Leads can be found in the Sales Area)

Experiment

Split your CRM form into more than one tab, and enable the “Auto Generate Steps From Tabs” feature on the form. What effect does this have?

How might you keep track of which Authenticated user is creating a record, in the case that it is a logged-in user filling out the form? Does it even make sense to do so in this case?

Experiment with the “Associate Current Portal User On Insert” option.

7

Page 8: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Exercise: Alter Presentation Style using Metadata

This is exercise, we will get a bit of experience using metadata by creating an entity form Metadata record that will alter the presentation style of the “How did you Hear about us?” question on the Lead Generation (Contact Us) form so that instead of appear as a dropdown (the default), it will appear as a vertical radio button list.

Create a Metadata record in CRM

First, navigate to the Entity Form record in CRM that you created in CRM in the previous exercise. At the bottom of the main form, there is a Sub-Grid called Entity Form Metadata. From here we can add new metadata records to this form to alter its behavior. Alternatively you could also navigate to related Entity Form Metadata records using the right-hand most top navigation. We will add a new metadata record by clicking the plus icon.

When Creating the Metadata Record, first select the type as Attribute. This means an attribute on the form will be modified. Then give the Metadata the follow values (leave all unmentioned values unaltered for now)

Attribute Logical Name leadsourcecode

Control Style Option Set as Vertical Radio Button List

You can Save your changes, and navigate to the portal to try out your altered form.

8

Page 9: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Exercise: Create a Create Contact Form

In this Exercise we will do something similar to our first exercise, but the scenario is that of an enterprise-level application where an authenticated user will be creating contacts via the portal application. In a separate lesson, we will be managing permissions such that only users in certain roles will be able to create these contacts.

Add The Entity Form record in the CRM

In Dynamics CRM, Navigate to Portals

Navigate to Entity Forms

Create a new Entity Form:

Name Contact Create FormEntity Name ContactForm Name Contact Web FormMode Insert

Once you have entered the basic values, on the Entity Form record, scroll down to the Additional Settings section. You will notice a segment called “Associate Current Portal User on Insert”. We want to

9

Page 10: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

enable this option and choose to populate the Parent Contact (parentcontactid) field with the currently logged in portal user whenever a new Contact is created on the portal. This will allow us to track the User (Contact) that created the record.

Add a new Web Page through front side editing

Now we’ll add a new web page through front-side editing. We can add it as a child of the Workspace page, if it exists, or we can add it as a child of the Content page if it does not. Note that before you can tie the Entity Form you created to the Web page, you’ll likely need to clear the cache of your website, unless you have been using your demo builder or SAAS-hosted portal.

1. Navigate to either the Community Portal application, or your Training Portal Application2. Sign in as administrator3. Navigate to the Content Page, or the Workspace.4. Click New > Child Page on the upper right-hand toolbar

5. Give the page a name. You can name it whatever you want, but from here on we will assume you named it Contact Create Form.

6. The Page Template used by this page can be any ASP.NET web forms page template. You won’t be able to use a Liquid Template. The suggestion is for you to stick with the basic Page Page Template (the default)

7. Finally, you’ll need to actually select the Entity Form that you created earlier: Contact Create Form

8. Click Save. The rest of the values can be left at their defaults.

Investigate

Note that this form is now visible to all users, even unauthenticated users. If an unauthenticated user creates a contact, then the “Parent Contact” relationship will not be populated. We have the choice to

10

Page 11: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

secure the form so that only authenticated users can use the form, using Web Page Access Permissions. Try creating permissions to do this.

Another option is to assign Entity Permissions to Web Roles and enable permissions on the form. Entity Permissions are discussed in a separate lesson.

11

Page 12: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Exercise: Add a Parent Account Form

Realistically, we might only want users to access their parent account when given certain permissions. We will add an Entity Form in Edit mode, rather than insert, which will load the parent account for the currently logged in contact. This form will have a sub-grid on it, showing a grid of contact records.

For the sub-grid to function, we will need to create some Entity Permissions and enable them on the form. If you are not yet familiar with Entity Permissions, for now just follow the instructions and rest assured they will be thoroughly discussed in another lesson.

Edit a CRM for an Account

In CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing one is because we want to add a Sub-Grid (and later Notes) control to the form. If you are familiar with CRM Customization, just grab the Account Web Form and add a sub-grid to show related contacts. Here are step-by-step instructions for those with less CRM customization experience:

1. Open Internet Explorer and navigate to your CRM online trial org2. Navigate to the Settings Area of the Site Map

3. Under the Settings area, click Customizations

4. Click Customize the System5. Select Account from the list of entities on the left navigation of the solution editor window 6. Click Forms7. Open the form titled Account Web Form8. Click to Save As…9. Name the form Account View Details

12

Page 13: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

10. On the ribbon, click the INSERT tab, and insert a two-column section

11. Double-click on the section and Name it Contacts.12. Now again on the INSERT tab of the ribbon, insert a Sub-Grid

a. Name: contacts (it really doesn’t matter)b. Label: Contact (again, not important)c. Display Label on Form: No (or yes, your preference)d. Records: Only Related Recordse. Entity: Contacts (Company Name)f. Default View: Active Contacts

13. Save and Close the form again.14. Reorder the forms so that the new form you create is not the default form:

a. Click Form Orderb. Click Main Form Setc. Move the newly created form to the bottom of the listd. Click OK

15. Click Publish All Customizations – if this option isn’t shown, click to “information on the left-hand side of the main solution window

Add The Entity Form record in the CRM

In Dynamics CRM, Navigate to Portals > Entity Forms and create a new Entity Form.

Name Account DetailsEntity Name AccountForm Name Account View DetailsMode EditRecord Source Type Record Associated to Current Portal UserRelationship Name contact_customer_accountsEnable Entity Permissions true

Note that we have enabled entity permissions. This means any user accessing this form must have the permissions to do so. This is required if we want to add metadata to the form to add edit/create functionality to the form, which we are about to do so. Save the Entity Form record for now.

13

Page 14: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

Add a Contact Edit Form

If you have not already done so, you will need to add an entity form for the creation of a Contact. This is done in an earlier exercise. We also need to be able to edit existing Contacts, so Add another Entity Form for Contact (by now you should know how to create a new Entity Form):

Name Edit ContactEntity Name ContactForm Name Contact Web FormMode EditRecord Source Type Query StringRecord ID Query Parameter Name idEnable Entity Permissions true

Add Metadata to your Account Entity Form

Navigate back to the Account Details Entity Form you created just a few minutes ago. At the bottom of the main form, there is a Sub-Grid called Entity Form Metadata. From here we can add new metadata records to this form to alter its behavior. Alternatively you could also navigate to related Entity Form Metadata records using the right-hand most top navigation. We will add a new metadata record by clicking the plus icon.

When Creating the Metadata Record, first select the type as Sub-grid. You will need to first provide the sub-grid name: (contacts, or whatever you happened to name it in the steps above). Once this is done, you will be able to configure metadata configuration for the sub-grid:

1. Under View Actions, click to add a Create Action

14

Page 15: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

2. Choose the Create Contact Form (you’ll need to create one if one does not already exist)3. Under Item Actions, click to add an Edit Action4. Choose the Edit Contact Form

5. Under Item Actions, click to add a Delete Action

Now that the configuration settings have been added, Save the metadata record.

Add Entity Permissions to the Default Web Role

In Dynamics CRM, Navigate to Portals > Community Portal or Training Portal > Web Roles. There should be a default web role, which recall is the web role for which the Boolean field “Authenticated User Role” is set to true. This Role should be named Authenticated Users.

Open up the role and add a contact-scoped permission

1. From the Web Role form, navigate to Entity Permissions either through the Sub Grid or from the top right-hand navigation

2. Click to Add an Entity Permission to the Web Role

15

Page 16: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

3. Click the magnifying glass to view existing records, then click New

4. Set the Entity Name to account5. Set the scope to Contact6. Set the Contact Relationship to “Contacts (contact_customer_accounts)”7. Grant all Privileges: Read, Write, Create, Delete, Append, Append To8. Save

We now need to also need to add an account-scoped permission

1. Back on the Authenticated Users Web Role form, again navigate to Entity Permissions either through the Sub Grid or from the top right-hand navigation

2. Click to Add an Entity Permission to the Web Role3. Click the magnifying glass to view existing records, then click New4. Set the Entity Name to contact5. Set the scope to Account6. Set the Account Relationship to “Company Name (contact_customer_accounts)”7. Grant all Privileges: Read, Write, Create, Delete, Append, Append To8. Save

Add a new Web Page through front side editing

Now we’ll add a new web page through front-side editing. We can add it as a child of the Workspace page, if it exists, or we can add it as a child of the Content page if it does not. Note that before you can tie the Entity Form you created to the Web page, you’ll likely need to clear the cache of your website, unless you have been using your demo builder or SAAS-hosted portal.

1. Navigate to either the Community Portal application, or your Training Portal Application2. Sign in as administrator3. Navigate to the Content Page, or the Workspace.

16

Page 17: Home · Adxstudio Community - Lesson: Entity Forms · Web viewIn CRM, first we will create the CRM form itself. The reason we are creating a new form instead of using an existing

4. Click New > Child Page on the upper right-hand toolbar

5. Give the page a name. You can name it whatever you want, but from here on we will assume you named it Account Details.

6. The Page Template used by this page can be any ASP.NET web forms page template. You won’t be able to use a Liquid Template. The suggestion is for you to stick with the basic Page Page Template (the default)

7. Finally, you’ll need to actually select the Entity Form that you created earlier: Account Details8. Click Save. The rest of the values can be left at their defaults.

Test out your form

With all of the above in place, you should have no problems viewing your parent account, provided you are logged in as a user that has a parent account. All of the portal users can come with Adxstudio out-of-the-box including System Administrator (username: administrator), Portal Customer (username: customer), and Partner Contact (username: partner), all have parent accounts. Check out the form which will allow you to edit these parent accounts, while also being able to work with the contacts underneath these accounts

Try to add a contact using the sub-grid. Try Editing, and deleting.

Experiment

1. Try adding additional configuration to the sub-grid metadata record2. Try adding a workflow to the contact entity and adding a workflow trigger action to the sub-grid

17