What is the scope (or more specifically the life span) of a CallContextBPMData(“ccbd” for shorthand) variable?
If I set
ccbd.Character01 in a SalesOrder BO method, when will that be cleared?
Here’s a test I did:
- Created a Post-Proc BPM on SO.GetNewOrderDtl, which sets
- Created a Pre-Proc BPM on SO.Update, with a Show Message widget that displays
- Launched Order Entry
- Created New Order and saved. The message box from SO.Update() shows, with
ccbd.Character01 being blank
- Create a new line and save. The message box from SO.Update() shows, with
- Create a new order and save. The message box from SO.Update() shows, with
ccbd.Character01 be valid (and unchanged) through the entire session I have the Order Entry form open? And require me to reset it (with something like SO.GetByID)?
It won’t be cleared in the next BPM run it will already be filled out. Since it will also be passed back to the Client. I think it clears when you close the form and open a new one.
Using them is risky, just keep that in mind. Always make your own variables when you can. Because:
- Some Random (unrelated to Pos) Method Directive: PRE
- Sets Character01 to = "Carol Tiger"
- It also Updates something on POHead.Description
- This triggers a Data Directive called "CleanupPODescription"
- Someone in there uses Character01 and sets it to = "Canadian Bacon"
- Back in the Method Directive we try to use Character01, expecting "Carol Tiger", yet it says "Canadian Bacon"
- POST Directive
The lifetime of (and there are a few caveats) CallContext is the lifetime of a given adapter.
So when you open order entry one of the things it does is instanciate the OrderEntryAdapter and the respective CallContext along with it.
So any calls which make use of that adapter “share” the CallContext and any variables set within last as long as that adapter is instantiated.
Generally they are unique per screen (per adapter really) and last as long as the screen (read adapter) is open and active. But there are a zillion caveats for special screens so its always this way except when it isn’t