Set Alarm via CRMScript doesn't work?


we're trying to set / get the alarm for an appointment using CRMScript, but it doesn't seem to work. 

The alarm lead time isn't set, and when we try to call GetAlarmLeadTime it fails with a "Unknown function toString for type NSTimeSpan". Seems like it's confused about the types TimeSpan and NSTimeSpan.

Here is an example script that doesn't work:

#setLanguageLevel 3;

Integer contactId = 21;

NSAppointmentAgent appAgent;
NSAppointmentEntity app;
NSContactAgent contactAgent;
NSContact contact;

TimeSpan t;
t.set(0,0,0,10,0); //10 minutes

contact = contactAgent.GetContact(contactId);

NSTaskListItem task;

app = appAgent.CreateDefaultAppointmentEntity();

app.SetDescription("Appointment created " + getCurrentDateTime().toString());


app = appAgent.SaveAppointmentEntity(app);
TimeSpan result = app.GetAlarmLeadTime();
printLine("Alarm lead time: " + app.GetAlarmLeadTime().toString(4, 1, 1, true));


RE: Set Alarm via CRMScript doesn't work?

Hi Frode,

this seems like a bug to me, that they somehow have mixed NSTimeSpan and TimeSpan in the method calls.

I will report this as a bug, and see if they will fix it.

Av: Simen Mostuen Iversen 18. dec 2017

RE: Set Alarm via CRMScript doesn't work?

Thanks! This subject came up again this morning in a discussion at our office, so coincidental that you responded now :)

Av: Frode Lillerud 18. dec 2017

RE: Set Alarm via CRMScript doesn't work?

Did this get a Bug ID?

Av: Frode Lillerud 4. jan 2018

RE: Set Alarm via CRMScript doesn't work?

In release 8.2 R03, your script will work as you have written it. GetAlarmLeadTime() will now return a TimeSpan object, and you can use the regular methods on this. 

There is no NSTimeSpan object anymore, since no methods actually returns that.

Av: Stian Andre Olsen 10. jan 2018

RE: Set Alarm via CRMScript doesn't work?

Great, thanks :)

Av: Frode Lillerud 10. jan 2018