Search code examples
phpquickbooksinvoice

how to send custom field to quickbooks?


I'm using php_devkit_v3 to send invoice to quickbook. The code is working fine for simple invoice but when i send custom field it don't add custom field to invoice. Then I add a custom field in quickbook->CompanySetting->sales->custom field. but again i failed to add custom field the code that i'm using is given below

$CustomField = new QuickBooks_IPP_Object_CustomField();
$CustomField->setName('POD');
$CustomField->setType('StringType');
$CustomField->setStringValue('dfsdfsfd');
$Invoice->addCustomField($CustomField);


if ($resp = $InvoiceService->add($Context, $realm, $Invoice))
{
    print('Our new Invoice ID is: [' . $resp . ']');
}
else
{
    print($InvoiceService->lastError());
}

kindly guide me how can i do this?


Solution

  • Finally i had done it by sending definition id to qb as below

        $CustomField = new QuickBooks_IPP_Object_CustomField();
        $CustomField->setDefinitionId(1);
        $CustomField->setName('POD');
        $CustomField->setType('StringType');
        $CustomField->setStringValue($pod);
        $Invoice->addCustomField($CustomField);
    

    It may help the others so I'm posting the solution. I'm bit weak in english but code is understandable