Create a Custom Field

Create a Custom Field C#.NET Code

Create a Custom Field C#.NET Code
                    
OAuthRequestValidator oauthValidator = new OAuthRequestValidator( accessToken, accessTokenSecret, consumerKey, consumerKeySecret); 
ServiceContext context = new ServiceContext(appToken, realmId, IntuitServicesType.QBD, oauthValidator);

DataService service = new DataService(context);

//The following code snippet shows how to create a StringTypeCustomFieldDefinition in a Customer object:
string name = "com.intuit.developer.teststring_" + Guid.NewGuid().ToString();
StringTypeCustomFieldDefinition def = service.AddStringTypeCustomFieldDefinition(typeof(Customer), name, false, false);

Add Custom Field to an Object

//The IPP .NET SDK includes the following methods for creating Custom Fields definitions:
//-AddStringTypeCustomFieldDefinition(Type entityType, string name)
//-AddDateTypeCustomFieldDefinition(Type entityType, string name)
//-AddNumberTypeCustomFieldDefinition(Type entityType, string name)
//-AddBooleanTypeCustomFieldDefinition(Type entityType, string name)


Customer newCustomer = new Customer();
string timeStamp = DateTime.Now.Ticks.ToString();
newCustomer.Name = "IC" + timeStamp;

newCustomer.CustomField = new CustomField[] { custField };