I'm attempting to use this Simple console example on github as suggested in this answer here. sorry for coming here so much, I just need to make progress.
There is a link of the code that keep throwing an error.
Error CS0029 Cannot implicitly convert type
'Salesforce.Common.Models.SuccessResponse' to 'string'
UserAccounts D:\Salesforce-Research\UserAccounts\View\Program.cs 108
I've compared that line with similar lines in the code:
Console.WriteLine("Creating a parent record (Account)");
dynamic a = new ExpandoObject();
a.Name = "Account from .Net Toolkit";
a.Id = await client.CreateAsync("Account", a);
I've fiddled with the line, trying all different sorts of formats, including parsing the result or parts of it to Account or string (yes I'm desperate). I've checked that it is expecting a string (well it is as Account Id is a string).
I can only assume the code is correct.
- Is it correct?
- If it is correct what am I supposed to do?
thanks.
edit
I've decided to go with this:
var account = new Account { Name = "Test Account" };
// account.Id = await client.CreateAsync(Account.SObjectTypeName, account);
var success1 = await client.CreateAsync(Account.SObjectTypeName, account);
if(account.Id == null)
{
Console.WriteLine(success1.Errors.ToString() + "Failed to create test record.");
return;
}
AND IT DOESN'T WORK