Announcement

Collapse
No announcement yet.

Code Not working in Api Before Save Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code Not working in Api Before Save Script

    Hello developers,
    I have written some code for the Quote entity, but it appears to be malfunctioning. Could you please review it for any issues?


    $target = list();
    $i = 0;

    while ($i < array\length(opportunity.contactsIds)) {
    $contactId = array\at(opportunity.contactsIds, $i);

    // Check if the contactId matches billingContactId.
    if ($contactId == billingContactId) {
    $target = array\push($target, '1');
    } else {
    $target = array\push($target, '0');
    }

    $i = $i + 1;
    }

    if (array\includes($target, '0')) {
    recordService\throwBadRequest("Billing Contact is missing in the Opportunity.");
    }​

  • #2
    Sorry ignore my comment, misunderstood the code because of the nesting...

    Comment

    Working...
    X