Javascript... Guid from an Entity (Lookup field) same as the Guid from a different Entity (Lookupfield) RRS feed

  • Question

  • Hi everyone:

    I have managed to retrieve the Incident Id and show the Logical name on a different form when run on the Incident Form. However I can't seen to get the service shown in another form when a custom ribbon button is pressed. Below is part of my code

     a = {};

     a.IncidentId = {};
        a.IncidentId.Id = Xrm.Page.data.entity.getId();
        a.IncidentId.LogicalName = Xrm.Page.data.entity.getEntityName();

        a.serviceId = {};
        a.serviceId.Id = Xrm.Page.data.entity.attributes.get("apitil_service").getValue();
        a.serviceId.LogicalName = Xrm.Page.data.entity.attributes.get("apitil_service").getValue();


    Wednesday, November 23, 2011 3:23 PM


  • I think you need to use:

        a.serviceId = {};
         a.serviceId.Id = Xrm.Page.data.entity.attributes.get("apitil_service").getValue().id;
        a.serviceId.LogicalName = Xrm.Page.data.entity.attributes.get("apitil_service").getValue().entityType;

    See the getValue method documentation.


    I hope this helps.

    Jim Daly Technical Writer Microsoft Dynamics CRM
    Tuesday, November 29, 2011 5:18 PM