Archive

Posts Tagged ‘Entity List’

Dynamics Portals – Customize OOB ‘Entity List’ grid

I was working on a Portal requirement where I had to customize the ‘Entity List’ grid by adding ‘Check Box’ control in the first column and a ‘Submit’ button, which has the custom logic.

Below is how the OOB ‘Entity List’ grid looks like

ADX-G_7

OOB ‘Entity List’ grid

Now, lets see how to customize the OOB ‘Entity List’ grid by adding additional controls (i.e., Check box and Button).

Below are the list of portal components in the order, to achieve this requirement.

  • Create a new ‘Entity List’

ADX-G_2

  • Create a new ‘Web Template’
    • In the ‘Source’, we will have logic to loop through the ‘Entity List’ records (i.e.,Rows) and add ‘Check Box’ control in the 1st column.
    • In the below image, {% entitylist id:page.adx_entitylist.id %} refers the ‘Entity List’ loaded on the current page.

ADX-G_4

  • Create a new ‘Page Template’ and map the newly created ‘Web Template’

ADX-G_6

  • Create a “Web Page’ and map the ‘Entity List’ and ‘Page Template’

ADX-G_5

  • That’s it. Go to Portal, clear cache and hit the ‘Web Page’ URL. You should see grid with ‘Check Box’ as first column.
ADX-G_1

Customized Grid

Web Template’s ‘Source’ :

<body>

 

{% entitylist id:page.adx_entitylist.id %}
{% entityview id:params.view, search:params.search, order:params.order, page:params.page, pagesize:params.pagesize, metafilter:params.mf %}
<table id=”tblContacts” class=”table table-striped”>
<thead>
<tr class=”row”>
<th class=”col-sm-1″>
&nbsp;
</th>
{% for c in entityview.columns -%}
<th width=”{{ c.width }}” data-logicalname=”{{ c.logical_name }}”>
{{ c.name }}
</th>
{% endfor -%}
<th width=”1″></th>
</tr>
</thead>
<tbody>
{% assign i = 0 %}
{% for e in entityview.records %}
<tr class=”row”>
<td class=”col-sm-1″>
<input type=”checkbox” id=”chk{{i}}” onclick=”” />
</td>
{% for c in entityview.columns %}
{% assign attr = e[c.logical_name] %}
{% assign attr_type = c.attribute_type | downcase %}
<td data-logicalname=”{{ c.logical_name }}”>
{% if attr.is_entity_reference %}
{{ attr.name }}
{% elsif attr_type == ‘datetime’ %}
{% if attr %}
<time datetime=”{{ attr | date_to_iso8601 }}”>
{{ attr }}
</time>
{% endif %}
{% elsif attr_type == ‘picklist’ %}
{{ attr.label }}
{% else %}
{{ attr }}
{% endif %}
</td>
{% endfor %}
<tr>
{% assign i = i | plus:1 %}
{% endfor %}
</tbody>
</table>
{% endentityview %}
{% endentitylist %}
</div>
</div>

</div>
</body>

🙂

Advertisement

Dynamics Portals – Entity List – Integration using OData feed

February 17, 2019 1 comment

With Dynamics Portal’s Entity list ‘OData Feed’ option, we can expose the data in the form OData API, which can be further consumed by external applications.

Lets take a scenario,

  • You have a public facing Dynamics Portal where people gets registered, which get stored as ‘Contacts’ in Dynamics CE instance.
  • You need to share all the ‘Active Contacts’ to your back end team which uses an Excel sheet to manage data.

It can be achieved by enabling OData feed on Entity List by following below steps:

  • Open your Entity List and go tot ‘OData Feed’ section. (Refer my previous articles on how to create an Entity List)
  • Enable the ‘OData Feed’ option along with below details
    • Entity Type Name : Your Dynamics entity schema name
    • Entity Set Name : Can be anything but as a best practice provide plural name of your Dynamics entity.
    • View : Select the view.  The structure of your OData feed would be determined based on the view you pick.

Portal_OData_7

  • Once the ‘OData Feed’ enabled, you can get all the oData feeds enabled on Portals by forming URL -> {Your Portal URL}+”/_odata

Portal_OData_8

  • Now access the ‘Contacts’ oData feed by forming URL -> {Your Portal URL}+”/_odata“+Entity Set Name (i.e., contacts)

Portal_OData_9.PNG

