Mostly asking out of fear of making an infinite loop. Am I way overthinking it?
We have a requirement based on a custom field selected on the header to automatically flag the BuyToOrder flag on the release.
It works fine on the GetNewOrderRel method directive, but only on additionally generated releases. The first release that the line creates does not trigger this method.
The only methods I see in the trace are MasterUpdate and then CheckMakeDirectReleases which has no table in the method parameters.
MasterUpdate doesn’t seem to reach the release level of the business object when the system generates it during an added line record.
I then tried data directive, which got me close but there is some buggyness with it.
With no BPM
With BPM
It is clearly attempting to do something with it. I tried including setting Make Direct to false and Buy to Order to true but the same result occurs.
I have a feeling it is how these checkboxes function and I need to call their ChangeBuyToOrder directive. But since the only place I can seem to catch it changing is in the in-transaction data directive there isn’t a widget for calling another directive out of there.
I tried a post directive on MasterUpdate and finding the appropriate release and invoking ChangeOrderRelBuyToOrder since that didn’t seem to trigger MasterUpdate. I’m hesitant to call Update Table by Query as an alternative because I’m afraid of triggering a infinite loop and locking up our server. Our testing environment is on the same server as our live environment…
It does invoke the method and I get my show message but I get an unchanged release
I’m kind of out of ideas at this point besides running Update Table by Query but I’m afraid of causing an infinite loop. Do the Update Table by Query run the same update directives?
I believe when I had to do this, I had a BPM with a condition that checked if the added release was release 1, and if yes I called another update to change the flag.
Data Directive sees it being added but when I flag the Buy to Order flag there it completely bugs out. Neither end up checked and there is a false Override note next to Make Direct for some reason.
Data Directive does work for setting other fields, custom fields, etc, but it seems the BuyToOrder specifically is bugging out.
Where else can I get it to fire? I can’t seem to find a place where it updates correctly on the first release.
I have half a mind to add a customization layer that conditionally checks it.
Hhhmmmm…, that’s right. You can’t fire a DD after a DD.
Put a DD in that checks if the release is release 1, put something in a BPM field, and then call the Update method again. Check for whatever you put in the BPM field and update the flag.
Won’t that infinite loop it? Pre-Process would fire, then the DD would call the update again which would hit the pre-process into DD again? I’ve tried short-circuiting a BPM before using conditions but it has always ignored it and still infinitely looped for me in the past.
I guess I’m worried that calling a method directive update from a Standard directive would eventually loop through the hierarchy back to standard directive and cause a loop?
Not a 1-1 comparison but I tried having a method directive call itself before using a conditional statement to call itself trying to do a recursive directive and it locked up the server even though I am 99% sure it was written properly in a recursive sense of the phrase. It was a fairly straightforward statement and each time the integer being evaluated should have been decreasing. Ever since then I’ve avoided making any looping directives like this since our test instance shares with our live server.
That is why you would use a Standard DD. That triggers after the record is saved to the DB. There is a clear end to the call and you are initiating a new one. When it goes to save to the DB again, it will evaluate to False because the RowMod is U, not A.
So I have it kind of working - though I see I deviated from your outline a bit. Am I able to calculate and send the dataset from the DD through the Invoke BO widget or do I have to strictly build it inside the method directive?
The green box email does go out, so I know my logic is following down correctly as this was the expected path for my first test case. I wanted to build it this way so I could see it hit each stage, so it would hit BTO, update, then hit the SD and this time hit Plant, update, then hit the SD and exit out.
But hey at least no infinite loop so I’m less scared now.
Edit - secondary problem I spotted I’ll have to rearrange some of the logic since I need BTO to be on prior to turning on Dropship for that first chain but I’m working down the “is CrossDock” chain.
Switched it to do the calculation as described, no difference between calculating for the dataset in the SD or calculating in the update method after I’ve called it.
This time I tested on a drop ship variant. All 3 emails triggered, but the actual release didn’t update. This is when it was fully updated in the method directive.
SD Directive,
looking for release = 1 and RowMod = A.
Assigned ShortChar01 to “FirstRelease”
Got the orderrel the record for it, and sent it in the update method directive.