Class ActionItemApi.ActionItemBuilder
- Enclosing class:
ActionItemApi
-
Constructor Summary
ConstructorDescriptionActionItemBuilder
(FormulaEngineContext ctx, Long id, ActionItemManager actionItemManager) ActionItemBuilder
(FormulaEngineContext ctx, ActionItemManager actionItemManager) -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Finishes the create operation.void
doDelete()
Finishes the delete operation.Alias fordoRecalculate()
.Recalculates the Action Item with the specified id.doUpdate()
Finishes the update operation.setAssignedTo
(Long assignedToId) Assigns the Action Item to the user (specified by Id).setAttributeExtension
(Map<String, Object> attributeExtension) Adds a customattributeExtension___key:value
field to the ActionItem or replaces an existing one – performs a full replacement of theattributeExtension
map (does not update specific keys or values).setAttributeExtensionValue
(String name, Object value) Updates the value of an existingattributeExtension___key:value
field or creates a new one.setAttributeValue
(String attributeName, Object value) Sets the value of the specified 'attributeXX' column of the ActionItem class.
Example:setDescription
(String description) Sets the description of the Action Item (AI).setDueDate
(Date dueDate) Sets the due date of the Action Item (AI).setOriginatorTypedId
(String originatorTypedId) Sets theOriginatorTypedId
(link to the originator document) of the Action Item.setParentTabName
(String parentTabName) Sets the dynamicTab where the Action Item is displayed.setParentTypedId
(String parentTypedId) Sets the parent object (specified bytypedId
) of the action item.setSourceContext
(String sourceContext) Inserts the specified JSON to the sourceContext field.Sets the Status of the Action Item (AI).setSummary
(String summary) Sets the Summary field (a title) of the Action Item (AI).setTargetContext
(String targetContext) Inserts the specified JSON to the targetContext field.Sets the Action Item Type (AIT) of the Action Item (AI).
-
Constructor Details
-
ActionItemBuilder
public ActionItemBuilder(FormulaEngineContext ctx, ActionItemManager actionItemManager) -
ActionItemBuilder
-
-
Method Details
-
setSummary
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 aString
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setType
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 aString
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
- See Also:
-
setDueDate
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 aDate
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setAssignedTo
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 aLong
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setDescription
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 aString
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setStatus
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 aString
. Possible values: "OPEN", "DONE", "REJECTED", "BLOCKED", "POSTPONED"- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setParentTypedId
Sets the parent object (specified bytypedId
) 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 aString
- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.0 - Paper Plane
-
setAttributeExtension
Adds a customattributeExtension___key:value
field to the ActionItem or replaces an existing one – performs a full replacement of theattributeExtension
map (does not update specific keys or values). To update a particular value, use thesetAttributeExtensionValue(java.lang.String, java.lang.Object)
instead.setAttributeExtension
might be useful for setting theattributeExtension
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
Updates the value of an existingattributeExtension___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 thesetAttributeExtension(Map)
instead.Example:
def actionItem = api.actionItemApi().withId(actionItemId) .setSummary("A title") .setType("__DEFAULT__") .setAttributeExtensionValue("key1", "updatedValue") .doUpdate()
- Parameters:
name
- existing field namevalue
- new value- Returns:
- The instance of
ActionItemApi.ActionItemBuilder
- Since:
- 11.1 - Paper Plane
- See Also:
-
setOriginatorTypedId
Sets theOriginatorTypedId
(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
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 withParentTabName
.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
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
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
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
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
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 XExpressionFinishes 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
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
Alias fordoRecalculate()
.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:
-