Class ContractHelper

Object
LineItemHelper
ContractHelper
All Implemented Interfaces:
Reviewable

public class ContractHelper extends LineItemHelper implements Reviewable
A helper class that assists in manipulating the contract object. An instance of this class can be obtained via call cProcessor.getHelper() from contract header logic.

Recommended Reading:

To understand how calculation logics in contracts work please read the article Contract Calculation Logic Details.

Example:


  def isHighPriority = cProcessor.getHelper().getRoot().getInputByName("IsHighPriority")?.value
 
See Also:
  • Constructor Details

  • Method Details

    • findAllWithContractTermTypeUN

      public List<LineItemHelper.LineItem> findAllWithContractTermTypeUN(String contractTermTypeUN)
      Finds all contract line items with the specified contract term type.
      Parameters:
      contractTermTypeUN - unique name of contract term type
      Returns:
      list of line items LineItemHelper.LineItem

      Example:

      
        def lineItems = cProcessor.getHelper().findAllWithContractTermTypeUN("BundleUp")
        lineItems.each { api.logInfo("line item label", it.label )}  // Bundle Up
       
    • isInReview

      public boolean isInReview()
      Checks if the user who triggered the calculation can do the review of the line items.

      Example:

      
       if (cProcessor.getHelper().isInReview()) {
           // Execute review-specific validation or calculations
       }
       
      Specified by:
      isInReview in interface Reviewable
      Returns:
      true if the contract is in a review workflow step and there is active review sub step for the current user, false otherwise
    • getReviewSubStep

      public LineItemHelper.ReviewSubStep getReviewSubStep()
      Gets the current review sub-step information.

      Example:

      
       def helper = cProcessor.getHelper()
       if (helper.isInReview()) {
           def label = helper.getReviewSubStep().label
           def userGroupName = helper.getReviewSubStep().userGroupName
       }
       
      Specified by:
      getReviewSubStep in interface Reviewable
      Returns:
      The review sub-step or null if the user is not in review
    • getItemsForReview

      public List<LineItemHelper.LineItem> getItemsForReview()
      Gets a list of line items that are assigned to the current user for review.

      This method returns the line items that are part of the current user's review scope. Only line items that have an active review assignment for the current user's review user group are included.

      Example:

      
       def helper = cProcessor.getHelper()
       if (helper.isInReview()) {
           def itemsForReview = helper.getItemsForReview()
           for (item in itemsForReview) {
               // Process each line item assigned for review
               api.logInfo("Reviewing item", item.lineId)
           }
       }
       
      Specified by:
      getItemsForReview in interface Reviewable
      Overrides:
      getItemsForReview in class LineItemHelper
      Returns:
      A list of LineItemHelper.LineItem objects for the current user's review, or an empty list if not in review or no items are assigned