Class ActionItemApi.ActionItemBuilder

Object
ActionItemBuilder
Enclosing class:
ActionItemApi

public static class ActionItemApi.ActionItemBuilder extends Object
  • Constructor Details

    • ActionItemBuilder

      public ActionItemBuilder(FormulaEngineContext ctx, ActionItemManager actionItemManager)
    • ActionItemBuilder

      public ActionItemBuilder(FormulaEngineContext ctx, Long id, ActionItemManager actionItemManager)
  • Method Details

    • setSummary

      public ActionItemApi.ActionItemBuilder setSummary(String summary)
      Sets the Summary field (a title) of the Action Item (AI). This field is required. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A brief title of the Action Item")
         .setType("__DEFAULT__")
         .setAssignedTo(userId)
         .setDueDate(dueDate)
         .create()
         
      Parameters:
      summary - Action Item's title as a String
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setType

      public ActionItemApi.ActionItemBuilder setType(String actionItemType)
      Sets the Action Item Type (AIT) of the Action Item (AI). This field is required. Information: Action Item Types can be added or edited via UI: Administration > Configuration > Actions > Action Types Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title of the Action Item")
         .setType("__DEFAULT__")
         .setAssignedTo(userId)
         .create()
         
      Parameters:
      actionItemType - The type of the Action Item as a String
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
      See Also:
    • setDueDate

      public ActionItemApi.ActionItemBuilder setDueDate(Date dueDate)
      Sets the due date of the Action Item (AI). Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example – adds the ActionItem when a new Custom Form is created:

      
       if (customFormProcessor.isPrePhase()) {
      
       def year = 2023
       def month = Calendar.JUNE
       def day = 17
      
       def calendar = api.calendar()
       calendar.set(year, month, day)
       def dueDate = calendar.getTime()
      
      
      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("summary 12")
         .setType("__DEFAULT__")
         .setAssignedTo(2147490696)
         .setDueDate(dueDate)
         .create()
      
       }
       
      Parameters:
      dueDate - The due date of the Action Item as a Date
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setAssignedTo

      public ActionItemApi.ActionItemBuilder setAssignedTo(Long assignedToId)
      Assigns the Action Item to the user (specified by Id). This field is required. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def assigneeId = 2147490696
      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setAssignedTo(assigneeId)
         .create()
       
      Parameters:
      assignedToId - The Id of the user as a Long
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setDescription

      public ActionItemApi.ActionItemBuilder setDescription(String description)
      Sets the description of the Action Item (AI). Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setAssignedTo(2147490696)
         .setDueDate(dueDate)
         .setDescription("A comprehensive description of the action.")
         .create()
       
      Parameters:
      description - A detailed description of the action as a String
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setStatus

      public ActionItemApi.ActionItemBuilder setStatus(String status)
      Sets the Status of the Action Item (AI). Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setAssignedTo(2147490696)
         .setStatus("REJECTED")
         .create()
       
      Parameters:
      status - The status of the action as a String. Possible values: "OPEN", "DONE", "REJECTED", "BLOCKED", "POSTPONED"
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setParentTypedId

      public ActionItemApi.ActionItemBuilder setParentTypedId(String parentTypedId)
      Sets the parent object (specified by typedId) of the action item. The parent object can be, for example, a Custom Form, where the Action was created. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setParentTypedId("123.CFO")
         .create()
       
      Parameters:
      parentTypedId - The typedId of the parent object as a String
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setAttributeExtension

      public ActionItemApi.ActionItemBuilder setAttributeExtension(Map<String,Object> attributeExtension)
      Adds a custom attributeExtension___key:value field to the ActionItem or replaces an existing one – performs a full replacement of the attributeExtension map (does not update specific keys or values). To update a particular value, use the setAttributeExtensionValue(java.lang.String, java.lang.Object) instead.

      setAttributeExtension might be useful for setting the attributeExtension from scratch or for mass actions.

      Information: To view the attributeExtension via UI, add the attribute extension field first – navigate to the ActionItem header context menu (three dots next to the column label) > Customize Attribute Extension. Add the name of the AttributeExtension key you want to display in the table.
      Otherwise, AttributeExtension fields are stored in the database only and are not visible in the user interface. AttributeExtension fields can be fetched with the given ActionItem object.

      Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       if (api.isInputGenerationExecution()) {
           return null
       } else {
           def actionItem = api.actionItemApi().newActionItem()
                   .setSummary("A title")
                   .setType("__DEFAULT__")
                   .setAttributeExtension(["key1": "value1", "key2": "value2"])
                   .create()
       }
       
      Parameters:
      attributeExtension - A map of additional custom attributes of the Action Item
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
      See Also:
    • setAttributeExtensionValue

      public ActionItemApi.ActionItemBuilder setAttributeExtensionValue(String name, Object value)
      Updates the value of an existing attributeExtension___key:value field or creates a new one.

      Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.
      For mass operations (to add multiple keys and values to the object), use the setAttributeExtension(Map) instead.

      Example:

      
       def actionItem = api.actionItemApi().withId(actionItemId)
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setAttributeExtensionValue("key1", "updatedValue")
          .doUpdate()
       
      Parameters:
      name - existing field name
      value - new value
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.1 - Paper Plane
      See Also:
    • setOriginatorTypedId

      public ActionItemApi.ActionItemBuilder setOriginatorTypedId(String originatorTypedId)
      Sets the OriginatorTypedId (link to the originator document) of the Action Item. Watchers, which create the actions, use this link to link an Action to the originating Watcher (where parent is used for Action Plans). Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setOriginatorTypedId("123.MO")
         .create()
       
      Parameters:
      originatorTypedId - typedId of the Originator Document
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setParentTabName

      public ActionItemApi.ActionItemBuilder setParentTabName(String parentTabName)
      Sets the dynamicTab where the Action Item is displayed. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Note: parentTypedId must be set together with ParentTabName.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setParentTypedId("90.DP")
         .setParentTabName("assessment/actions")
         .create()
       
      Parameters:
      parentTabName - The name of the dynamicTab where the Action Item is displayed.
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setTargetContext

      public ActionItemApi.ActionItemBuilder setTargetContext(String targetContext)
      Inserts the specified JSON to the targetContext field. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setTargetContext("""
         {
         "pricingStrategy": {
           "name": "Improved Pricing",
           "description": "Setting the price of a product higher to suggest a higher quality",
           "appliedTo": [
             {
               "product": "Super Deluxe Product",
               "basePrice": 2000,
               "premiumMultiplier": 1.5
             },
             {
               "product": "Ultra Deluxe Product",
               "basePrice": 3000,
               "premiumMultiplier": 1.8
             }
           ],
           "discounts": [
             {
               "type": "Volume Discount",
               "description": "Discount applied for purchasing large quantities",
               "minQuantity": 10,
               "discountPercent": 10
             },
             {
               "type": "Seasonal Discount",
               "description": "Discount applied during specific seasons",
               "seasons": ["Winter", "Summer"],
               "discountPercent": 15
             }
           ]
         }
       }
         """)
         .create()
       
      Parameters:
      targetContext - Any data in the JSON format.
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setSourceContext

      public ActionItemApi.ActionItemBuilder setSourceContext(String sourceContext)
      Inserts the specified JSON to the sourceContext field. Note: This operation only works in contexts that allow object modification. This method cannot be used in a distributed calculation. Do not use within the input generation mode.

      Example:

      
       def actionItem = api.actionItemApi().newActionItem()
         .setSummary("A title")
         .setType("__DEFAULT__")
         .setTargetContext("""
         {
         "DetectedInsight": {
           "m1": 293285.30809334,
           "ProductId": "BR1600SI",
           "PricingDate": "2023-02-14T00:00:00"
         },
         "InitialDashboardValues": {}
       }
         """)
         .create()
       
      Parameters:
      sourceContext - Data (that should inform a user why this action has been created) in the JSON format.
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.0 - Paper Plane
    • setAttributeValue

      public ActionItemApi.ActionItemBuilder setAttributeValue(String attributeName, Object value)
      Sets the value of the specified 'attributeXX' column of the ActionItem class.
      Example:
      
               def actionItem = api.actionItemApi().newActionItem()
                 .setAttributeValue("attribute1", "meatball01")
                 .create()
       
      Parameters:
      attributeName - The name of the attribute column to update.
      value - The value of the attribute.
      Returns:
      The instance of ActionItemApi.ActionItemBuilder
      Since:
      11.1 - Paper Plane
    • create

      public Object create() throws XExpression
      Finishes the create operation. When this is executed, the action item will be created in the database. Operation is not allowed in the Input Generation (formerly syntax check) mode or if object modifications are not allowed.
      Returns:
      the action item or null if operation is not allowed
      Throws:
      XExpression - if error occurs
    • doUpdate

      public Object doUpdate() throws XExpression
      Finishes the update operation. When this is executed, the action item will be updated in the database. Operation is not allowed in syntax check mode or if object modifications are not allowed.

      Example – updates the existing Action Item:

      
       def actionItemId = 123
      
       def actionItem = api.actionItemApi().withId(actionItemId)
           .setSummary("An updated summary.")
           .doUpdate()
       
      Returns:
      the action item or null if operation is not allowed
      Throws:
      XExpression - if error occurs
    • doDelete

      public void doDelete() throws XExpression
      Finishes the delete operation. When this is executed, the action item will be deleted from the database. Operation is not allowed in syntax check mode or if object modifications are not allowed.

      Example – deletes the specified Action Item:

      
       def actionItemId = 123
      
       def actionItem = api.actionItemApi().withId(actionItemId)
           .doDelete()
       
      Throws:
      XExpression - if error occurs
    • doRecalculate

      public Object doRecalculate() throws XExpression
      Recalculates the Action Item with the specified id.

      Example:

      
               if (api.isInputGenerationExecution()) return
      
               actionItemApi.withId(actionItem.id)
                 .doRecalculate()
       
      Returns:
      an Object representation of the recalculated Action Item, including the 'results' attribute generated during the recalculation, or null if the recalculation failed.
      Throws:
      XExpression - if the Action Item or its type, or its formula was not found, or if the recalculation failed
      Since:
      12.0 - Clover Club
    • doExecute

      public Object doExecute() throws XExpression
      Alias for doRecalculate().

      Example:

      
               if (api.isInputGenerationExecution()) return
      
               actionItemApi.withId(actionItem.id)
                 .doExecute()
       
      Returns:
      an Object representation of the recalculated Action Item, including the 'results' attribute generated during the recalculation, or null if the recalculation failed
      Throws:
      XExpression - if the Action Item or its type, or its formula was not found, or if the recalculation failed
      See Also: