Call method cancel order for a PWO from inside a Deferred Operation

Hi all, community

I was wondering if it is possible to call the method CancelOrder for a PersonWantsOrg from inside a Deferred Operation. I have tried, of course, and I was successful in create the deferred operation but after it run, the pwo was still there in status Assigned. I wasn’t give back with any error or else. It simply executed the deferred but no output.

The same pwo was correctly processed by the same code outside the Deferred Operation, and this makes me think the code is ok. By the way, I use the ISIngleDBObject.

Can someone please give me advices?

Thanks in advance.

A

Parents
  • I think it might be the reason that you are using the old ISingleDBObject interface.

    Try to use the current IEntity interfaces for handling your object and calling the method,

    Sample: Using a Deferred Block for IEntities

    ' Create a new deferred block for a specified point in time.
    Using New VI.DB.DeferredOperations.DeferredBlock(Session, DateTime.UtcNow.AddDays(30), "Optional description for the deferred operation")
    ' Operations done here are done deferred

    ' Call a customizer method on entity dbEntity
    dbEntity.CallMethod("MakeDecision", uidPersonHead, bDecision, strReason)

    If dbEntity.GetMethod(Session, "MakeDecision", uidPersonHead, bDecision, strReason)?.Behavior.HasFlagFast(MethodBehavior.SaveRequired) Then
    ' Save to execute the method
    dbEntity.Save(Session)
    End If
    End Using
  • Markus, thanks, it worked like a charm.

    After I switched to IEntity everything seems to work as expected.

    Just one more thing… . The scenario is that a user was given a form (a custom form designed by us) in which he can create or cancel (abort) some pwo as deferred operation.

    I tried both to create one deferred block and add all new pwos there, and create a single deferred operation block for each new pwo. But independently from how many deferred block I create, the FIRST and only the first deferred operation, when executed, went in error. The other 4 pwos (I have tried to deferring create 5 pwos) are instead created without any problems. The process at this point tryes again and after something like 10 minutes the pwo is successfully created.

    On the jobserver log I found this:

    810023] Error running statement: insert into PersonWantsOrg (CustomProperty06, DisplayOrg, DisplayOrgParent, DisplayOrgParentOfParent, DisplayPersonInserted, DisplayPersonOrdered, GenProcID, ObjectKeyFinal, ObjectKeyOrdered, OrderDate, OrderReason, OrderState, UID_ITShopOrgFinal, UID_Org, UID_OrgParent, UID_OrgParentOfParent, UID_PersonInserted, UID_PersonOrdered, UID_PersonWantsOrg, UID_QERWorkingMethod, UiOrderState, xdateinserted, xuserinserted, xdateupdated, xuserupdated, xobjectkey) values (N'xxxxxxxxx’, N’Product name’, N’Shelf name, N'shopname', N’xxxxxxxxxx', N'xxxxxxxx, yyyyyyyyyyyy, 'FE184DA2-365A-430A-B437-E6B04E40D684', '<Key><T>ESet</T><P>e5550234-658a-4bb1-9824-a3ad17f8066a</P></Key>', '<Key><T>ESet</T><P>e5550234-658a-4bb1-9824-a3ad17f8066a</P></Key>', '2023-11-03 10:15:27.033', N'Requested by xxxxxxxxx. Ticket xxxxxxx: xxxxxx, N'OrderProduct', 'AACA11B6-940E-4DAD-9F5B-1F825CF3E973', 'AACA11B6-940E-4DAD-9F5B-1F825CF3E973', '36d3549a-89d6-4094-9dbf-0fb6be4719df', '022427ba-adfd-4c4f-8821-b50654371d4d', '3f437eaa-75e5-4e88-b1f1-dd77e83213d3', '969da1de-952a-4489-a271-17c6a08d8fef', '7a6598e3-3b46-41d2-b710-c60ba07728f5', '74BDBB75-26DE-4DB6-B57E-29FAB562DB1E', N'OrderProduct', GetUTCDate(), N'xxxxxxxxx’, GetUTCDate(), N’xxxxxxxxxx’, '<Key><T>PersonWantsOrg</T><P>7a6598e3-3b46-41d2-b710-c60ba07728f5</P></Key>')

    [810143] Database error 2627: detected in (SRV=WT0BV-OIAP001, DB=OneIdentity911) Procedure QER_TIPersonWantsOrg, Line 10
        [810143] Database error 2627: Violation of PRIMARY KEY constraint 'PK__DialogPr__2B66FD777B7C4559'. Cannot insert duplicate key in object 'dbo.DialogProcess'. The duplicate key value is (FE184DA2-365A-430A-B437-E6B04E40D684).

    After this, the pwo is still created but at the next process try.

    Can you give me some clues? Which could be the problem? Is not that painful as at the end the pwo is created, but we cannot understand the reason the first deferred always go broke.

     

    Thanks again, a lot

    a

  • I might have missed that but we are talking about what version of OneIM?

Reply Children