How to consume the oData API in Excel:

  • Copy the OData set URL
  • In the new Excel sheet, go to Data -> Get Data -> From Other Sources -> From OData Feed

Portal_OData_1

  • Paste the OData URL and click ‘OK’

Portal_OData_2

  • Click ‘Load’ to load the data to excel sheet.

Portal_OData_5

  • If you want to Transform data like replace ‘Null’, click on ‘Transform Data’

Portal_OData_4

  • Your excel sheet shall looks as below once the data loads.

Portal_OData_6

Note:

  • The OData API URL is accessible anonymously with no authentication prompted.

🙂

 

 

Dynamics Portals – Entity List ‘Map View’

February 16, 2019 5 comments

Dynamics Portal’s Entity List has an option to pin the records on a Map based on the Address of those records.

How does ‘Map View’ looks on Portal:

  •  With ‘Map View’ enabled, you will get a Map (bing/google) and matching records will be pinned on the map (i.e., Refer 1 pinned on the Map below).

Portal_Map_1

How to set up ‘Map View’:

  • On the ‘Entity List’ form, check the ‘Map Enabled’ checkbox.
  • In ‘Entity Field Mappings’, map the address fields from ‘Contact’ entity (As my entity list mapped to Contact).

Portal_Map_3

  • Under ‘Settings’ section, provide below details
    • Map Type : Bing/Google (I chose ‘Bing’ for this article)
    • Credentials : Bing API credentials (You need to login here with your Live/Outlook account and generate the Key)
    • Portal_Map_5
    • Default Center Latitude : This is important. Geo coordinates where you want your map start from (I took ‘New Jersey’ coordinates as Default)
    • Default Center Longitude : This is important. Geo coordinates where you want your map start from (I took ‘New Jersey’ coordinates as Default)
    • Save
  • On Portal, you will notice a Map loaded with ‘Default Center Latitude’ and ‘Default Center Longitude’ (i.e., ‘New Jersey’ in this example).

Portal_Map_6

  • In the ‘Address’ search box, provide ‘New York’ and click ‘Search’.

Portal_Map_1

  • As I configured Contact ‘Rajeev Pentyala’ with ‘New York’ coordinates (Refer screen below), Contact showed up in above screen.

Portal_Map_4

  • You can click on ‘Get Directions’ to get directions between Searched city (i.e., ‘New York’) and Default coordinates (i.e., New Jersey).

Portal_Map_2

🙂

Dynamics Portals – Entity List not rendering on Web Page

February 16, 2019 Leave a comment

Other day I faced a strange issue in my Portals, where my Entity list NOT rendering on the Web Page. The story goes as below.

  • I have an Entity List ‘Contact’ with 2 views configured.

Portal_WP_2

  • Created a ‘Web Page’ and set the ‘Entity List’ to ‘Contacts’ and ‘Published State’ set to ‘Published’

Portal_WP_1

  • Go to Portal and refresh the Web Page but there is no trace of ‘Entity List’

Portal_WP_3

  • Initially I suspected Cache Issue, hence I reopened and cleared the Cache but still no luck.

Portal_WP_4

Fix:

  • Portal’s ‘Content Editor’ came to my rescue.
  • On the Portal, navigate to the ‘Web Form’ and click on ‘Edit’ from ‘Content Editor’ menu.

Portal_WP_5

  • In the ‘Edit Contact List’ screen, set the ‘Entity List’ to the ‘Contacts’ entity list and Save.

Portal_WP_6

  • That’s solved the issue and I could see the ‘Contacts’ entity list rendered on the ‘Web Page’

Portal_WP_7

Note:

  • I don’t have reason or explanation what caused this behavior. Alternately you can try Restart the portal if you have O365 ‘Admin Center’ access.

🙂

Dynamics Portals – Entity List – Configure custom view names

February 16, 2019 Leave a comment

With the Dynamics Portals ‘Entity List’, its easy and seamless to port the Dynamics entity views to Portal.

In below screen, I configured ‘Active Contacts’ and ‘Inactive Contacts’ views in my Entity List and if you notice, the view names are defaulted to Dynamics view names (i.e.,Active Contacts, Inactive Contacts)

Portal_EL_1

What if we have to show custom labels for views in portal? its simple

  • Open ‘Entity List’ form from your Dynamics application
  • Views -> Advance settings
  • Set your desired text in ‘Display Name’ field

Portal_EL_2

  • Save
  • Go to Portal and refresh the Entity list web page

Portal_EL_3

🙂