locked
Unable to Open an Existing Entity with Xrm.page Library RRS feed

  • Question

  • I am using Xrm.page library to create contact entity form pop-ups. These pop-ups are not event triggered. New forms are successfully opening, but when I try to open an existing entity corresponding to its GUID as:

    Xrm.Utility.openEntityForm("contact", GUID);

    I get following error:

    Record Is Unavailable

    The requested record was not found or you do not have sufficient permissions to view it.

    How can I open an existing entity with Xrm.page library, is there anyother way of achieving this task?

    Tuesday, August 20, 2013 6:34 AM

Answers

  • Hang on, what are you trying to open? A contact or an address?

    If you want to open a contact, you need to get the 'contactid' field which contains the contact's primarykey/guid.

    If you want to open the address, you need to set the entity name to 'customeraddress' in your openEntityForm JavaScript call.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by Absaar Wednesday, August 21, 2013 7:00 AM
    Wednesday, August 21, 2013 6:40 AM
  • Hi Absaar,

    address1_addressid is unique identifier, I think it will return you the Guid. Please try to debug the code.

    Why are you passing contact then, it would be customeraddress I think.

    Xrm.Utility.openEntityForm("contact", GUID);

    Thanks!

    • Marked as answer by Absaar Wednesday, August 21, 2013 7:00 AM
    Wednesday, August 21, 2013 6:45 AM

All replies

  • The way you're doing it is correct. Are you sure GUID is valid, and that is links to an already-existing contact?

    Can you open that contact record through the UI and compare the URL that is failing?

    If you can't see an obvious error post both URL's here.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Tuesday, August 20, 2013 6:42 AM
  • Paul, thank you for your reply, May be I am getting the wrong GUID. Can you guide me how to get the GUID of a particular entity record?
    Tuesday, August 20, 2013 6:46 AM
  • Where are you trying to get the guid from? Maybe post your current code, and explain what you're trying to do and we'll go from there.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Tuesday, August 20, 2013 7:08 AM
  • I am using linq to extract the value of contact entity field "address1_addressid", I then pass the extracted value to this Xrm.page method, but then I get this error.

    Now does the value of enetity "address1_addressid" will give me GUID or is there something seriously wrong?

    • Edited by Absaar Wednesday, August 21, 2013 6:29 AM
    Wednesday, August 21, 2013 6:27 AM
  • Hang on, what are you trying to open? A contact or an address?

    If you want to open a contact, you need to get the 'contactid' field which contains the contact's primarykey/guid.

    If you want to open the address, you need to set the entity name to 'customeraddress' in your openEntityForm JavaScript call.

    Paul


    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    • Marked as answer by Absaar Wednesday, August 21, 2013 7:00 AM
    Wednesday, August 21, 2013 6:40 AM
  • Hi Absaar,

    address1_addressid is unique identifier, I think it will return you the Guid. Please try to debug the code.

    Why are you passing contact then, it would be customeraddress I think.

    Xrm.Utility.openEntityForm("contact", GUID);

    Thanks!

    • Marked as answer by Absaar Wednesday, August 21, 2013 7:00 AM
    Wednesday, August 21, 2013 6:45 AM
  • Thanx a lot Paul, it actually helped, cheers :)
    Wednesday, August 21, 2013 7:01 AM
  • Hi

     You can get the guid of current record like

    var Id = Xrm.Page.data.entity.getId();

    Wednesday, August 21, 2013 7:03 AM
  • @Riaz, if he was on the record he wanted to open, he wouldn't need JavaScript :)

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Wednesday, August 21, 2013 7:11 AM