Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 27
Registered: ‎02-20-2011
My Device: Torch 9800
My Carrier: Bell Canada

Creating Appointment and Reminder using pim in OS 6

I am very new to developing for the blackberry and I was trying to implement a process of adding an appointment from a web widget. The code works fine in OS 5.0.x but on OS 6.0.x the appointment and reminder doesn't get added. What am I doing wrong?

 

Here's the code I am using:

 

        var newAppt = new blackberry.pim.Appointment();
        newAppt.location = sDesc;
        newAppt.summary = sName;
        newAppt.freeBusy = 0; // Free

 

        //date format received: yyyy-mm-dd (e.g. 2011-03-24)
        var start = new Date(sTarg);  //sTarg='2011-03-24'
        newAppt.start = start;
        var end = start.setHours(start.getHours() + 1);
        newAppt.end = end;

 

        // Create Reminder
        newAppt.reminder = new blackberry.pim.Reminder();
        newAppt.reminder.type = blackberry.pim.Reminder.RELATIVE;
        newAppt.reminder.relativeHours = 1;  
        newAppt.save();

 

 

I have correctly, added the permissions to blackberry.pim.Appointment and blackberry,pim.Reminder. I've also tried newAppt.allDay=true instead of using a Date() object, but it just doesn't work.

Any help would be highly appreciated. Thanks.

 

Contributor
Posts: 27
Registered: ‎02-20-2011
My Device: Torch 9800
My Carrier: Bell Canada

Re: Creating Appointment and Reminder using pim in OS 6

I am surprised that, with so many members out there, no one could answer this problem. I am sure a lot of you would have used this functionality.

 

Anyway, I managed to find the solution the hard way.

New Contributor
Posts: 5
Registered: ‎03-29-2011
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: Creating Appointment and Reminder using pim in OS 6

Please... what did you do to fix this?

Contributor
Posts: 27
Registered: ‎02-20-2011
My Device: Torch 9800
My Carrier: Bell Canada

Re: Creating Appointment and Reminder using pim in OS 6

[ Edited ]

Sorry for not replying earlier. Been on vacation. Anyway, the solution is to convert the date format to 'yyyy/mm/dd'. This format works for both OS 5 and 6.

 

New Contributor
Posts: 5
Registered: ‎03-29-2011
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: Creating Appointment and Reminder using pim in OS 6

Thanks for this update.  The problem I have seen is event though my "start" and "end" javascript Date objects are the correct dates, the newAppt.start and newAppt.end are null after they have been assigned the start and end date objects.

 

var start = new Date('2011/03/24');

alert('start: ' + start); // shows correct date

newAppt.start = start;

alert('newAppt.start: ' + newAppt.start); // shows null

var end = start.setHours(start.getHours() + 1);

alert('end: '+end); // shows correct date

newAppt.end = end;

alert('newAppt.end: ' + newAppt.end); // shows null

newAppt.save(); // creates appointment on Dec 31, 1969

 

Were you seeing behavior like this?