Verify Source Code in Pricing Algorithms

You can click View Source to verify the source code of a pricing algorithm.

  1. Go to the Pricing Administration work area, then click Tasks > Manage Algorithms.

  2. On the Manage Algorithms page, locate the algorithm you must modify.

  3. Click Actions > Create Version.

  4. Modify the pricing algorithm so it meets your requirements.

  5. Along the top of the Edit Algorithm page, Click View Source, then make sure the dialog that displays includes this message.

    The following script has passed syntax check

    For example:

    view source dialog for price sales transactions

Note

  • View Source examines and validates your syntax. It then displays the Groovy code that defines the algorithm in a dialog.

  • Use it before you publish your pricing algorithm.

  • You can also use it to get a complete picture of how you set up the algorithm, or to troubleshoot between versions of the algorithm.

  • For example, copy the source code of the working version and of the nonworking version, paste it into a code comparison application, then examine the difference to help identify the code that might be causing the problem.

Here's some code that includes the kind of details that are available when you click View Source.

//=====================================================================
// Price Sales Transactions
// Version: 2
// Start: 2016-12-07 22:47:02.528
// End: 
// Description: Calculates prices for Sales documents (Quotes, Sales Agreements, Orders).
// Version 2 Comments: Calculates prices for Sales documents (Quotes, Sales Agreements, Orders).
//=====================================================================

variables {
    PriceRequest(ioType:'InOut', type:'DataObject', required:true, context:'PricingInternal.PriceRequestInternal')
    PerformCurrencyConversion(ioType:'None', type:'Boolean', required:false, defaultValue:false)
    IsNonGsaCustomer(ioType:'None', type:'Boolean', required:false, defaultValue:true)
    CalculateGSAPrice(ioType:'None', type:'Boolean', required:false, defaultValue:false)
    PassedInEntities(ioType:'None', type:'DataObject', required:false, context:'PricingInternal.PriceRequestInternal')
}

