<div dir="ltr">Thanks Maggi.<div><br></div><div>I shall try that as well.</div><div><br></div><div>For now setting up the value for productid as the id of first Product in lineitems and vtws_update works fine for me.</div><div><br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 20, 2018 at 3:11 AM, Conrado Maggi <span dir="ltr"><<a href="mailto:comaggi@gmail.com" target="_blank">comaggi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The only way I've make it work was.<div><br></div><div>1) vtws_retreive and pull all the record information</div><div>2) Override the array with the new values</div><div>3) vtws_revise the entire array.</div><div><br></div><div>In the mod tracker only show up the new values from #2 and you avoid both issues.</div><div><br></div><div>Conrado</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Apr 19, 2018 at 5:08 PM, nilay khatri <span dir="ltr"><<a href="mailto:nilay.spartan@gmail.com" target="_blank">nilay.spartan@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Yeh saw that.<div><br></div><div>Another way was to use webservice APIs. Though there got an exception that mandatory field productid is missing.</div><div><br></div><div>Following code resolved it:</div><div><br></div><div><br></div><div><div>                global $current_user;</div><div><span style="white-space:pre-wrap">          </span>$id = vtws_getWebserviceEntityId('In<wbr>voice',$vtigerInvoiceId);</div><div><span style="white-space:pre-wrap">         </span>$record = vtws_retrieve($id,$current_use<wbr>r);</div><div><span style="white-space:pre-wrap">           </span>$record['fieldname'] = 'fieldvalue';</div><div><span style="white-space:pre-wrap">             </span>$record['productid'] = $record['LineItems'][0]['produ<wbr>ctid'];// solution to set value for productid</div><div><span style="white-space:pre-wrap">            </span>vtws_update($record,$current_u<wbr>ser);</div></div><div><br></div><div><br></div></div><div class="m_-4487938847317227765HOEnZb"><div class="m_-4487938847317227765h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 19, 2018 at 8:33 PM, Alan Lord <span dir="ltr"><<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Look through the archives of this list for my thread called "Inventory Record copying" (November 2017) - that might help you.<br>
<br>
Al<div><div class="m_-4487938847317227765m_-3995456392582433339h5"><br>
<br>
<br>
<br>
On 19/04/18 14:43, nilay khatri wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-4487938847317227765m_-3995456392582433339h5">
Hi,<br>
<br>
I am trying to update an Invoice using Record Model, somewhat like:<br>
<br>
$invoiceRecordModel = Vtiger_Record_Model::getInstan<wbr>ceById($vtigerInvoiceId);<br>
$invoiceRecordModel->set('fiel<wbr>dname','fieldvalue');<br>
$invoiceRecordModel->set('mode<wbr>','edit');<br>
$invoiceRecordModel->save();<br>
<br>
But doing so removes all the lineitems. Any hints on how to update without removing lineitems?<br>
<br>
<br></div></div>
______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
</blockquote></div><br></div>
</div></div><br></div></div>______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>