locked
How to access CRM entity Attributes in HTML Web resource in CRM 2013 RRS feed

  • Question

  • Hi Team,

    I added the html web resource to the form. I need to access entity attributes in the html web resource.

    I tried

    var title = window.parent.Xrm.Page.getAttribute("title").getValue();
    alert(title);

    For everything it is returning [object object].

    Could anybody suggest How to do access entity attributes in html web resource.

    Thanks,

    Sreenath

    Friday, July 25, 2014 5:16 AM

Answers

All replies

  • Try,

    window.parent.Xrm.Page.data.entity.attributes.get("title").getValue() // assuming title is a text field


    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, July 25, 2014 5:39 AM
    Moderator
  • Hi,

    It appears from your error that "title" is a lookup field. Use the following script to get the textual value in the lookup.

    var title = window.parent.Xrm.Page.getAttribute("title").getValue();
    
    if(title!=null)
    {
       title = title[0].name;
    }
    
    alert(title);


    Admin QuikView Solution for CRM 2013

    Friday, July 25, 2014 6:29 AM
  • Hi Sreenath:

    There is a bug that is fixed in SP1 UR1 that when you click on a HTML web resource after updating a field there was no lost/got focus events fired so the data in the field on the form was not forced into the entity so when accessed through XRM page the value would either be null or the previous value if it was an update.   Connect has a copy of UR1 for CRM 2013 SP1 in preview that this is fixed in - I would try that in your dev environment and see if this makes a difference.

    drewt

    Friday, July 25, 2014 5:07 PM