Answered by:
Unable to Open an Existing Entity with Xrm.page Library

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 UnavailableThe 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".
- 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".
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
-
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".
- 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 -