Is it OK to directly update Detail records outside of a H/D structure?

I’ve been of the understanding that an update that you want to make to a Detail record of a H/D should also be seen as an update to the H/D. This means, when you’re in a logic block and want to modify a Detail record, it should be done within the context of a H/D structure. This will persist a new ‘version’ onto the Header record even if the header is unchanged, because the H/D as a whole has changed.

Is that accurate? Or is it OK to fetch and directly update Detail records? Such a fetch and direct update exists in ReleaseBackorderedSOLine for example.

No. You are right, updating details outside of an H/D structure is dangerous and can introduce data integrity issues. There is lots of processing baked into the HeaderDetail (H/D) concept (e.g. common fields, HeaderDetail Triggers) whose behavior is bypassed when updating the detail table directly, which can result in inconsistent data between the detail, its header, and other data in the system.

The logic in that logic block should probably be revisited.

2 Likes

Agreed with everything @brendan.b said. It is technically possible to do a standalone update as you’ve seen in that logic block, but I would exercise extreme caution while doing so.

I doubt there are many use cases where the developer actually intends for that stand-alone behavior rather than all the logic that comes with an HD structure.

2 Likes

While there are some nuanced cases where updates to the Detail table directly are necessary, The best practice is always to navigate via an HD Structure.

What @brendan.b and @cheyanne.schwiethale have said is correct. Common fields will not update and Header and HD triggers will not fire, so updates in this manner can lead to problematic data when handled improperly.

When logic changes are well understood and will not lead to conflicting information in between the Header and Detail tables, updates exclusively to the Detail are possible but not recommended.

3 Likes

@ian.p do you think the update in this logic could then be responsible for the flow we discussed not working?

@ellen.kaufman probably not - but not impossible.