Update Part Records From Custom BAQ

Hey Guy’s i am hoping you can help me with something.

We have a process we run, If a part has not been sold for 12 months it needs to go through a review before it can be resold. My process was to create a new field against the part (Parts are unique to the customer) where the last invoice date is stored which is updated when the invoice is raised.
This works fine.
Step two is to validate the parts and mark those over 12 months on hold.
So what i have done is created a Updateable BAQ which runs on a schedule late at night.
On the Update Getlist i have created a custom BPM which should update all the records linked to ttResult.
When i run the BAQ manually, i can see the fields (OnHold, OnholdDate, OnholdReason) are getting updated in ttResult, but what i am not seeing is the records in Part getting updated. But i am not getting any errors either.
Here is the work flow i have created

My Original query which creates ttResults has Company and PartNum in, so everything is linked by Company and PartNum.

Any Help Appreciated

If you are updating a field like Part.StaleHold_c, you shouldn’t need to create any widgets. The wizard can generate all this for you. In fact, I believe the training manual for Updateable BAQs specifically handles updating Parts.

Thanks Jason, Maybe i am misunderstanding or i was not clear in my original post.

What i am trying to achieve is something like this

That @josecgomez refers to in his post. I need to update a couple fields and it needs to be run on a schedule automatically.

Got it.
While I have not used the Export BAQ Process to run the GetList code, I would offer that the logic get moved to a Function that you schedule (if possible). If not, then let us know where you are stuck in the building of this.

  1. The Original Condition is set that if ttResults has any records in continue.
  2. Update ttResults.OnHold
  3. Update ttResults.ObsoleteDate
  4. Update ttResults.OnHoldReasonCode.

So In BAQ, when i click Get List, what i get is correct. So i know everything upto this point works.

image

When i check the part records nothing is updated. So it is in the update section there is the issue.
In the Update Table by Query i have set the following, (Linked by PartNum and Company) I have set the output fields to ttResults and used them in the binding.

image

The BO is set to PartUpdate

What method is your code running in? I would assume that it would be the Post-Processing of GetList.

Yes,

Hey Stuart,

It seems like an issue with your ds passed to Part.Update. If PartRow.Part is a new, empty table/variable when you do the “Update Table By Query”, there aren’t going to be any rows returned after your inner join on part/company. I think you’ll want to do either an outer join, OR use the “Fill Table by Query” widget to populate the ds.

I’ve also had better luck using Part.UpdateExt rather than Part.Update.

Thanks Adam

I do already have a “Fill Table by Query” widget in the work flow.
I have changed the BO and still no joy.

Did not get anywhere with this so i changed the workflow to custom code and it worked a treat

2 Likes