• Viranga
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

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