V92. Using the new request properties to generate different PWO's

In ITShop, I have a QERReuseUS attached to a Service Item with a multivalued request property. Once ordered, I need to split it into different requests for the same QERReuseUS. Each individual PWO must store a property value from the requests properties. Then I must delete the original order.  

Example:

Resource: CompanyCars

Request Property (multivalued): Locations

The user requests CompanyCars for locations A, B and C

There are three PWO's that must be dealt with for the user: CompanyCars in location A, CompanyCars in location B, CompanyCars in location C

I'm struggling to find the proper place to insert my logic:

  • PersonWantsOrg table scripts.
  • PersonWantsOrg insert process

Anyone has a similar scenario? Would you share your thoughts?

Thanks!

Parents
  • Hello Juan Carlos,

    I haven't implimented this scenario, but maybe this will help.

    Proces on PersonWantOrg triggers when QERReuseUS product is inserted and approved.

    Outline of the script run by proces:

    'Get paramvalues
    QER_Get_ParameterValue_Of_ParameterSet_Of_PWO(pwoKey, paramName)

    'Maps location to the product (UidITShopOrg):

    paramvalue                       product (UidITShopOrg)
    location A                            CompanyCars in location A
    location B                            CompanyCars in location B

    - For each selected location create a new product order
    CCC_CreateITShopRequestProduct (UidPerson , UidITShopOrg, Reason)

    Public Sub CCC_CreateITShopRequestProduct(
        ByVal UidPerson As String,
        ByVal UidITShopOrg As String,
    	Optional ByVal Reason As String = "")
        
        Dim f As ISqlFormatter = Session.SqlFormatter
        
        Dim orderStates() As String = {"OrderProduct", "OrderProlongate", "OrderUnsubscribe", "Assigned", "Granted", "Waiting"}
        If Session.Source().Exists(    
                                "PersonWantsOrg", _
                                f.AndRelation( _
                                    f.UidComparison("UID_PersonOrdered", UidPerson),
                                    f.UidComparison("UID_Org", UidITShopOrg),
                                    f.InClause("OrderState", ValType.String, FormatterOptions.NonUnicodeLiterals, orderStates)
                                )) Then Exit Sub
        
    	If String.IsNullOrEmpty(Reason) Then Reason = "I need a car to get to this location"							
    
        Dim pwo = Session.Source.CreateNew("PersonWantsOrg")
        Dim bag As New PropertyBag()
        bag.PutValue("UID_PersonInserted", UidPerson)
        bag.PutValue("UID_PersonOrdered", UidPerson)
        bag.PutValue("UID_Org", UidITShopOrg)
        bag.PutValue("OrderReason", Reason)
        pwo.CallMethod("FillOrder", bag)
        pwo.Save(Session)
    End Sub



Reply
  • Hello Juan Carlos,

    I haven't implimented this scenario, but maybe this will help.

    Proces on PersonWantOrg triggers when QERReuseUS product is inserted and approved.

    Outline of the script run by proces:

    'Get paramvalues
    QER_Get_ParameterValue_Of_ParameterSet_Of_PWO(pwoKey, paramName)

    'Maps location to the product (UidITShopOrg):

    paramvalue                       product (UidITShopOrg)
    location A                            CompanyCars in location A
    location B                            CompanyCars in location B

    - For each selected location create a new product order
    CCC_CreateITShopRequestProduct (UidPerson , UidITShopOrg, Reason)

    Public Sub CCC_CreateITShopRequestProduct(
        ByVal UidPerson As String,
        ByVal UidITShopOrg As String,
    	Optional ByVal Reason As String = "")
        
        Dim f As ISqlFormatter = Session.SqlFormatter
        
        Dim orderStates() As String = {"OrderProduct", "OrderProlongate", "OrderUnsubscribe", "Assigned", "Granted", "Waiting"}
        If Session.Source().Exists(    
                                "PersonWantsOrg", _
                                f.AndRelation( _
                                    f.UidComparison("UID_PersonOrdered", UidPerson),
                                    f.UidComparison("UID_Org", UidITShopOrg),
                                    f.InClause("OrderState", ValType.String, FormatterOptions.NonUnicodeLiterals, orderStates)
                                )) Then Exit Sub
        
    	If String.IsNullOrEmpty(Reason) Then Reason = "I need a car to get to this location"							
    
        Dim pwo = Session.Source.CreateNew("PersonWantsOrg")
        Dim bag As New PropertyBag()
        bag.PutValue("UID_PersonInserted", UidPerson)
        bag.PutValue("UID_PersonOrdered", UidPerson)
        bag.PutValue("UID_Org", UidITShopOrg)
        bag.PutValue("OrderReason", Reason)
        pwo.CallMethod("FillOrder", bag)
        pwo.Save(Session)
    End Sub



Children
  • Hello, Niels,

    Thanks for your help. I've spent the last few days trying to figure out the best option for this. And I needed some light. Beware the TL:DR ahead xD

    The first thought was split the cart item into different items , each with a location, and that worked. Before I had to deal with the Angular code and a way to mark the cart items as "completed" somehow when they have parameters, before sending them to the cart. Then I realized that once in the cart, the operator still could change the assigned location. So I moved to the Personwantsorg idea. But where? Process or table? Table was a complete headache, moreover if you're using the new portal and need to reset iis after every change, you dont know what's caching , what is not. So I started the process idea:

    1. The original request is marked as "Is_Multilocation". I want to use this idea for other business cases in my scenario.
    2. The insert process, among other,  checks for a "Is_Multilocation" order and splits it in their corresponding same_inserted, same_ordered, same_qerreuse, displayorg+"in location X" for each location records.Also adds a mark with the location uid so the workflow knows where the approval process must go. Finally these child records are not marked as "Is_Multilocation". 
    3. Delete the original request.

    Your code has helped a lot. I didn't have any idea about the new script for dealing with the params. It wasn't hard to do it manually but the script is a great tool.

    Time to fill those bags.

    Thanks again!!

  • About resetting IIS, this is my favorite shortcut since I started with new angular portal ;-)
    %windir%\system32\inetsrv\appcmd.exe recycle APPPOOL "ApiServerDev_POOL"

  • LOL! My desktop icon for that is worn out xD