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 using dot net.....

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?

 

 

 

 

 

StephenBStephenB

Hi, you can't set IsDeleted to true to delete the record, you have to issue an explicit Delete call via the API using the Id of the Task. If you do this and re-query the row then IsDeleted will be true. But the field itself is read-only.

 

S

apurswaniapurswani

But there is not way to requery once delete() command is issued.

I tried many ways to get it back using c# like "select id from task where isdeleted=true" but return no records.....so i decided to update isdeleted field but not able to do that even.

 

Can you suggested me how to retrieve the rows which are deleted using delete() command?

 

 

-Anil

StephenBStephenB

You should be able to do

Select Id from Task where IsDeleted = true

 

via a SOQL call, presuming you haven't done a 'hard delete' in your delete() call, to check that your delete has happened. But I'm pretty sure you can't query every field when the record is deleted, you may only be able to get the Id when IsDeleted = true (which will allow you to do an undelete if you wanted to...)