# Can I assign a field in pre-workflow?

**URL:** <https://community.ragic.com/t/can-i-assign-a-field-in-pre-workflow/13647>\
**Category:** Developers\
**Created:** [August 9, 2023, 10:30am UTC](https://community.ragic.com/t/can-i-assign-a-field-in-pre-workflow/13647 "2023-08-09T10:30:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david14](https://community.ragic.com/letter_avatar_proxy/v4/letter/d/50afbb/32.png) [@david14](https://community.ragic.com/u/david14)\
**Post date:** [August 9, 2023, 10:30am UTC](https://community.ragic.com/t/can-i-assign-a-field-in-pre-workflow/13647/1 "2023-08-09T10:30:22Z")

</div>

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.

 ![Screenshot (772)](https://community.ragic.com/uploads/default/original/2X/a/a94f2138dab5c2140fce2318f0ad8bdafdc0b7dd.png)

---

<div class="post-metadata">

**Author:** ![funda.jeremy](https://community.ragic.com/user_avatar/community.ragic.com/funda.jeremy/32/2899_2.png) [@funda.jeremy](https://community.ragic.com/u/funda.jeremy)\
**Post date:** [August 20, 2023, 9:16am UTC](https://community.ragic.com/t/can-i-assign-a-field-in-pre-workflow/13647/2 "2023-08-20T09:16:37Z")

</div>

Hi David,

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.
