Duplicate Check in Opportunity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ashif Malayil
    Senior Member
    • Dec 2023
    • 171

    Duplicate Check in Opportunity

    In our scenario. when ever a customer calls i'll create Contact first then Opportunity.
    I wrote a workflow to auto fetch customer name and phone number from Contact module.
    So the user agents will only enter the required details when creating Opportunity from Contact bottom panel. But in this scenario duplicate check is not working.

    API before save script is running but phone number will only fetch after opportunity got created. Howe can i resolve this issue?

    API Before Save Script :-
    if (!recordService\skipDuplicateCheck()) {
    if (entity\isNew() || entity\isAttributeChanged('phoneNumber')) {
    $id = record\findOne('Opportunity', null, null, 'phoneNumber=', phoneNumber);

    if ($id) {

    recordService\throwDuplicateConflict($id);
    }
    }
    }​
  • Ashif Malayil
    Senior Member
    • Dec 2023
    • 171

    #2
    // if (!recordService\skipDuplicateCheck()) {
    // if (entity\isNew() || entity\isAttributeChanged('cCustomerPhone')) {
    // $id = record\findOne('Opportunity', null, null, 'cCustomerPhone=', cCustomerPhone);

    // if ($id) {

    // recordService\throwDuplicateConflict($id);
    // }
    // }
    // }

    here cCustomerPhone is foreign field but i am getting Error 500

    Comment

    Working...