Computed field : How to add / forward Proposal Ref No and Date, that will be transferred in Sales orders (complementary attributes)?


I would like to transfer / forward the proposal reference No. and Date, to two different Sale Order complementary attributes (Type: 1. String & 2. Date) to appear at Sale orders when creating sales order from Proposal.

I know it can be done with Computed field but having issue with the code to define the reference & date.
I tried the following for ref. but it is fetching the wrong Proposal reference

(($reloadedobj = new Propal($db)) && ($reloadedobj->fetchNoCompute($objectoffield->socid) > 0)) ? $reloadedobj->ref : 'Not found'

Could you please give me some advices how to proceed?

Thank you.


Actualy, with your formula, you are loading the Proposal, with the

Means the third party ID…

First try to just put print_r($objectoffield) in the computed field.
It will display all the field of the object.
Try to see what is the name of the reference id of the proposal.
then replace socid by the good attribute on your formula and it should work.

Hi ksar,

I ran the print_r($objectoffield) and found the reference id as [ref] => TE/CT02/302 (showing the right proposal no as TE/CT02/302 ) then I changed thr code to

(($reloadedobj = new Propal($db)) && ($reloadedobj->fetchNoCompute($objectoffield->ref) > 0)) ? $reloadedobj->ref : 'Not found'

but still getting the Not found in the computed field. attaching images for your reference.


If ref is part of the object, then the formula should be $objectoffield->ref