Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

Posted on by 40

Here's the scenario: I have a D365 Portal Entity Form with a subgrid.  I've defined an Entity Form Metadata record on this subgrid so that I can create a related record. On the Metadata record, when the target of the Create is an Entity Form, the new child record is created and the lookup back to the parent is populated, no problem. However, when I switch the target of the Create to a Web Page with a Web Form (instead of an Entity Form) the record that's created is not tied to the parent and the lookup field pointing back to the parent is not populated. How can I pass the ID of the parent via Query String (or other mechanism) to the Web Page Web Form so that the record created in step 1 of the Web Form is related to the Record from the original Entity Form?

Any help or guidance is much appreciated!

Categories:
  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Hi,

    Can you share some more details how you have achieved it without js. The first step on the web form would be for the create of child entity so how did you set up refid from the query string? Did you use Source Type field?

    If you could share the screenshot please that would help.

  • tgoetzilhfs Profile Picture
    tgoetzilhfs 40 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Thanks, Ravi. I was able to get this working without the need for Custom JavaScript. I configured Step 1 of the Web Form for Insert mode and to take in refid from the Query String. Then Step 2 was configured for Edit mode and the lookup field to the parent was automatically populated. Works like a champ. Thanks!

  • RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Thanks Dmytro. Will try the suggestions.

  • Dmytro Rutkovskyi Profile Picture
    Dmytro Rutkovskyi 1,835 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Hi Ravi,

    with multiple web forms session scenarios - I don't know the answer right now. I will look later, but not promise it would be fast. Anyway web-form sessions - just another entities so surely they could be identified easily and in some way with querystring or similar. If multiple session not enabled - then it should be done nearly automatically.

    As for  links/ article which I can refer for "several entity-forms even on the same page with the conditional loading of them (liquid again) based on the current step"

    Initially, I've  imagined code like:

    {% extends "Layout 1 Column" %}
    
    {% block main %}
     {% assign objectid = params["id"] | default :"" %}
     {% assign step1 = params["step"] | default :"" %}
     {% assign object = entities.object[objectid] %}
     {% assign step2 = object.currentstep %}
    {%comment%} 
        * Reading Step. 
        * step1- either from querystring
        * step2- either from entity itself (need to set for example for the hidden field with javascript)
    {%endcomment%}
    
    {%if objectid %}
      {%if step1 == '1' %}
       {% entityform key: 'Object Edit Form (Step1)' %}
      {%else%}
       {% entityform key: 'Object Edit Form (Step2)' %}
      {%endif%}
    {%endif%}
    
    {% endblock%}
    

    But it will require additional entity form configuration to add additional query param for submitting and redirect to self. (again, in that case, it will be complicated to implement prev-next steps functionality).

    Also, we can implement one-page + iframe to load entity form. In that case, we have better possibilities, but it requires more work.

    Also if we ultimately work with an entity by only one user at a time (or one-time, like the wizard of application) - we can add this field to the form (step) and set it dynamically with javascript (before submit depending on a button clicked).

    And as last option - we, of course, can implement own session functionality, but it requires custom server-side code implementation 
    (like in https://community.dynamics.com/365/b/udsconsultingblog/archive/2017/04/18/https-uds-systems-blog)

    I haven't got any article or complete solution but can investigate more some particular approach 

  • RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    I would appreciate if you can suggest on this thread: community.dynamics.com/.../298164

  • RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Thanks Dmytro. This will work. Do you have any suggestion on if the web form is opened from another web form i.e. how to redirect to the same web form session (instead of entity form)?

    Do you have any links/ article which I can refer for "several entity-forms even on the same page with the conditional loading of them (liquid again) based on the current step".

  • Dmytro Rutkovskyi Profile Picture
    Dmytro Rutkovskyi 1,835 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Hi Ravi,

    Most logical seems to add the new step of type Redirect and use custom query string builder from lookup value you catch the value.

    ravi_5F00_Capture.PNG

    There are other options, like checking "Hide form on Success" and put a message on success like "Redirecting" and with Javascript redirect to the initial page when success message is on the page/ web form step. (probably you need the liquid template to read current entity field which grabs you initial entity)

    Also - in most scenarios  - you can use several entity-forms even on the same page with the conditional loading of them (liquid again) based on the current step.  In that case, you have more power. 

  • RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    I am also creating the similar functionality and wanted that once the web form finishes i.e. after last step, it come back/redirect to the entity form record from which it started. Have you accomplished this? If yes, could you please share how?

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,406 on at
    RE: On a Dynamics 365 Portal Entity Form, how can I create a related record from a subgrid when the target is a Web Page with a Web Form?

    Hi,

    By default, when you redirect to a web page with web form, the related entity details passes from via query string i.e. refentity, refid & refrel which carries the name of the entity, guid of the entity and the relationship schema name respectively. You could add JavaScript on your first step to get the details from QS and then populate the lookup field.

    Hope this helps.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans