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
VirangaViranga 

getDeleted Fails (C#.Net)

Does anyone have any idea why getDelete always fails even when a records have been deleted from a relerven t Sforce object (I tried this on Contact and Account)

It always failed returning a null value....the block of code I used was a further development to the sample c# code provided in Help documentation.

sforce.GetDeletedResult gdr = binding.getDeleted("Contact", startTimeU, endTimeU);

if (gdr.deletedRecords != null) //always returns null even when records have been deleted in relarvant time block

{

if (gdr.deletedRecords.Length > 0){

//if (gdr.deletedRecords != null && gdr.deletedRecords.Length > 0){ //this combination did not work either

for (int i=0;i<gdr.deletedRecords.Length;i++)

{

//Console.WriteLine(gdr.deletedRecords[i].id + " was deleted on " + gdr.deletedRecords[i].deletedDate.ToString());

// Invoke retrieve call and save results in an array of SObjects

sforce.sObject[] records = binding.retrieve("Id", "Contact", new String[] {gdr.deletedRecords[i].id});

sforce.Contact contact = (sforce.Contact)records[0];

// Get the contact properties

//System.Diagnostics.Trace.WriteLine("ID is: "+ contact.Id);

//Delete Contact query here

Delete_ContactRecord(contact.Id);//remove records from local DB

}

}

}

Has any one come across any similar problems with Getdeleted in C# .The GetUpdate works fine. Any work around methods or code sample to solve this problem is much appreciate as it is kind of important to a protoype we are developing currently.

Thanks in advance

Viranga 

 

 

DevAngelDevAngel

Hi Viranga,

I've gotten this to work without issue.  It would be very helpful if you could capture the soap request and response and post that.

SweetBoxSweetBox

Check your start date and end date are correct.  I had mine backwards so the start date was more recent then the end date which caused a null to be returned.  Example a start date of 06/24/2005 and end date of 06/21/2005 will fail because they are reversed.  So the start date should be 06/21/2005 and end date of 06/24/2005

Geoff Pearce

Geotide Software (www.geotide.com)