[Vtigercrm-developers] Save SalesOrder record from within custom module

Conrado Maggi comaggi at gmail.com
Tue Apr 12 11:40:29 GMT 2016


Hi,

Inventory modules expect the products lines to be in a request
variable. that is the reason why your code deletes the products. Vtiger is
searching for a variable that is empty

I agree with alan, using the revise method is the way to go. If that does
not work,  You can use vtws retrieve first, modify the field and finally
revise or update

Cheers,
Conrado




El martes, 12 de abril de 2016, Lennart van Ballegoij <lennart at egmmedia.nl>
escribió:

> Hey Guys,
>
>
> Anyone an idea what's causing the SalesOrder to loose the attached items
> on an edit of a field from withing my custom module ?
>
> I'm still not sure what's causing this problem, i'm thinking of testing
> the same code on a clean VTiger system tonight to be sure that nothing is
> interfering with my code.
>
> I've already tested turning of all custom EventHandlers and Workflows but
> this was not what was causing the SalesOrder to loose attached items.
>
> Hopefully i will find out more about my issues tonight, any guesses would
> be appreciated.
>
>
> Thanks in advance,
>
> Lennart
>
> Met vriendelijke groet,
> Lennart VAN Ballegoij
> Backend Developer
> +31 (0) 85 30 300 50 Westerlaan 51
> lennart at egmmedia.nl <javascript:_e(%7B%7D,'cvml','lennart at egmmedia.nl');> 8011
> CA Zwolle
> This e-mail message may contain confidential or legally privileged
> information and is intended only for the use of the intended recipient(s).
> Any unauthorized disclosure, dissemination, distribution, copying or the
> taking of any action in reliance on the information herein is prohibited.
> E-mails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, or contain viruses. Anyone who communicates
> with us by e-mail is deemed to have accepted these risks. EGM Media is not
> responsible for errors or omissions in this message and denies any
> responsibility for any damage arising from the use of e-mail. Any opinion
> and other statement contained in this message and any attachment are solely
> those of the author and do not necessarily represent those of the company.
>
> 2016-04-08 15:01 GMT+02:00 Lennart van Ballegoij <lennart at egmmedia.nl
> <javascript:_e(%7B%7D,'cvml','lennart at egmmedia.nl');>>:
>
>> Dear Alan,
>>
>>
>> Thanks for your respons, i tried this method right away but for some
>> reason i get the same result :|
>> My field gets edited just like it should, but the attached items/products disappear
>> again.
>>
>> To be sure this was not caused by any of my Workflows or Eventhandlers i
>> turned them all off but still the problem persists.
>>
>> Do you have any other ideas on how to fix this or how to workaround this ?
>>
>> Thanks in advance,
>>
>>
>> Lennart
>>
>>
>> 2016-04-08 12:52 GMT+02:00 Alan Lord <alanslists at gmail.com
>> <javascript:_e(%7B%7D,'cvml','alanslists at gmail.com');>>:
>>
>>> On 08/04/16 11:16, Lennart van Ballegoij wrote:
>>>
>>>> Hey guys,
>>>>
>>>>
>>>> I'm trying to edit a SalesOrder field from within my custom module.
>>>> I've got no problem editing the field but after the save of the record
>>>> the attached items/products disappear.
>>>>
>>>> Has someone encountered this issues before ?
>>>>
>>>> I'm using the following code to edit the Record:
>>>>
>>>> $recordModel = Vtiger_Record_Model::getInstanceById($salesorderid,
>>>> 'SalesOrder');
>>>> $recordModel->set('mode','edit');
>>>> $recordModel->set('cf_762','1');
>>>> $recordModel->save();
>>>>
>>>
>>> Have you tried using the vtws_revise server API?
>>>
>>>
>>> http://community.vtiger.com/help/vtigercrm/developers/server-apis.html#revise
>>>
>>>
>>> Al
>>>
>>>
>>> _______________________________________________
>>> http://www.vtiger.com/
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20160412/b2438879/attachment.html>


More information about the vtigercrm-developers mailing list