You need to sign in to do that
Don't have an account?
venturec3
Dynamically cast to an sObject without knowing what sobject will be coming up next in a listbox
Is there a way to dynamically cast an sobject using the name of that object as a string?
For example, generally if I'm updating a specific sobject, I might do something like:
Account acct = new Account();
acct.Name = "Test Account";
List<Account> accountList = new List<Account>();
accountList.add(acct);
SaveResult[] sr = prodConnection.upsert(accountList.ToArray());
However, I may not know whether the user selects an Account, Contact or Opportunity, etc.?
What solutions have others come up with on this when inserting/upserting records into Salesforce from C#?
For example, generally if I'm updating a specific sobject, I might do something like:
Account acct = new Account();
acct.Name = "Test Account";
List<Account> accountList = new List<Account>();
accountList.add(acct);
SaveResult[] sr = prodConnection.upsert(accountList.ToArray());
However, I may not know whether the user selects an Account, Contact or Opportunity, etc.?
What solutions have others come up with on this when inserting/upserting records into Salesforce from C#?
but if you want to access specific fields of the object you might end up casting the generic sObject to that specific type.