I need to update the opportunity but I only have the contact Id. So if I can get the opportunity Id I can update the opportunity.
Xrm.WebApi.retrieveMultipleRecords("opportunity", "?$select=opportunityid&$filter=(_contactid_value eq 25a17064-1ae7-e611-80f4-e0071b661f01 or _parentcontactid_value eq 25a17064-1ae7-e611-80f4-e0071b661f01)").then(
function success(results) {
console.log(results);
for (var i = 0; i < results.entities.length; i++) {
var result = results.entities[i];
// Columns
var opportunityid = result["opportunityid"]; // Guid
}
},
function(error) {
console.log(error.message);
}
);
André Arnaud de Cal...
293,082
Super User 2025 Season 1
Martin Dráb
231,870
Most Valuable Professional
nmaenpaa
101,156
Moderator