RE: How to get the Account ID from Contact Ribbon
HI,
You can get the contactId from CRM parameters in your JS.
d365demystified.com/.../
Now based on ContactId you need to fetch Account lookup value using below code -
Xrm.WebApi.online.retrieveRecord("contact", "9e4967da-8ee4-eb11-bacb-0022486e98df", "?$select=_accountid_value").then(
function success(result) {
console.log(result);
// Columns
var contactid = result["contactid"]; // Guid
var accountid = result["_accountid_value"]; // Lookup
var accountid_formatted = result["_accountid_value@OData.Community.Display.V1.FormattedValue"];
var accountid_lookuplogicalname = result["_accountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
},
function(error) {
console.log(error.message);
}
);
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/