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

  • Thank you Markus, your commitment is always precious and reliable.

    But please let me dig a little bit in this subject. When I buy a pwo from inside a deferred block, the system let me do that even if the person is not in the itshop where the product is published. Only once the deferred is executed I got the exception so I was wondering if there is a robust way to check if the pwo I’m about to submit is legitimate and then submit it as deferred.

    As usual thanks in advance

    a

  • With the help of my awesome colleague (thanks HB!) .....

    To answer the question "is this PWO valid", you would have to make so many checks that are distributed across format rules and customizers that I would recommend to

    • Commit the e1ntity in an open transaction.
    • This is either successful or not
    • The transaction must then be rolled back.
    • Then you should put an equally populated entity in a DeferredOperation. (not the same one that was used for the test before - that won't work

    If only the authorization is relevant, the statement returns a result if the person can order it:

    select * from QER_FTPWOOrderPerson('uid_person','uid_itshoporgpr', 'uid_accproduct',
    null, --validfrom
    null --validuntil
    )

  • Markus, thanks it worked as you said! Again, thank you.

    a