[Vtigercrm-developers] Updating Inventory records using record model clears off the lineitems

nilay khatri nilay.spartan at gmail.com
Thu Apr 19 15:08:07 GMT 2018


Yeh saw that.

Another way was to use webservice APIs. Though there got an exception that
mandatory field productid is missing.

Following code resolved it:


                global $current_user;
$id = vtws_getWebserviceEntityId('Invoice',$vtigerInvoiceId);
$record = vtws_retrieve($id,$current_user);
$record['fieldname'] = 'fieldvalue';
$record['productid'] = $record['LineItems'][0]['productid'];// solution to
set value for productid
vtws_update($record,$current_user);



On Thu, Apr 19, 2018 at 8:33 PM, Alan Lord <alanslists at gmail.com> wrote:

> Look through the archives of this list for my thread called "Inventory
> Record copying" (November 2017) - that might help you.
>
> Al
>
>
>
>
> On 19/04/18 14:43, nilay khatri wrote:
>
>> Hi,
>>
>> I am trying to update an Invoice using Record Model, somewhat like:
>>
>> $invoiceRecordModel = Vtiger_Record_Model::getInstan
>> ceById($vtigerInvoiceId);
>> $invoiceRecordModel->set('fieldname','fieldvalue');
>> $invoiceRecordModel->set('mode','edit');
>> $invoiceRecordModel->save();
>>
>> But doing so removes all the lineitems. Any hints on how to update
>> without removing lineitems?
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>>
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20180419/2c59365a/attachment.html>


More information about the vtigercrm-developers mailing list