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
apurswaniapurswani 

IsDeleted is not working.....

Hey,

I am using asp.net and allowing user to create task using aspx file. now the data entered by the user has to be stored in salesforce. all things are working fine except when I make user to delete task and set the field IsDeleted=true it is NOT WORKING at all.

 

as even after setting IsDeleted field to true it is still showing false.

 

Why is not getting updated?

 

SforceService Obj_SforceService = new SforceService();


Task task = new Task();

task.Id = "00T90000003FXT4EAO";

task.IsDeleted = true;


SaveResult[] sr = Obj_SforceService.update(new sObject[] { task });


for (int j = 0; j < sr.Length; j++)
{
    if (sr[j].success)
        txtMessage.Text += " Succeed";
    else
    {
        txtMessage.Text +="Failed";
    }

}

 

Above programs works fine with any issue and it is showing the message "Succeed" in textbox. but still it is not updating record and IsDeleted is still false. why?

 

 

 

 

 

AlwaysConfusedAlwaysConfused

Just a thought ....

 

Have you tried passing the resulting Task (sObject) to the delete API call then looking at what else that changes?

 

 

 

SuperfellSuperfell

You can't delete a row by setting isDeleted to true, you need to use the delete method.

darrenw_ukdarrenw_uk

Try also setting isDeleteSpecified to true. I had the same problem setting isPublished in CaseComments. Something to do with boolean fields being non-nullaable, so you have to set the associated 'Specified' field.

apurswaniapurswani

darrenw_uk 

 

I tried to set IsDeletedSpecified = true but now it is throwing error : "Cannot create/update IsDeleted" make sure you have sufficient read/write permission to your profile.

 

Now the problem is that I am using "System Administrator" Account which is having all the rights.

 

So why does it throws such an error?

 

 

-Anil

darrenw_ukdarrenw_uk

I don't know is the simple answer, I'm new to SF myself, only been developing against it for about 5 weeks.

 

However, the first step I'd take with this problem is to see if you can update any other field in Task, eg Description. If not can you update the description of another Task? What about another object entirely such as Case?

 

Just a thought but is there another field in Task which would prohibit you from updating, eg if isClosed is set to True? Like I said I'm new to all this too!

 

AlwaysConfusedAlwaysConfused

Just out of curiosity ...

 

What's your issue with using the delete API method instead?