Am using param.getNewValue(fieldId) to check content and have need to assign it. Was expecting there to be a ‘set’ equivalent (i.e. param.setNewValue()) but alas there isn’t. Is there a method or something that I’m missing to facilitate this assignment?
It’s a complex scenario, but basically the field I wish to assign is a reference to another sheet. It has a default but this doesn’t seem to apply if the other record doesn’t yet exist (but is created by the pre-workflow) when adding a new record. Ironically it errors saying invalid Reference field on initial save, but subsequent save works because the pre-workflow (that failed) created it. Screenshot attached of field in question.
Are you saying that the Reference field under Products sheet store the reference to another Sheet X, and Sheet X is created by the Pre-workflow of Products?
If that’s the case, maybe you need to consider generate the Sheet X in the Post-workflow. Pre-workflow by definition is the “checking or validating” process that ran before the record on Product is saved.
However, if your only intention is to add the Reference of Sheet X into Products, creating a new Sheet X entry after the new record on Products is saved first shouldn’t matter?
See if it make sense to fill in the reference to Sheet X after the record in Products is saved first, then you can make sure both records on Products and Sheet X exist when you add the value of the Reference on Products.
See if it helps.