function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SnowMoreSnowMore 

Delete fails without triggering an error

When a user has insufficient privileges to delete a record -- say, an opportunity owned by someone else -- the delete fails but there's no error message. The following code is straight out of the Office Tolkit VB code sample:

 

          On Error GoTo handleError
          Dim MyOppObject(1) As SObject3
          Set MyOppObject(0) = g_sfApi.CreateObject("opportunity")
          MyOppObject(0)("id") = MyID

          g_sfApi.Delete MyOppObject, False

 

 

But no error is triggered when the delete fails due to insufficient privileges.

 

          MsgBox MyOppObject(0).Error
          MsgBox MyOppObject(0).ErrorMessage

 

return error code 0 and an empty string for error message, regardless of whether the object was successfully deleted or not.

 

 

 

Any ideas  on how to trap this condition?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SnowMoreSnowMore

The problem is no longer opccurring now that I have upgraded to Office Toolkit 4.0 (from 3.0).  That is, now the delete is working.  So I don't know whether a failed delete will generate an error message, but the delete itself seems to be working as it should.

All Answers

SnowMoreSnowMore

The problem is no longer opccurring now that I have upgraded to Office Toolkit 4.0 (from 3.0).  That is, now the delete is working.  So I don't know whether a failed delete will generate an error message, but the delete itself seems to be working as it should.

This was selected as the best answer
SnowMoreSnowMore

 

Since I posted the above "solution" I have discovered some serious problems with Toolkit 4.0, which is probably why the wiki managers put 3.0 back up there in some places and 4.0 was so hard to find.

 

In particular, I find that creating a new Task fails frequently, and often crashes my app.  I run the same code in Toolkit 3 and there's no problem.  So, from my admittedly limited perspective, I do not recommend the upgrade to Toolkit 4.0 at this time.  I have spent hours spinning my wheels with it, and I'm going back to 3.0.