我对Salesforce一无所知。我使用 C#连接salesforce。我有Parameters params = new Parameters();
FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class).configure(params.fileBased().setFile(new File("client-config.properties")));
PropertiesConfiguration config = builder.getConfiguration();
// Perform interpolation on all variables
PropertiesConfiguration extConfig =
(PropertiesConfiguration) config.interpolatedConfiguration();
一些列和值。这些列是 salesforce DataTable
表格列。我需要将值插入Salesforce Account
表。
Account
这是连接 salesforce
的方法private async Task<ForceClient> ConnectToSalesforceByOAuth(int clientId)
{
var property = Properties.SingleOrDefault(p => p.Name.Equals(SalesforceInstancePropertyName, StringComparison.InvariantCultureIgnoreCase));
var propertyValue = SettingValues.SingleOrDefault(s => s.PropertyName.Equals(property?.Name, StringComparison.InvariantCultureIgnoreCase));
if (string.IsNullOrWhiteSpace(propertyValue?.PropertyValue))
{
throw new Exception($"Unable to find a valid \"{SalesforceInstancePropertyName}\"");
}
var settings = GetOAuthSettings(clientId);
var authToken = JsonConvert.DeserializeObject<SalesforceAuthToken>(propertyValue.PropertyValue);
// Refresh the auth token in case it has expired
authToken = await OAuthHelper.ReloadSalesforceAuthentication(clientId, settings, authToken.RefreshToken);
return new ForceClient(authToken.InstanceUrl, authToken.AccessToken, authToken.ApiVersion);
}
调用using (var forceClient = await ConnectToSalesforceByOAuth(clientId))
方法,如上所述
ConnectToSalesforceByOAuth
以上这一行我必须将对象传递给forceClient.UpdateAsync(string objectname, string recordId, object record);
。但我没有上课。
我使用此代码获得了归档名称。
record
并将字段存储到某些表
DataSyncSystem.EissSyncSystemTables.Add(await GetDataSyncSystemTable(forceClient, "Opportunity"));
var contact = await forceClient.DescribeAsync<SalesforceObject>(Opportunity);
请帮我解决如何将查询写入 salesforce。 感谢。