locked
i can not get Xrm.Page.data.entity object in my js function. RRS feed

  • Question

  • Hello everyone,i am jack from China.

    i have a question when i use dynamic crm 2013 online.

    As the sdk help file said:

    Xrm.Page.data.entity provides methods to retrieve information specific to the record displayed on the page, the save method, and a collection of all the attributes included in the form. Attribute data is limited to attributes represented by fields on the form. 

    i want get the Xrm.Page.data.entity to get information displayed on the page,but i can not.

    i can get the Xrm object  and the Xrm.Page object ,but i can not get the Xrm.Page.data object  ,it null.

    please look the screenshot:

    so ,what 's wrong.?

    Friday, March 28, 2014 2:57 AM

Answers

All replies

  • so ,what's wrong.
    Friday, March 28, 2014 3:54 AM
  • Could you provide some information what you trying to implement ??

    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, March 28, 2014 8:06 AM
    Moderator
  • HI,thanks for your help. 

    i am in "lead detail form" page . i added a button in the head.named "export to hds"

     i want get the lead's guid  when i click the button.  i heard the lead info store in Xrm.Page.data.entity. so i want to get the object.  or do you have any other mind to get the lead's guid?

    thanks.

    Friday, March 28, 2014 8:20 AM
  • Hi,

    It seems you are in create mode only and entity records is not created yet, that's why you are not getting anything, so you need to make sure your button should be only able to work when entity record is created (you can apply form state rule to your button to just show it only when form is opened in update mode, check this) once your entity is create and your button is enabled you should be able to get your entity id just simply like below (I will suggest you to use some ribbon editor maybe ribbon workbench to do this easily)

    Xrm.Page.data.entity.getId() //you need to create on js function need to call it in your ribbon button.


    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.

    Monday, March 31, 2014 1:22 AM
    Moderator
  • Hello,

    I don't see the code that I suggested you. Check it now you should be able to see your lead entity id in alert.

    Also make sure not to share your credentials here.


    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.

    Tuesday, April 1, 2014 2:57 AM
    Moderator
  • Thanks a lot. this problem has been resolved .
    Tuesday, April 1, 2014 8:00 AM