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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to edit related entity in web form step

(0) ShareShare
ReportReport
Posted on by

I have a web form that has two steps. Step 1's mode is Edit and targets entity A. Step 2's mode is also Edit and targets entity B. Entity B has a lookup to entity A.

How do I specify the record source to edit for step 2? The possible values I can see for Source Type are Result From Previous Step and Query String. It doesn't work when I use Result From Previous Step (I'm guessing because I don't have a previous step that reference Entity B). Do I have to use the Query String option and pass the ID of entity B record somehow? If this is the case, any suggestion for doing this?

Thanks,
Bernado

*This post is locked for comments

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

    Hi,

    How/when is the record getting created for Entity B? And what mode of source type you are using in step 1 i.e. for entity A

  • Community Member Profile Picture
    on at

    Hey Ravi thanks for the reply.

    So we actually have two web forms, one to do the create and another to do the edit. The two web forms are essentially the same with just the mode (insert/edit) being different.

    Each web form has two steps like I mentioned originally. The configuration looks like this:

    Web form 1 (Insert)

        Step 1 - Entity A - Insert

        Step 2 - Entity B - Insert

    Web form 2 (Edit)

        Step 1 - Entity A - Edit

        Step 2 - Entity B - Edit

    Step 1 and 2 are the same across the two web forms with just the mode being different.

    Users use Web form 1 (Insert) to create Entity A and Entity B records. If they want to go back and view/edit, they use Web form 2 (Edit).

    (By the way, if there is a better way of doing insert and edit without requiring 2 web forms then please let me know!)

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    As you just have 1 step for create and 1 for update. I would personally not use the web form at all instead I would use the entity form/ web page for create and edit. i would also have a subgrid for entity B with a create option so that I can create entity b records from entity A. Just like the OOB cases entity.

    Coming back to your web form, I am assuming you are passing the id in query string for web form 2 step 1? Is it not possible to pass the id with the query string?

  • Community Member Profile Picture
    on at

    Yeah we can retrieve the ID of Entity B and pass in to the edit page together with ID of Entity A. This would require some coding in JS/Liquid, and I was hoping there is a config option to do this that I have overlooked.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    If you can pass the id in querystring then you can use the source step as Query string.

    What are your thoughts on changing it from web form to Entity form?

  • Community Member Profile Picture
    on at

    Hey Ravi - we actually have 5 steps in each of our web forms. I mentioned 2 steps in my originally post to help simplify the question.

    I now find that I have a slightly different issue with passing in the ID of Entity B in the edit step. This step is failing if the Entity B record has not been created in the create form.

    So imagine this flow:

    1. User create form using Create Web Form

    2. User completes step 1 (Entity A is created) and save draft form and exit

    3. User resumes form - Edit Web Form is now used

    4. I can't pass in an ID of Entity B record for step 2 to edit as that record has not been created previously

    5. Step 2 on Edit Web Form now fails when user reaches that step and tries to progress further

    I can workaround this by always creating a stub for Entity B record when Entity A record is saved. Wondering if there's a config I'm missing or a better workaround?

  • Gopinath Gurusamy Profile Picture
    125 on at

    Hi Bernado,

    I have similar kind of issue. How did you pass the id of entity B to edit form step ?

  • Community Member Profile Picture
    on at

    Hey Gopinath,

    I workarounded this issue with some JavaScript.

    I configured entity B step (step 2) as edit, and uses query string parameter as the source record ID. Here I specified 'bId' as the query string parameter name.

    In step 1 (entity A step), I added some JavaScript to the step. This script on load would get the ID of the related entity B record, and then modify the action attribute of the HTML <form> element to add 'bId=[entityBRecordId]' to the post URL. When the Next button is clicked, the updated URL is used to navigate to the next step and therefore passes entity B ID to step 2.

    Hope that helps :)

  • Gopinath Gurusamy Profile Picture
    125 on at

    Hi Bernado,

    Thanks for your quick response.

    I tried the same approach. It is working.

    But when  Start New session on Load is enabled for the web page, it displays an error(The record couldn't be found). If I didn't enable this option, cache issue happens (whenever I open a record it goes to the last opened web form step instead of going to step 1)

    Did you observe the same behavior ? I need this option to be enabled should I pass the session id also to the url ?

    80823.Capture.PNG

  • Community Member Profile Picture
    on at

    Hey Gopinath,

    I also have the Start New Session on Load set to Yes, but I do not get the error you mentioned. I only appended the 'bId=[guid]' to the URL of the HTML <form> element. I did not update any of the existing query string params in the default URL. Is that what you did also?

    Is that error only occurring when you arrived on the entity B step? Or as soon as you enter the form?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans