picqer / moneybird-php-client

PHP Client for Moneybird V2
MIT License
82 stars 77 forks source link

Custom Field SaleInvoice #143

Closed striderxfossility closed 5 years ago

striderxfossility commented 6 years ago

I want to give a value to a custom field.

$customField = $moneybird->CustomField());
    $customField->id = ***;
    $customField->name = 'Categorie';
    $customField->value = '4A';
    $customField->source = '4A';

    $customFields = [];
    $customFields[] = $customField;

$saleInvoice->custom_fields = $customFields;

But it doesnt work.

basvandertogt commented 5 years ago

I ran into the same issue. Somebody know a solution?

tss68nl commented 5 years ago

Create the custom field in the moneybird webinterface, fill it for at least one item, then download the API response to get the unique identifier number. Use this Unique ID as the key of the key/value pair you insert into the array, and it will work.

That's a huge workaround, since you have to manually add and find the ID's for it to work, but is manageable if you develop for your own administration.

mano-gilissen commented 2 years ago

This issue was never fixed, the Entities/CustomFields class does not contain the "value" field as fillable. For this reason adding a custom field to a new contact as described by @tss68nl does not work.

After manually adding the "value" field to the CustomFields class everything works as intended.