admin管理员组

文章数量:1415061

Apparently in earlier versions of Microsoft CRM it was possible to get record Guid in detail page of a record (eg: Account, Contact) using Javascript console, using synatax such as

Xrm.Page.data.entity.getId(); frames[0].Xrm.Page.data.entity.getId();

ref: /

I am unable to repeat this in CRM 2015.

> frames[0].Xrm.Page.data.entity.getId();
Unable to get property 'entity' of undefined or null reference


> Xrm.Page.data.entity.getId();
Unable to get property 'entity' of undefined or null reference

however:

> this

gives me dump that includes

USER_GUID: "{98D61030-7513-4EAA-A243-1D29FA99E0A0}",

Screen shot of IE Console

Apparently in earlier versions of Microsoft CRM it was possible to get record Guid in detail page of a record (eg: Account, Contact) using Javascript console, using synatax such as

Xrm.Page.data.entity.getId(); frames[0].Xrm.Page.data.entity.getId();

ref: https://crmbusiness.wordpress./2014/02/17/crm-2013-javascript-to-get-id-of-record/

I am unable to repeat this in CRM 2015.

> frames[0].Xrm.Page.data.entity.getId();
Unable to get property 'entity' of undefined or null reference


> Xrm.Page.data.entity.getId();
Unable to get property 'entity' of undefined or null reference

however:

> this

gives me dump that includes

USER_GUID: "{98D61030-7513-4EAA-A243-1D29FA99E0A0}",

Screen shot of IE Console

Share Improve this question edited Dec 18, 2015 at 17:26 Mustapha George asked Dec 18, 2015 at 16:17 Mustapha GeorgeMustapha George 2,53710 gold badges50 silver badges87 bronze badges 4
  • 1 can you see any errors in javascript console? – madox2 Commented Dec 18, 2015 at 16:22
  • thanks for prompt reply. I added code & error to question. – Mustapha George Commented Dec 18, 2015 at 16:27
  • 1 When do you call this code? On button click or page load, ...? – madox2 Commented Dec 18, 2015 at 17:11
  • on console. See added image... – Mustapha George Commented Dec 18, 2015 at 17:27
Add a ment  | 

1 Answer 1

Reset to default 5

this is a change due to the new form rendering inside Dynamics CRM (also known as Turbo Forms)

you can try with

frames[1].Xrm.Page.data.entity.getId();

本文标签: get guid id from Microsoft CRMjavascript consoleStack Overflow