Hi,
I'm new to github community, I don't how these things should be properly addresed, but I really needed to use custom properties dynamically for contacts, but didn't know how, so I searched through source code and found
in PropertyTransport class, that there was a code for this but it's buggy.
In "\Api\Shared\PropertyTransportModel.cs", there is this method "ToPropertyTransportModel" which is used to add properties to request body
Starting from line 35
else if(typeof(IEnumerable<>).IsAssignableFrom(prop.PropertyType) && typeof(PropertyValuePair).IsAssignableFrom(prop.PropertyType.GetElementType()))
{
IEnumerable<PropertyValuePair> pairs = value as IEnumerable<PropertyValuePair>;
foreach (var item in pairs)
{
Properties.Add(item);
}
continue;
}
So if you are extending ContactHubSpotModel with this kind of property, you should be able to put there you're custom properties
[DataMember(Name ="CustomProperties")]
[IgnoreDataMember]
public List<PropertyValuePair> CustomProperties { get; set; } = new List<PropertyValuePair>();
But it doesn't work, because of the buggy if-statement. When I changed it to this, it it worked.
Hi, I'm new to github community, I don't how these things should be properly addresed, but I really needed to use custom properties dynamically for contacts, but didn't know how, so I searched through source code and found in PropertyTransport class, that there was a code for this but it's buggy.
In "\Api\Shared\PropertyTransportModel.cs", there is this method "ToPropertyTransportModel" which is used to add properties to request body
Starting from line 35
So if you are extending ContactHubSpotModel with this kind of property, you should be able to put there you're custom properties
But it doesn't work, because of the buggy if-statement. When I changed it to this, it it worked.
Do I understand correctly how this should be used? Is there a better way to user properties dynamically? Maybe this fix needs to be implemented?