public async Task Create_Accounts_Typed() { var lstAccounts = new List <IAttributedObject>(); lstAccounts.Add(new AtrributedAccount { Name = "New Account 1", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC1", }, }); lstAccounts.Add(new AtrributedAccount { Name = "New Account 2", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC2", }, }); lstAccounts.Add(new AtrributedAccount { Name = "New Account 3", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC3", }, }); var theRequest = new CreateRequest() { Records = lstAccounts }; var successResponse = await _client.CreateCompositeTreeAsync("Account", theRequest); Assert.That(successResponse.Results, Is.Not.Null.And.Not.Empty); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(_consumerKey) && string.IsNullOrEmpty(_consumerSecret) && string.IsNullOrEmpty(_username) && string.IsNullOrEmpty(_password) && string.IsNullOrEmpty(_organizationId)) { _consumerKey = Environment.GetEnvironmentVariable("ConsumerKey"); _consumerSecret = Environment.GetEnvironmentVariable("ConsumerSecret"); _username = Environment.GetEnvironmentVariable("Username"); _password = Environment.GetEnvironmentVariable("Password"); _organizationId = Environment.GetEnvironmentVariable("OrganizationId"); } // Use TLS 1.2 (instead of defaulting to 1.0) const int SecurityProtocolTypeTls11 = 768; const int SecurityProtocolTypeTls12 = 3072; ServicePointManager.SecurityProtocol |= (SecurityProtocolType)(SecurityProtocolTypeTls12 | SecurityProtocolTypeTls11); _auth = new AuthenticationClient(); _auth.UsernamePasswordAsync(_consumerKey, _consumerSecret, _username, _password, _token).Wait(); _client = new ForceClient(_auth.InstanceUrl, _auth.AccessToken, _auth.ApiVersion); var lstAccounts = new List <IAttributedObject>(); lstAccounts.Add(new AtrributedAccount { Name = "New Account 1", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC1", }, }); lstAccounts.Add(new AtrributedAccount { Name = "New Account 2", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC2", }, }); lstAccounts.Add(new AtrributedAccount { Name = "New Account 3", Description = "New Account Description", Attributes = new ObjectAttributes() { Type = "Account", ReferenceId = "ACC3", }, }); var theRequest = new CreateRequest() { Records = lstAccounts }; var successResponse = _client.CreateCompositeTreeAsync("Account", theRequest); }