locked
Display data in web-resource on Dashboard - how can I do this? RRS feed

  • Question

  • I have a HTML web resource that I want to display the name of an account. I can do this within the form via: 

    var accountName = window.parent.Xrm.Page.getAttribute('accountname').getValue();

    However, this doesn't work in the Dashboard view. Anyone have any ideas on what method I should be using?HTML

    Friday, November 15, 2013 8:39 AM

All replies

  • Hello,

    Could you share some more details what you are doing in html dashboard, you can't access fields directly as you are not in entity form, so you need to query account entity using service call and then you can get this attribute value to display it.

    Check SDK for REST samples.

    HTH


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Friday, November 15, 2013 8:54 AM
    Moderator
  • You need to write retrieve call to get account information using SOAP or REST.

    Following code works only when your HTML web resource is placed on Form :

    var accountName = window.parent.Xrm.Page.getAttribute('accountname').getValue();


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Friday, November 15, 2013 8:57 AM
  • I'm familiar with REST and SOAP and can retrieve records; I've also sped up work by using the XRMSVCTOOLKIT, so my REST call is similar to this:

     
    function getAccountName()
    {
    var data; 
    XrmSvcToolkit.retrieve({ 
        entityName: "Account", 
        id: GUID, 
        async: false, 
        successCallback: function (result) { 
            data = result;
            var accn = data.FullName;
        }, 
        errorCallback: function (error) { 
           alert("Error");
    
        } 
    });
    }
    
    


    But once I have the result, how do I use variable accn?

    Friday, November 15, 2013 9:03 AM
  • You could return accn variable or entire data object.

    Or instead of using async. call use sync. call to get account information.


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !




    • Edited by _Vikram Friday, November 15, 2013 9:15 AM
    Friday, November 15, 2013 9:11 AM