i'm trying to mass delete our opportunities using web services, and i'm getting the "This transaction cannot be deleted because it is linked to by one or more transactions" error. so, what i'm doing is doing a transaction search, using the internal ID of the opportunity that i'm trying to delete to get its linked transactions:
WriteResponse[] deletions = _service.deleteList(opportunityRefs); foreach (WriteResponse delete in deletions) { if (!delete.status.isSuccess) { TransactionSearch linkedTransactions = new TransactionSearch(); TransactionSearchBasic basicTrans = new TransactionSearchBasic(); SearchMultiSelectField oppSearch = new SearchMultiSelectField(); oppSearch.@operator = SearchMultiSelectFieldOperator.anyOf; oppSearch.operatorSpecified = true; oppSearch.searchValue = new RecordRef[] { (RecordRef)delete.baseRef }; basicTrans.opportunity = oppSearch; linkedTransactions.basic = basicTrans; SearchResult linkedTransResult = _service.search(linkedTransactions); ... the problem that i'm experiencing lies within linkedTransResult. i'm using a try/catch to typecast the Record in linkedTransResult.recordList to an Invoice or Estimate or Sales Order. try { Invoice inv = (Invoice)r; } catch (InvalidCastException) { try { Estimate e = new Estimate(); } catch (InvalidCastException) { try { SalesOrder so = new SalesOrder(); } catch (InvalidCastException) { // different type } } } it picks up Invoices just fine. the problem is with Estimates and Sales Orders. I've looked at the SOAP response, and i'm supposed to be picking up an Estimate with an internal ID of 89, but the estimate that it's picking up has no internal ID. i don't know what's happening, and was wondering something similar has happened to anyone else.