Updating a related record via Set Field

If you want to update a field in a related record in a script, the easiest way seems to be to use the “Set Field” script step.  So, for example, Set Field [program_enrolment_PERSON::ActiveDate; Get (CurrentDate)] will quite happily set the field even though the the field isn’t on any open layout.   However, it’s important to do a COMMIT after the Set Field – the Commit will have the effect of saving the current record, plus any related fields.

I wasn’t at all sure about this, but was reassured by applying a validation test to the related field, that would run when an Commit was attempted but would fail (e.g. that it had to be zero), and, sure enough, the test is performed on the Commit of the parent record.

Advertisements

One Comment on “Updating a related record via Set Field”

  1. Cyrille Destribois says:

    Great tip. Thanks a bunch Dave 🙂
    Cyrille (from France)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s