web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

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?

(0) ShareShare
ReportReport
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!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    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?

  • Dmytro Rutkovskyi Profile Picture
    1,835 on at

    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
    55,410 Moderator on at

    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".

  • RaviKashyap Profile Picture
    55,410 Moderator on at

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

  • Dmytro Rutkovskyi Profile Picture
    1,835 on at

    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
    55,410 Moderator on at

    Thanks Dmytro. Will try the suggestions.

  • tgoetzilhfs Profile Picture
    40 on at

    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!

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans