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
  • I Markus, it is always good to hear from you!

    I’ll definitely try what you suggested, but just for your info, the ISingleDbObject does not create problem when I create or update the pwo from inside the deferred operation.

    I’ll keep you updated as soon as I try the entity.

     

    Thanks a lot

    a

Reply Children
No Data