CRMScript - loop through Appointment Participants

Hi all,

I have the following code to get the participants on an appointment:

NSAppointmentAgent appointmentAgent;
  NSAppointmentEntity appointment = appointmentAgent.GetAppointmentEntity(ev.getInputValue("AppointmentEntity.AppointmentId").toInteger());
  NSParticipantInfo[] participants = appointment.GetParticipants();

I now need to loop through the particpants array and check if they are a resource or not

 

Any tips?

 

Cheers James

RE: CRMScript - loop through Appointment Participants

Hi James,

Might be different solutions to this, but perhaps something to check AssociateType of participants.

NSAppointmentAgent appointmentAgent;
NSAppointmentEntity appointment = appointmentAgent.GetAppointmentEntity(ev.getInputValue("AppointmentEntity.AppointmentId").toInteger());
NSParticipantInfo[] participants = appointment.GetParticipants();

NSAssociateAgent agent;
for(Integer i = 0; i< participants.length();i++)
{
  NSAssociate assoc = agent.GetAssociate(participants[i].GetAssociateId());
  Integer type = assoc.GetType();
  if(type == 2)
  	log(assoc.GetName() + " " + assoc.GetType().toString());
}

You can find Enum description of AssociateTypes here.

 

Von: Michel Krohn-Dale 13. Sep 2019

RE: CRMScript - loop through Appointment Participants

Thank you very much Michel,

that was exactly what i was looking for :)

 

Von: James Carter 13. Sep 2019