go to post Joseph Tsang · Aug 17, 2022 Hi Chi Wan, Do you want to try calling IRIS directly using POSTMAN with the same Basic Authentication credentials? Or has it been covered in your first scenario? Joseph
go to post Joseph Tsang · Jul 27, 2022 Thanks for your inputs, Dan, Joel. And you're right. Perhaps I was trying to look up a callback somewhat like %OnAfterCommit() instead.
go to post Joseph Tsang · Jul 15, 2022 Hi Yaron, thanks for giving a test with the code example above. And the statement you referred is indeed from the documentation. Yet to me the "transaction" mentioned is a bit ambiguous. I would rather interpret it as an explicit transaction demarcated by a TSTART and a TCOMMIT (or TROLLBACK) in the calling method. Let me continue with your example here. This time I would like to add TSTART and TCOMMIT for the scope of the transaction, and there in the transaction I would like to add and save the second object: USER>TSTART USER>s obj=##class(USER.TestClass).%New(), obj.Name="Name", sc=obj.%Save() w !,sc 1 USER>zw ^USER.TestClassD ^USER.TestClassD=1 ^USER.TestClassD(1)=$lb("","Name") USER>s obj=##class(USER.TestClass).%New(), obj.Name="Name2", sc=obj.%Save() w !,sc 1 USER>zw ^USER.TestClassD ^USER.TestClassD=2 ^USER.TestClassD(1)=$lb("","Name") ^USER.TestClassD(2)=$lb("","Name2") USER>TCOMMIT And what I really expect to see is, the %OnSaveFinally() method of those 2 objects will be called at the point just after TCOMMIT in my example, not after their own %Save() respectively.