public AllAccountsModel AddOrganizationAccount(string OrgCode, string newAccountName) { var myAccount = new AllAccountsModel { Organization = OrgCode, Name = newAccountName, EventSalesStatus = "A", //Use your configured Status codes to set the account designation status property Class = USISDKConstants.AccountClass.Account //The class determines if this is an Account or a Contact //myAccount.AccountCode = "ACCTCODE" 'You can set the Account code manually, or leave it empty if your configuration allows for it to be set automatically. }; return(APIUtil.AddAccount(USISDKClient, myAccount)); }
/// <summary> /// This example will show you how to add a new account with custom fields attached. /// </summary> /// <param name="orgCode">The organization code of the account you wish to add.</param> /// <param name="newAccountName">This is the the name of the new account.</param> /// <param name="issueClass">This is the code that represents the Issue Class of the custom fields.</param> /// <param name="issueType">This is the code that represents the Issue Type of the custom fields</param> /// <param name="newTxt01Value">In this example, we are changing Text_01. Enter a new value here to set this.</param> public AllAccountsModel AddWithUserFields(string orgCode, string newAccountName, string issueClass, string issueType, string newTxt01Value) { var myAccount = new AllAccountsModel { Organization = orgCode, Name = newAccountName, EventSalesStatus = "A", //Use your configured Status codes to set the account designation status property Class = USISDKConstants.AccountClass.Account, //The class determines if this is an Account or a Contact AccountUserFieldSets = new List <UserFields>() }; //Here's how to add a user field set with values to a new account var myUserField = new UserFields { Header = USISDKConstants.UserFieldHeaders.OrganizationAccountUserFields, //Designate if this is an organization account user field set, an individual account user field set, or a membership user field set Class = issueClass, //Set the designation of the user field. You can use the USISDKConstants.AccountDesignations class to set this. Type = issueType, //Use the Opportunity Type code from your user field. This matches the value stored in Ungerboeck table column CR073_ISSUE_TYPE. UserText01 = newTxt01Value //Set the value in the user field property }; myAccount.AccountUserFieldSets.Add(myUserField); //Then add it back into the AllAccountsModel object. You can add multiple user field sets to the same account object before saving. return(APIUtil.AddAccount(USISDKClient, myAccount)); }