Hi,
We have a setup whereby we have some custom fields associated with a customer. When a sales order is saved, the data in these fields is pulled into the sales order, reformatted a little then saved in another custom field on the sales order.
We now need to change this so that it happens before the order is saved. So firstly it needs to happen when a new sales order is created associated with a particular customer and secondly when the customer associated with the sales order is changed (ie when we start with a completely blank sales order and then set the customer).
Currently I have two issues. If a new sales order is created associated with a particular customer (ie by clicking the new sales order button in a customer record) how to retreive the id for that customer. I can do it once the record has been saved but it appears that the methodology is not the same for unsaved records and I can't find the answer for that
The second issue is how to tell when the customer is changed. I have tried attaching a custom script to the fieldChanged event and this runs, however it is fired for a whole bunch of different fields. Whilst I suppose some of these fields (eg billing address) are likely to only change at this point when the customer changes, I could test for one of them but it doesn't seem to be too sensible a way of doing it. Is there a way of testing whether the customer itself has changed and what the id of the new customer is
Many thanks