SBX - Search With Button

SBX - Forum Post Title

How to dynamically launch a entity form in CRM Portal

Microsoft Dynamics CRM Forum

R89 asked a question on 10 Dec 2018 12:14 PM
My Badges

Question Status

Verified

Hi

I have a view details web page in CRM portals. This page has a field named pnumber.  pnumber is an option set with four values. When the pnumber has a specific value I want to change the mode of the webpage (entity form) into Edid mode so that users can input change data. Everything is custom. I am open to using liquid or js. Any suggestions are much appreciated. I am able to get the value of pnumber in the liquid template of View Details page. If pnumber == '15670000' i want to put the page in Edit mode. 

Reply
Nicholas Hayduk responded on 10 Dec 2018 7:59 PM
My Badges
Verified Answer

Hello,

You can use Liquid to check the value of a field, then display the appropriate Entity Form.  I put together a quick blog post on the subject:

www.engineeredcode.com/.../dynamics-365-portal-using-liquid-to-create-conditional-entity-forms

Hope that helps.

Nick

Reply
R89 responded on 11 Dec 2018 10:05 AM
My Badges

This is what I have in my custom template: It gives me an error on the portal form: " An entry with the same key already exists."

I am coming to this screen from an entity list. Entity list has View Details web page. I see the display 17560000 on screen and the above error is displayed. The URL when the error is displayed contains view-details. I was expecting it to contain edit-details. Am I missing something?

This is what I have in my custom web template. Please note that this custom template is used on several other places.

{% if page.adx_entityform %}

  {% if pnumber == '175650000' %}

  {{ pnumber }}

     {% entityform name: "Edit Details" %}

   {% else %}  

     {% entityform id: page.adx_entityform.id %}

  {% endif %}

{% endif %}

Reply
Shaminderpal Singh responded on 11 Dec 2018 11:25 AM
My Badges
Verified Answer

Hi,

You should remove the entity list reference from your web page and set it explicitly in web template only. The error which says "An entry with same name already exists" is coming because of entity list tagged to web page. Remove it from Parent and localized web pages and try.

-Shaminder

Reply
Nicholas Hayduk responded on 11 Dec 2018 11:27 AM
My Badges
Verified Answer

You should be going to the same page/URL regardless of edit or view.  Whatever page you get to after clicking from the Entity List should be configured with a Page Template that uses the custom web template you created.  If use an out-of-the-box Page Template you might be facing the situation where the Entity Form is being included twice, since you're still using the adx_entityform property of the web page.

Reply
R89 responded on 11 Dec 2018 2:35 PM
My Badges
Suggested Answer

Nicholas

It works now. I created a separate page template for this web page. It works like a charm.

Thks

Reply
Nicholas Hayduk responded on 10 Dec 2018 7:59 PM
My Badges
Verified Answer

Hello,

You can use Liquid to check the value of a field, then display the appropriate Entity Form.  I put together a quick blog post on the subject:

www.engineeredcode.com/.../dynamics-365-portal-using-liquid-to-create-conditional-entity-forms

Hope that helps.

Nick

Reply
Shaminderpal Singh responded on 11 Dec 2018 11:25 AM
My Badges
Verified Answer

Hi,

You should remove the entity list reference from your web page and set it explicitly in web template only. The error which says "An entry with same name already exists" is coming because of entity list tagged to web page. Remove it from Parent and localized web pages and try.

-Shaminder

Reply
Nicholas Hayduk responded on 11 Dec 2018 11:27 AM
My Badges
Verified Answer

You should be going to the same page/URL regardless of edit or view.  Whatever page you get to after clicking from the Entity List should be configured with a Page Template that uses the custom web template you created.  If use an out-of-the-box Page Template you might be facing the situation where the Entity Form is being included twice, since you're still using the adx_entityform property of the web page.

Reply
R89 responded on 11 Dec 2018 2:35 PM
My Badges
Suggested Answer

Nicholas

It works now. I created a separate page template for this web page. It works like a charm.

Thks

Reply

SBX - Two Col Forum

SBX - Migrated JS