This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PWO FillOrder raises error in v7.1.1 (call only internally)

Hi all

I used a script in v6 to add Orders which are directly assigned, therewith no approver is needed.

This was done by:

   Dim Bag As New PropertyBag()
   Bag.PutValue("UID_PersonOrdered", UID_Person)
   Bag.PutValue("UID_PersonInserted", UID_Person)
   Bag.PutValue("UID_Org", UID_OrgPr)
   Bag.PutValue("OrderReason", OrderReason)
   Bag.PutValue("OrderState", "Assigned")
   Bag.PutValue("ValidUntil", ValidUntil)

   Dim dbPWO As ISingleDbObject = Connection.CreateSingle("PersonWantsOrg")
   dbPWO.Custom.CallMethod("FillOrder", Bag)

Now in v7.1.1 I receive the error when calling FillOrder:

[2133323] This method can only be called internally.
at QER.Customizer.PersonWantsOrg.FillOrder(ISession session, IEntity entity, PropertyBag propBag, CancellationToken ct)

How can I create an order with the orderstate=Assigned in v7? One Forumentry here refers to the same Problem but the solution was to create an Order which has to be approved, which does not work in my case. Is there a new method I should use?

By the way, I received the error while the Job was processed by the JobQueue, not in designer. (As far as I know, when Debugging in the designer, this method does not work, but when called from the Service, it should)

Thanks for your help,

Kind regards,
Rolf

 

  • Can you post the parameters of the job executing this script? Perhaps there is a misconfiguration there.

    And, in addition, is your Job Service - executing the script - directly connected to the database or are you using an Application Server connection for the service?

  • Hello Rolf,

    I think, your script is been executing from a custom process.
    Could you check the Authentication String from the executing process step.

    In the migration from 7.0 to 7.1 all custom processes have been added "Value = QBM_GetCurrentUserAuth(ConnectionInfo)" for the Authentication string, and this might be the reason, why the script is not executed anymore by the internal "sa" account.
  • Hi Rolf,

    did you get it working? I tried to call the FillOrder method with version 7 without success too. At the end I used the CreateITShopOrder method.
    You first have to load your direct assignment (if there is no direct assignment you have to create it) and then call the CreateITShopOrder method. This method creates an auto-approved order (status assigned) for the assignment and removes the direct assignment.
    Here is some sample code (in this case for ESet assignment)

    Dim dbPersonHasEset As ISingleDbObject = Connection.CreateSingle("PersonHasEset")
    dbPersonHasEset.PutValue("UID_ESet", sUID_ESet)
    dbPersonHasEset.PutValue("UID_Person", sUID_Person)
    dbPersonHasEset.Load()
    dbPersonHasEset.Custom.CallMethod("CreateITShopOrder", "CCC_CreateITShopOrderAttributes")
    dbPersonHasEset.Save

    You have to create the referenced CCC_CreateITShopOrderAttributes function to define attributes like OrderReason, UID_PersonOrdered..

    Hope that helps.

    Regards
    Chris
  • Hello Chris,

    I get it working to call the "FillOrder" Method in v7.1.1
    After calling the method, you need to save the dbPWO object:

    dbPWO.Custom.CallMethod("FillOrder", Bag)
    dbPWO.Save()

    HtH Fatih
  • Hi Chris,

    I could solve it by saving the object as Faith did. I guess the combination of saving and the AuthString did the trick.

    I also changed
    - dbPWO As ISingleDbObject to
    - iPWO As IEntity = Session.Source.CreateNew("PersonWantsOrg)

    regards,
    Rolf