// Step "Set Initial Values" - block
step('Set Initial Values'){
    // Step "Initialize" - SubAlgorithm
    step('Initialize'){
        subAlgorithm(name:'Set Initial Values')
        .input ('EnableCache':false,'PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Process and Split Passed In Charges" - if
step('Process and Split Passed In Charges', if:{PriceRequest.Charge.size() > 0}){
    // Step "Process Passed In Charges and Charge Components" - SubAlgorithm
    step('Process Passed In Charges and Charge Components'){
        subAlgorithm(name:'Process Passed In Charges')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
    // Step "Split Passed In Charge Components" - Split
    //    Moves all the passed-in charge components that have been retained after processing to a separate SDO.
    step('Split Passed In Charge Components'){
        splitDocument().from(PriceRequest.ChargeComponent).as('Comp').to(PassedInEntities.ChargeComponent).where{true}
    }
    // Step "Split Passed In Charges" - Split
    //    Moves all the passed-in charges that have been retained after processing to a separate SDO.
    step('Split Passed In Charges'){
        splitDocument().from(PriceRequest.Charge).as('Charge').to(PassedInEntities.Charge).where{true}
    }
}

// Step "Derive and Validate Strategy" - block
step('Derive and Validate Strategy'){
    // Step "Derive Pricing Strategy" - SubAlgorithm
    step('Derive Pricing Strategy'){
        subAlgorithm(name:'Get Sales Pricing Strategy')
        .input ('InvokeFromPriceSalesTransactions':true,'PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
    // Step "Validate Pricing Strategy" - SubAlgorithm
    step('Validate Pricing Strategy'){
        subAlgorithm(name:'Validate Pricing Strategy')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Validate Passed Pricing Terms" - block
step('Validate Passed Pricing Terms'){
    // Step "Validate Pricing Terms" - SubAlgorithm
    step('Validate Pricing Terms'){
        subAlgorithm(name:'Validate Pricing Terms')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Validate Override Currencies" - block
step('Validate Override Currencies'){
    // Step "Validate Override Currency" - SubAlgorithm
    //    Invoke the sub-algorithm 'Validate Override Currencies'
    step('Validate Override Currency'){
        subAlgorithm(name:'Validate Override Currencies')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Get Charge Candidates For Coverages Goods and Services" - block
step('Get Charge Candidates For Coverages Goods and Services'){
    // Step "Get Price List and Charge Candidates" - SubAlgorithm
    step('Get Price List and Charge Candidates'){
        subAlgorithm(name:'Get Base List Price for Goods and Services')
        .input ('CreateChargesFlag':false,'DerivePriceListFlag':true,'ElementParam':'QP_BASE_LIST_PRICE','GetChargeCandidatesFlag':true,'PriceRequest':PriceRequest)
        .output ('PerformCurrencyConversion':'PerformCurrencyConversion','PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Calculate Pricing Charges For Covered Items" - block
//    This step invokes the algorithm to calculate pricing charges for covered items to derive the percentage-based coverage prices.
step('Calculate Pricing Charges For Covered Items'){
    // Step "If CoverageAssociations Exist" - if
    //    Calculate Covered Item Prices if there are CoverageAssociations
    step('If CoverageAssociations Exist', if:{PriceRequest.CoverageAssociation.size() > 0}){
        // Step "Calculate Covered Item Charges" - SubAlgorithm
        step('Calculate Covered Item Charges'){
            subAlgorithm(name:'Calculate Covered Item Charges')
            .input ('PriceRequest':PriceRequest)
            .output ('PriceRequest':'PriceRequest')
            .run()
        }
    }
}

// Step "Calculate Pricing Charges For Coverages Goods and Services" - block
//    Call Calculate Pricing Charges where in Get Base
//    skip Derive PL and Get Charge Candidates, only Create Charges, but process rest of the ListPrice thru Margin Calculations
step('Calculate Pricing Charges For Coverages Goods and Services'){
    // Step "Calculate Pricing Charges" - SubAlgorithm
    //    This step invokes the algorithm to calculate pricing charges.
    step('Calculate Pricing Charges'){
        subAlgorithm(name:'Calculate Pricing Charges')
        .input ('CreateChargesFlag':true,'DerivePriceListFlag':false,'GetChargeCandidatesFlag':false,'PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Merge If Charges Passed In" - if
step('Merge If Charges Passed In', if:{PassedInEntities.Charge.size() > 0 && finer('Merging back passed-in charges and charge components') == null}){
    // Step "Merge Back Passed In Charges" - Merge
    //    Merges back the passed in Charge Components into Price Request SDO
    step('Merge Back Passed In Charges'){
        mergeDocument().from(PassedInEntities.Charge).to(PriceRequest.Charge)
    }
    // Step "Merge Back Passed In Charge Components" - Merge
    //    Merges back the passed in Charge Components into Price Request SDO
    step('Merge Back Passed In Charge Components'){
        mergeDocument().from(PassedInEntities.ChargeComponent).to(PriceRequest.ChargeComponent)
    }
}

// Step "Calculate Shipping Charges For Goods and Services" - block
step('Calculate Shipping Charges For Goods and Services'){
    // Step "Calculate Shipping Charges" - SubAlgorithm
    //    Call 'Calculate Shipping Charges' Algorithm
    step('Calculate Shipping Charges'){
        subAlgorithm(name:'Calculate Shipping Charges')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Populate Charge Component Explanation Messages" - block
//    This step populates explanation messages on charge components.
step('Populate Charge Component Explanation Messages'){
    // Step "Populate Explanation Messages" - SubAlgorithm
    //    This step invokes the algorithm to populate explanation messages for charge components.
    step('Populate Explanation Messages'){
        subAlgorithm(name:'Populate Charge Component Explanation Message')
        .input ('BaseListPriceElementCode':'QP_BASE_LIST_PRICE','PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Process Returns" - block
step('Process Returns'){
    // Step "Process Returns With Reference" - SubAlgorithm
    //    This step creates the refund charges for return lines.
    step('Process Returns With Reference'){
        subAlgorithm(name:'Process Returns with Reference')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}

// Step "Set Final Values" - block
step('Set Final Values'){
    // Step "Finalize" - SubAlgorithm
    step('Finalize'){
        subAlgorithm(name:'Set Final Values')
        .input ('PriceRequest':PriceRequest)
        .output ('PriceRequest':'PriceRequest')
        .run()
    }
}