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)

url for Iframe on dashboard

(0) ShareShare
ReportReport
Posted on by 2,665

Hi,

How to address the “OnLoad” if there is no Event access for System Dashboards. I want to set the iframe url with the userid and pass it as parameter to the aspx page. But yet there is no clear/easy way to create JavaScript for them (outside of using Web Resources). Can someone please explain how is this being accomplished in such scenarios? (Again, this iframe is in a dashboard view).

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Wayne Walton Profile Picture
    13,730 on at

    You're going to need to use a web resource if it's on the Dashboard.

  • MilindP Profile Picture
    1,019 on at

    Create a HTML webresource and get the userID using global context on load of web resource and prepare the URL for ASP page with query string and open it using window.open

    Or pass it using POST method .. see this stackoverflow.com/.../javascript-post-request-like-a-form-submit

  • crmprogrammer2013 Profile Picture
    2,665 on at
    <html>
    
    <head>
    
    <script type="text/javascript">
    
        function SetLeftNavigation() {
    
            var WebPageURL = "http://xxxxx/Call.aspx"; //change custom page url
    
            var userId =Xrm.Page.context.getUserId(); //to access userid from entity form
    
            userId =userId.replace('{', '').replace('}', '');
    
            var iFramUrl = WebPageURL + "?id=" + userId;
    
            location.href = iFramUrl;
    
    Xrm.Page.getControl(IFRAME_Call).setSrc(iFramUrl);
    
        } 
    
    window.onload=SetLeftNavigation;
    
    </script>


    So created a html web resource in another dashboard and emebedded the userid at the end of url through javascript function and set it to iframe src. Is this the correct way?

    Thank you.

  • MilindP Profile Picture
    1,019 on at

    You need add a reference of Global Context to user Xrm.Page.context

    <html>
     
    <head>
        <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
     
    <script type="text/javascript">


  • crmprogrammer2013 Profile Picture
    2,665 on at

    Thanks Milind,

    I've appended it. So now the url will be http://xxxxx/calendar.aspx/id='xxxxxxxxxxxxxxx'


    a
    nd it will be set to the iframe right? Do I have to change or add in the aspx page other than request querystring to access the userid parameter?

    Thanks much.

  • Verified answer
    MilindP Profile Picture
    1,019 on at

    Your code should looks like below.... i am assuming http://xxxxx/Call.aspx  where xxxx is not CRM site.... if so it will not work... for aspx page you need to host separate site than CRM

    <html>

    <head>
        <title></title>
        <script type="text/javascript">
            document.onreadystatechange = function () {
                if (document.readyState == "complete") {
                    SetLeftNavigation();
                }
            }
        function SetLeftNavigation() {
    
            var WebPageURL = "http://xxxxx/Call.aspx"; //change custom page url
    
            var userId =Xrm.Page.context.getUserId(); //to access userid from entity form
    
            userId =userId.replace('{', '').replace('}', '');
    
            var iFramUrl = WebPageURL + "?id=" + userId;
    
            location.href = iFramUrl;
    
            Xrm.Page.getControl(IFRAME_Call).setSrc(iFramUrl);
    
        }
    
        </script>
    </head>
    <body ></body>
    </html>


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