Alter appointment owner....

Just this simple script but the SaveAppointmentEntity in the end doesnt work. No errors appears but the 3 historical acts linked to user 8 is not transferred to user 5

Isnt there a mucher faster way to change appointment.associate_id ?

________________________________________________________

Integer histKobe = 8;

NSAssociateAgent assAgent;
NSAssociate newKobe = assAgent.GetAssociate(5);

 

SearchEngine se;
se.addFields("appointment", "appointment_id,associate_id");
se.addCriteria("appointment.associate_id", "OperatorEquals", histKobe.toString());

NSAppointmentAgent appntAgent;

for(se.select();!se.eof();se.next())
{
String appntId = se.getField(0);
//printLine("<BR> app ID " + se.getField(0) + "userID " + se.getField(1) );

NSAppointmentEntity appnt = appntAgent.GetAppointmentEntity(appntId.toInteger());
appnt.SetAssociate(newKobe);
appntAgent.SaveAppointmentEntity(appnt);

}

 

Thanks

 

RE: Alter appointment owner....

Hello Henrik,

Why don't you use Bulk update for this? You can create a selection with all activitys with owner = old associate and then bulk update them to owner = new associate.

Af: David Hollegien 3. mar 2021

RE: Alter appointment owner....

Hi David,

From what I can read it is not implemented yet ?

https://community.superoffice.com/en/developer/forum/rooms/topic/netserver-api-group/web-services/rest-api-bulk-update/

Af: Henrik Laitinen 3. mar 2021