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
BlackBerry Development Advisor
Posts: 8
Registered: ‎02-08-2011
My Device: Not Specified

Issues with blackberry.message.Message status

With the following code:
        function showMsg(m) {
            var msg = "";
            msg += "bccRecipients = " + m.bccRecipients + "\n";
            msg += "body = " + m.body + "\n";
            msg += "ccRecipients = " + m.ccRecipients + "\n";
            msg += "folder = " + m.folder + "\n";
            msg += "from = " + m.from + "\n";
            msg += "priority = " + m.priority + "\n";
            msg += "replyTo = " + m.replyTo + "\n";
            msg += "status = " + m.status + "\n";
            msg += "subject = " + m.subject + "\n";
            msg += "toRecipients = " + m.toRecipients + "\n";
            msg += "uid = " + m.uid + "\n";

            alert(msg);
        }
      
        var m = new blackberry.message.Message();
       
        m.save();
        showMsg(m);
        m.send();
        showMsg(m);

After sending the message: m.status = -1. According to the specs here a status of -1 is not expected. Thoughts?


Gord

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issues with blackberry.message.Message status

A status of -1 would indicate an error.. Since there was no target recipient it would have target to send the email to.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
BlackBerry Development Advisor
Posts: 8
Registered: ‎02-08-2011
My Device: Not Specified

Re: Issues with blackberry.message.Message status

Should it not be a status of 3 according to:

 

const Number  STATUS_SAVED  = 0  
const Number  STATUS_DRAFT  = 1  
const Number  STATUS_SENT  = 2  
const Number  STATUS_ERROR_OCCURED  = 3  

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issues with blackberry.message.Message status

There may be some other trigger that create the status as STATUS_ERROR_OCCURED.  -1 may be represending the fact that it is a Number that has not yet been set and there is no constant for it.

 

If you created the message and then called your showMsg(m), my guess is that status will show -1.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
BlackBerry Development Advisor
Posts: 8
Registered: ‎02-08-2011
My Device: Not Specified

Re: Issues with blackberry.message.Message status

On my test app the status is 1 (STATUS_DRAFT) when created and saved.

It is only set to -1 when send is called (with invalid data).

 

From the specs:

 

If the message isn't a new message or a draft, an exception will be thrown. On a successful save of a new message the uid attribute will be filled in with its new value. If the message has invalid fields an exception will be thrown. (emphasis mine)

 

I am guessing that rather than throwing an exception it is setting the status to -1 currently.  Would this be a bug in the framework? or outdated docs?

 

Thanks for the quick reply!

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issues with blackberry.message.Message status

Sounds like it could be a bug in the framework.. I'll get the dev group to look at it.  In the next release of the framework, all of the APIs will be in the open source project and off of the OS so we should be free to make changes that are not dependant on OS releases.

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issues with blackberry.message.Message status

Turns out the documentation needs to be updated and a new constant added for easy comparison.

 

Basically....  -1 = UNKNOWN

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter