Show all cases for the Account to the associated contact on ADX Portal.

This blog is intended to show all cases for the Company (Account) of logged-in user (contact) on ADX portal.

Many times we come across scenarios, such that the logged-in Portal user (CRM Contact) should be able to see all the cases of the Company, logged-in user belongs.

There are 2 aspects for implementing this approach:

  1. Viewing all cases for the company.
  2. Creating case for the company instead of contact.

Viewing all cases for the company

We can view all cases for the company by following below steps:

  • Navigate to Settings -> Case Access Permissions in CRM as below:
    ADX - Case access permission
  • Click on “New” button to create new Case Access permission for the portal user.
  • Provide details for the Case access permission record:
    ADX - New Case access permission

Name: Name for the Case access permission.

Account: Company of portal user.

Contact: Portal user for whom we are creating Case access permission.

Scope: Select scope for the case access permission as ‘Account’

Permission: Select necessary permissions to be given for portal user.

  • Click on Save.

Creating case for the company instead of contact.

By default when a case is created from portal, Customer field on case record is set to logged-in user (contact). However we want to set the Company for the logged-in user as ‘Customer’ and logged-in user as the ‘Contact’ field on Case.

We can achieve this by making change in solution code as below:

Changes in OnItemInserting function as below:

protected void OnItemInserting(object sender, CrmEntityFormViewInsertingEventArgs e)


var customerDropdown = (DropDownList)CreateCaseForm.FindControl(“FormView”).FindControl(“CustomerDropdown”);

if (customerDropdown == null)


e.Values[“customerid”] = Contact.ToEntityReference();

e.Values[“primarycontactid”] = Contact.ToEntityReference();




Guid customerId;

if (Guid.TryParse(customerDropdown.SelectedValue, out customerId))


var customerLogicalName = customerId == Contact.Id ? “contact” : “account”;

var customer = new EntityReference(customerLogicalName, customerId);


if (Contact.Attributes.Contains(“parentcustomerid”))


var parentcustomerid = Contact.Attributes[“parentcustomerid”];

e.Values[“customerid”] = parentcustomerid;


var contactRef = new EntityReference(“contact”, Contact.Id);

e.Values[“primarycontactid”] = contactRef;// customer;




e.Values[“customerid”] = customer;




if (!e.Values.ContainsKey(“customerid”))


e.Values[“customerid”] = Contact.ToEntityReference();


if (!e.Values.ContainsKey(“responsiblecontactid”))


e.Values[“responsiblecontactid”] = Contact.ToEntityReference();


e.Values[“adx_createdbyusername”] = Contact.GetAttributeValue<string>(“fullname”);

e.Values[“adx_createdbyipaddress”] = Request.UserHostAddress;



Adding CRM forms on ADX Portals:

This blog is intended to make understand how we can use a CRM form on ADX portal using Entity form.


  • CRM environment.
  • Licensed ADX portal.


Steps for Adding CRM forms on ADX Portals:

Create new CRM form in CRM:

  • Login to your CRM organization.
  • Go to Setting -> Customization -> Customizations -> Customize the System.Customizations
  • Go to entity for which form wants to be created.
  • Click on New -> Main form.

Main From

  • Add fields on the form and save.
  • Publish the solution.


Create Entity forms:

  • Click on elipses in CRM and go to Portals -> Content -> Entity Forms.
  • Click on New.
  • Provide name for the entity form.
  • For Entity Name, Select the entity for which we want to add form on Portal.
  • For Form Name, select newly created form for the entity.

New Entity Form

  • Click ‘SAVE & CLOSE’.

Add Entity Form on Portal:

  • Go to portal URL.
  • Sign-in to the portal using Administrator credentials.

           Default administrator credentials:

          Username: administrator

          Password: pass@word1

  • After Signing-In, User gets panel to make CMS changes as below.

Administrator panel

  • Navigate to Page for which we want to add newly created Entity form (CRM form) as child page.
  • On the Panel click on “New -> Child Page”

Administrator panel 2

  • A new window will pop-up, where we need to provide Child page details as below:

Name (required): Name for the web page.

Title: Title for the web page.

Parent Page (required): By default it will be page for which we are creating child page. However we can change it.

Partial URL (required): Partial URL for the page. By default it will be name of the page in lowercase and without spaces (Spaces will be replaced by ‘-‘).

Page Template (required): Page template for the web page.

Publishing State (required): Publishing state of the page (Draft or Published). Draft web pages will not be displayed on the portal.

Web form: Web form for the web page.

Entity form: Select entity form we created.

Entity List: Entity List for the web page.


Since we are creating Entity form, we can leave Web form and Entity List fields blank.

Entity Form config

  • Click on Save.