[Vtigercrm-developers] Creating Inventory records via Webservice

Martin Allen martin.allen at clystnet.com
Tue Oct 6 13:12:27 GMT 2020


Aah, hadn't thought about describing the LineItems separately - I was
expecting to see it in the Describe for the Inventory module. Or even just
a reference to LineItems as a module!

Thanks.

I did manage to stumble across this data structure (in a random community
discussion) as a starting point that works so far - if anyone else has the
same problem!

$params = array (
'assigned_user_id' => 'administrator',
'subject' => 'REST salesOrderSubject 6',
'bill_city' => 'Drachten',
'bill_code' => '9205BB',
'bill_country' => 'Netherland',
'bill_pobox' => '',
'bill_state' => '',
'bill_street' => 'schuur 86',
'carrier' => NULL,
'contact_id' => NULL,
'conversion_rate' => '1.000',
'currency_id' => '21x1',
'customerno' => NULL,
'description' => 'Producten in deze verkooporder: 2 X Heart of David -
songbook 2',
'duedate' => '2018-11-06',
'enable_recurring' => '0',
'end_period' => NULL,
'exciseduty' => '0.000',
'invoicestatus' => 'Approved',
'payment_duration' => NULL,
'pending' => NULL,
'potential_id' => NULL,
'productid' => '14x42',
'vtiger_purchaseorder' => NULL,
'quote_id' => NULL,
'recurring_frequency' => NULL,
'salescommission' => '0.000',
'ship_city' => 'schuur 86',
'ship_code' => '9205BB',
'ship_country' => 'Netherlands',
'ship_pobox' => NULL,
'ship_state' => NULL,
'ship_street' => 'Drachten',
'account_id' => '11x37',
'sostatus' => 'Approved',
'start_period' => NULL,
'salesorder_no' => NULL,
'terms_conditions' => 'The payment is expected within 30 days.',
'discount_type_final' => 'percentage', // zero/amount/percentage
'hdnDiscountAmount' => '0.000', // only used if 'discount_type_final'
== 'amount'
'hdnDiscountPercent' => '20.000', // only used if
'discount_type_final' == 'percentage'
'pre_tax_total' => '1000.00',
'txtAdjustment' => '25.00',
'hdnS_H_Amount' => '20.00',
'hdnS_H_Percent' => '19',
'shipping_handling_charge' => 0,
'shtax1' => 0, // apply this tax, MUST exist in the application with
this internal taxname
'shtax2' => 0, // apply this tax, MUST exist in the application with
this internal taxname
'shtax3' => 0, // apply this tax, MUST exist in the application with
this internal taxname
'adjustmentType' => 'add', // none/add/deduct
'hdnTaxType' => 'group', // group or individual taxes are obtained
from the application
'LineItems' => Array(
'0' => Array (
'productid' => '14x42',
'sequence_no' => '1',
'quantity' => '1.000',
'listprice' => '500.00',
'discount_percent' => null,
'discount_amount' => null,
'comment' => 'sample comment product',
'description' => 'product description',
'incrementondel' => '0',
'tax1' => '19.00',
'tax2' => '0.00',
'tax3' => '0.00'
),

    )
);

Martin Allen


*01392 248692 - Main Office01392 690659 - Direct Line*

*[image: signature2]*

Have you visited our website recently? http://www.clystnet.com


The information in this email is confidential If you are not the intended
recipient, you must not read or use that information. This email and any
attachments are believed to be virus free however no responsibility is
accepted by Clystnet for any loss or damage arising in any way from receipt
or use thereof. Clystnet Ltd (company reg number 7164503) is based at
Silverdown Park, Fair Oak Close, Clyst Honiton, EX5 2UX


On Tue, 6 Oct 2020 at 13:40, Alan Lord <alanslists at gmail.com> wrote:

> Try calling vtsw_describe for both the Inventory module you are creating
> AND for the "LineItem" module ;-)
>
> It will show you which fields are mandatory etc:...
>
> > vtws_describe for LineItem
> > Array
> > (
> >     [label] => LineItem
> >     [name] => LineItem
> >     [createable] => 1
> >     [updateable] => 1
> >     [deleteable] => 1
> >     [retrieveable] => 1
> >     [fields] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [name] => parent_id
> >                     [label] => parent id
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [refersTo] => Array
> >                                 (
> >                                     [0] => Invoice
> >                                     [1] => Quotes
> >                                     [2] => PurchaseOrder
> >                                     [3] => SalesOrder
> >                                 )
> >
> >                             [name] => reference
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [1] => Array
> >                 (
> >                     [name] => productid
> >                     [label] => productid
> >                     [mandatory] => 1
> >                     [type] => Array
> >                         (
> >                             [refersTo] => Array
> >                                 (
> >                                     [0] => Products
> >                                     [1] => Services
> >                                 )
> >
> >                             [name] => reference
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [2] => Array
> >                 (
> >                     [name] => sequence_no
> >                     [label] => sequence no
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => integer
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [3] => Array
> >                 (
> >                     [name] => quantity
> >                     [label] => quantity
> >                     [mandatory] => 1
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [4] => Array
> >                 (
> >                     [name] => listprice
> >                     [label] => listprice
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [5] => Array
> >                 (
> >                     [name] => discount_percent
> >                     [label] => discount percent
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [6] => Array
> >                 (
> >                     [name] => discount_amount
> >                     [label] => discount amount
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [7] => Array
> >                 (
> >                     [name] => comment
> >                     [label] => comment
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => text
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [8] => Array
> >                 (
> >                     [name] => incrementondel
> >                     [label] => incrementondel
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => autogenerated
> >                         )
> >
> >                     [nullable] =>
> >                     [editable] =>
> >                     [default] => 0
> >                 )
> >
> >             [9] => Array
> >                 (
> >                     [name] => id
> >                     [label] => lineitem id
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => autogenerated
> >                         )
> >
> >                     [editable] =>
> >                     [nullable] =>
> >                     [default] =>
> >                 )
> >
> >             [10] => Array
> >                 (
> >                     [name] => tax1
> >                     [label] => VAT
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [11] => Array
> >                 (
> >                     [name] => tax2
> >                     [label] => Sales
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [12] => Array
> >                 (
> >                     [name] => tax3
> >                     [label] => Service
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [13] => Array
> >                 (
> >                     [name] => image
> >                     [label] => image
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => string
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [14] => Array
> >                 (
> >                     [name] => purchase_cost
> >                     [label] => purchase cost
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >             [15] => Array
> >                 (
> >                     [name] => margin
> >                     [label] => margin
> >                     [mandatory] =>
> >                     [type] => Array
> >                         (
> >                             [name] => double
> >                         )
> >
> >                     [nullable] => 1
> >                     [editable] => 1
> >                 )
> >
> >         )
> >
> >     [idPrefix] => 33
> >     [isEntity] =>
> >     [labelFields] =>
> > )
>
>
>
> On 06/10/2020 13:34, Martin Allen wrote:
> > Has anyone been able to successfully create a
> > Quote/Invoice/SalesOrder/PurchaseOrder record via WebService? If so what
> > data structure does it require?
> >
> > I am trying and keep getting a blank 200 response - I know that I need
> > to add a 'LineItem' array but have no idea what fields need to be in it?
> >
> > Can't find any documentation on this...
> >
> > Martin Allen
> >
> > *01392 248692 - Main Office
> > 01392 690659 - Direct Line*
> >
> > *signature2*
> >
> > Have you visited our website recently? http://www.clystnet.com
> > <http://www.clystnet.com/>
> >
> >
> > The information in this email is confidential If you are not the
> > intended recipient, you must not read or use that information. This
> > email and any attachments are believed to be virus free however no
> > responsibility is accepted by Clystnet for any loss or damage arising in
> > any way from receipt or use thereof. Clystnet Ltd (company reg number
> > 7164503) is based at Silverdown Park, Fair Oak Close, Clyst Honiton, EX5
> 2UX
> >
> >
> > _______________________________________________
> > http://www.vtiger.com/
> >
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20201006/1ec57aa4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 10550 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20201006/1ec57aa4/attachment-0001.png>


More information about the vtigercrm-developers mailing list