Updating PO Header based on PO Details

We have some government requirements were we need certain verbiage on purchase orders for military contracts and we are trying to automate this process. We are wanting to add additional comments on the PO Header when any line item on the po is in a certain product group.

I tried utilizing the set field in the update method directive on the po header and even though the temp table is there for the PO Header the field isn’t updated. I’m assuming this is because it is only updating the po detail record and not the header even though the header temp table is there.

Are there any best practices or recommendations on update header records when details are updated so that records locks and the dreaded row changed popup are avoided?

Thanks,

Lee

What type of directive did you use? Pre or Post?

I just tried this with a Post-Processing BPM on the Update method and it worked.

1 Like

I tried both. Pre wouldn’t update the record at all. Post would update the header comment in the screen, but upon refreshing or closing and reopening the record the data was gone. Everything works fine until I get to the set field routing.

You may have to do this with two BPM’s, with the first one (that catches the condition) calls the second (that sets the header table)

EDIT

Ignore that. I was thinking of something else.

I got the following working (haven’t fully tested all possibilities: new , changed deleted, etc…)

image

  • “Show Message 1” is just for debugging

“Condition 0” does the check on PODetail (in my example it chacks if the PODetail.PartNum is a specific number)

image

  • “Show Message 0” and “Show Message 2” are just for debugging

The “Set Field 0” widget is:
image

with the expression:

ttPOHeaderRow.CommentText + "\nComment updated: " +  BpmFunc.Today() 

That’s just to add something to it so I can tell it fired.

Just an aside, you can double-click the title bar and replace the text with something more useful like “Debug Msg 1”.

And now, back to your regularly scheduled Calvin educational update.

2 Likes

It’s funny that I’ll waste time putting a long description in the body of that Message box, and totally ignore the ability to customize the appearance of the widget.

I do the opposite when insert feild or table queries in an info message. Give them names like

fqttPODetails.PartNum_added

for a field query of the ttPODetails table, the PartNum field, when added.

1 Like

Odd, Your code is pretty much doing the same as mine. When the post process runs for me it actually updates the comment on the header in the screen, but doesn’t write it to the database on save so unless I back, edit a field on the header, then save again the comment isn’t committed to the database this way.

I think after setting the ttPOHeader, we need to call the PO.Update BO.

Might need to add something to prevent a circular reference - since PO.Update is being called from inside a PO.Update BPM. Maybe the fact that it only gets called if the Condition is true, which it shouldnt be on the second call.