OmeLuuk
18th July 2022, 19:08
We have table extensions that will trigger an extended standard BOD.

Like the extended standard BOD is the Item_v3,
When some change is made in the pricebook for this item, we want to generate a new item BOD, so in tdpcg031 we added a call to trigger the Item_v3 from txesttdpcg031.
Also when there is a change in stock for an item we trigger the Item_v3, so when we see a change on an item record in whinr140 we trigger the item BOD from txestwhinr140.

What we would like to know, looking at the item BOD is where the BOD is triggered. We can see the session code (not by prog.name$ but by other variables) but we cannot see the name of the extension object (like otxestwhinr140) that causes the trigger.

I added an external variable "trigger_ID" that I would like to fill with the calling object.

Is there a way to tell from which extension the BOD is triggered?

JaapJD
19th July 2022, 10:02
Add the following line before you call BOD.Publish():

trigger_ID = __OBJECT__

OmeLuuk
19th July 2022, 13:46
Thanks, that works:
<UserArea>
<Property>
<NameValue name="ln.trigger" type="StringType">tccom1640m000/otxesttccom140/ttccom140/otxesbbocom110</NameValue>
</Property>
<Property>
<NameValue name="ln.systemlogin" type="StringType">se504</NameValue>
</Property>
</UserArea>

In the trigger table extension:
function extern long before.open.object.set()
{ | hook code
long info(PSMAXSIZE)
domain tcpath2 trigger_nmp
e = pstat(pid, trigger_nmp, info) | process name
trigger_id = str.join$("/", trigger_nmp, __OBJECT__, main.table$)
return (0)
}and in the BOD extension:#include <bic_tt>
| Make name c XML safe
#define XMLNM(B) str.replace$(str.replace$(str.replace$(str.replace$(
^ str.replace$(B," ",""),"/",""),")","_"),"(","_"),"%","")
| Make an short ln. name from the tablefield
#define MAKEATNM(B) tolower$(XMLNM("ln." & tt.short.field.desc(B,35)))
| Add a string field if not empty with name based on tablefield B
#define XMLPSTR(A,B) if not isspace(A) then rbl=addValue(MAKEATNM(B),trim$(A),
^ "String")endif
trigger_id=(not isspace(trigger_id)?trigger_id&"/":"(Yet) Unknown/")&__OBJECT__
XMLPSTR(trigger_id, "datrg100.trig") | ln.trigger
XMLPSTR(logname$, "ttaad200.uusr") | ln.systemlogin
And of course an extern declaration of the variable|global declarations for extension script.
extern domain tcpath2 trigger_id