Skip to main content

Notifications

Microsoft Dynamics CRM forum
Suggested answer

Trying to embed a HTML Web Resource on a form but struggling to pass the record ID

editSubscribe (0) ShareShare
ReportReport
Posted on by 75
Hi everyone, we use Retool to supplement Dynamics 365 and access Dynamics data using the Dataverse API which works fine.  If my Retool application URL is at https://domain.com/apps/Quoter?id= I can put the id of the Dynamics record ID at the end and view the id in Retool as a URL Parameter.  This works fine I want to add a button to the ribbon for example where pressing it opens the URL in a new tab and passes the id parameter.
 
However, I want to instead embed the application into a form in Dynamics, but I'm strugging on how to properly pass the record ID when doing it this way as nothing I do seems to work!  
 
The embed code Retool provides is:
 
<iframe src=https://domain.com/apps/Quoter/ width=/100%/ height=/800px/>
 
I've tried ChatGPT and Gemini and nothing seems to work.  I can display the application in my web resource no problem, but I can't seem to figure out how to pass the current record's id with the URL.
 
Thank you!
  • Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Trying to embed a HTML Web Resource on a form but struggling to pass the record ID
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     
  • Suggested answer
    Dengliang Li Profile Picture
    Dengliang Li Microsoft Employee on at
    Trying to embed a HTML Web Resource on a form but struggling to pass the record ID
    Hi,
     
    In my testing, I created a web resource as follows.
    When I click the button, it passes the current record ID into the text area.
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        <div><textarea id="textarea" placeholder="Shows the current record ID."></textarea></div>
        <button>click</button>
       
    </body>
    <script>
        const button = document.querySelector("button");
        const txtArea= document.getElementById("textarea");
     
        button.addEventListener("click",()=>{
            //Get Current Record GUID
            let ID = window.top.Xrm.Page.data.entity.getId();
            //Pass the ID into the text area.
            txtArea.innerText = ID;
        })
     
    </script>
    </html>
     
    Embed this web resource in the contact form.
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,375 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,308 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans