Open mrmoses opened 11 years ago
If you are trying to add a company using this method:
CompanyID = client.DataService.Add<InfusionSoft.Tables.Company>(setter =>
{
setter.Set(c => c.CompanyName, "Company Name");
});
Then you can modify the Support/FieldSetter.cs class and replace the set method with this:
public virtual IFieldSetter<T> Set<TV>(Expression<Func<T, TV>> expression, TV value)
{
PropertyInfo property = Express.PropertyWithLambda(expression);
var attributes = property.GetCustomAttributes(typeof(XmlRpcMemberAttribute), false);
string ColName = property.Name;
if (attributes.Any())
{
var attribute = attributes.Cast<XmlRpcMemberAttribute>().First();
if (!String.IsNullOrEmpty(attribute.Member) && attribute.Member != property.Name)
{
ColName = attribute.Member;
}
}
_dictionary.Add(ColName, value);
return this;
}
This will basically use the XmlRpcMember atribute set on the class in /Tables/Company.cs
Adding a company with a CompanyName results in this error:
The correct field name is "Company", which is what is set as the XmlRpcMember for the CompanyName field in the Company class, but it doesn't seem to get passed as "Company" in the XmlRpc call.
Changing CompanyName field to Company results in a compile error (which I assume is why the field is CompanyName to begin with):
A workaround is to use
http://community.infusionsoft.com/showthread.php/4101-Cannot-add-a-Company-to-InfusionSoft-when-passing-CompanyName