Comparing 2 collections to make an action

Comparing 2 collections to make an action

Salut,

I have a customer form with a main phone number, and a secondary phone number.

I have another form, a calendar, with a paste of the main phone number.

I want to send a SMS to both phone numbers when the calendar event happen. I use the following script for the main phone number and it works:

CustList = Customers[Recalls = true].distinct(MainPhone);
CalendarList = Calendar[EventDate == zoho.currentdate].distinct(MainPhoneCalendar);
for each  MainPhone in CustList
{
    if(CalendarList.contains(MainPhone))
    {
        Reponse = twilio.sms.send("twilio_connection",MainPhone,"RAPPEL : Livraison de vos légumes bio aujourd'hui");
    }
}

The problem is with the secondary phone number which do not appear in the Calendar form, only in the Customers form. I basically need a script that says : If  X phone number has a calendar event, go see where that phone number appears in the customers' records and fetch the secondary phone in the action. And it is for many records each time.

Don't see how to do that.

Sylvain