Skip to content

Commit

Permalink
BTHAB-145: Refactor how client_id is populated from case
Browse files Browse the repository at this point in the history
  • Loading branch information
olayiwola-compucorp committed Sep 27, 2023
1 parent f8b73a2 commit 23d8404
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@
return;
}

crmApi4('Relationship', 'get', {
select: ['contact_id_a'],
where: [['case_id', '=', $scope.defaultCaseId], ['relationship_type_id:name', '=', 'Case Coordinator is'], ['is_current', '=', true]],
limit: 1
}).then(function (relationships) {
if (Array.isArray(relationships) && relationships.length > 0) {
$scope.salesOrder.client_id = relationships[0].contact_id_a ?? null;
crmApi4('CaseContact', 'get', {
select: ['contact_id'],
where: [['case_id', '=', $scope.defaultCaseId]]
}).then(function (caseContacts) {
if (Array.isArray(caseContacts) && caseContacts.length > 0) {
$scope.salesOrder.client_id = caseContacts[0].contact_id ?? null;
}
});
}
Expand Down

0 comments on commit 23d8404

Please sign in to comment.