Hello evryone, I'm facing a tricky issue where in ...
# suitescript
d
Hello evryone, I'm facing a tricky issue where in I have a beforesubmitScript on SO and invoice which sets shipping and billing address from partner customer record onto the SO and invoice instead of the default shipping and billing. This code "newRecord.setValue({ fieldId: 'shipaddress', value: managingPartnerShipAddress });" works on create of SO but during edit it is not working what could be the reason for this? When there is any change in the partner address the client will edit and save the SO which will trigger the UE to update the partner's latest address. However in my case the script is triggering and I see the new value in logs too but on the record I see the old address which got set during create. any ideas ? IThanks in advance
n
I ran into a similar problem with addresses on the PO. What I ended up doing is taking the string value of the shipping address and setting it in the shipaddress field. But in order to do that, i had to set the shipaddresslist field to null first.
Copy code
const entity = // customer record
const shipto = // value of shipaddress from the sales order. This is the full address string

rec.setValue({ fieldId: "shipto", value: entity });

rec.setValue({ fieldId: "shipaddresslist", value: "" });

rec.setValue({ fieldId: "shipaddress", value: shipto });
d
tried the above logic but didn't work. The weird thing is the value is being set and getting overriden by previous value
n
Do you maybe have a secret workflow somewhere that is setting the address values
d
@Nathan L There is secret suitescript indeed that was supposed to be in testing but accidently got released. Thanks for the input 🙂
👍 1