Finding the RecordType

Sometimes the field you want is not available by default. For example, not all organizations support record types on Case sObjects so you may have trouble trying to find the Case.RecordTypeId. This requires additional configuration of active support processes in Salesforce that will be associated with the Record Type.

If you already know the RecordTypeId then you can set it via the InternalFields.


SalesforceSession salesforceSession = //Get active Salesforce Session. Ideally from the Singleton implementation
Case testCase = new Case();
testCase.InternalFields["RecordTypeId"] = "01270000000Hqk7";

CaseService caseService = new CaseService(salesforceSession);
SaveResult caseSaveResult = caseService.Insert(testCase);
Assert.IsTrue(caseSaveResult.success);