Codeunit "Agent Task Message Builder"
This codeunit is used to create an agent task message.
Properties
| Name | Value |
|---|---|
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Initialize
Initialize the agent task message builder with the mandatory parameter. From value will be set to the current user.
procedure Initialize(MessageText: Text): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| MessageText | Text |
The text of the message. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
Initialize
Initialize the agent task message builder with the mandatory parameters.
procedure Initialize(From: Text[250]; MessageText: Text): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| From | Text[250] |
Text indicating the sender of the message. |
| MessageText | Text |
The text of the message. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
SetIgnoreAttachment
Set whether to ignore attachments for the message. When set to true, attachments will be marked as ignored and will not be processed by the agent. The default value is false.
procedure SetIgnoreAttachment(IgnoreAttachment: Boolean): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| IgnoreAttachment | Boolean |
Specifies if attachments should be ignored. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
SetMessageExternalID
Set the external ID of the task.
procedure SetMessageExternalID(ExternalId: Text[2048]): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| ExternalId | Text[2048] |
The external ID of the task. This field is used to connect to external systems, like Message ID for emails. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
SetAgentTask
Set the agent task for which to create the message.
procedure SetAgentTask(ParentAgentTask: Record "Agent Task"): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| ParentAgentTask | Table System.Agents."Agent Task" |
The agent task to set the message to. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
SetAgentTask
Set the agent task for which to create the message.
procedure SetAgentTask(ParentAgentTaskID: BigInteger): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| ParentAgentTaskID | BigInteger |
The ID of the agent task to set the message to. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
Create
Creates the task message. Task will be marked as ready and be picked up for processing after message is created.
procedure Create(): Record "Agent Task Message"
Returns
| Type | Description |
|---|---|
| Table System.Agents."Agent Task Message" |
The created task message. |
Remarks
The builder keeps the state, do not reuse the same instance of the builder to create multiple tasks.
Create
Creates the task message.
procedure Create(SetTaskStatusToReady: Boolean): Record "Agent Task Message"
Parameters
| Name | Type | Description |
|---|---|---|
| SetTaskStatusToReady | Boolean |
Specifies if the task should be marked as ready for processing after the message is created. If set to false, the task will not be marked as ready and will not be picked up for processing. |
Returns
| Type | Description |
|---|---|
| Table System.Agents."Agent Task Message" |
The created task message. |
Remarks
The builder keeps the state, do not reuse the same instance of the builder to create multiple tasks.
GetAgentTaskMessage
Get the agent task message record.
procedure GetAgentTaskMessage(): Record "Agent Task Message"
Returns
| Type | Description |
|---|---|
| Table System.Agents."Agent Task Message" |
The agent task message that was created. |
AddAttachment
Attach a file to the task message. The file will be attached when the message is created. It is possible to attach multiple files to the message.
procedure AddAttachment(FileName: Text[250]; FileMIMEType: Text[100]; InStream: InStream): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| FileName | Text[250] |
The name of the file to attach. |
| FileMIMEType | Text[100] |
The MIME type of the file to attach. |
| InStream | InStream |
The stream of the file to attach. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
AddAttachment
Attach a file to the task message. The file will be attached when the message is created. It is possible to attach multiple files to the message.
procedure AddAttachment(FileName: Text[250]; FileMIMEType: Text[100]; InStream: InStream; Ignored: Boolean): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| FileName | Text[250] |
The name of the file to attach. |
| FileMIMEType | Text[100] |
The MIME type of the file to attach. |
| InStream | InStream |
The stream of the file to attach. |
| Ignored | Boolean |
Specifies if the attachment should be marked as ignored, so that it is not processed by agent. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
AddAttachment
Attach a file to the task message. The file will be attached when the message is created. It is possible to attach multiple files to the message.
procedure AddAttachment(var AgentTaskFile: Record "Agent Task File"): Codeunit "Agent Task Message Builder"
Parameters
| Name | Type | Description |
|---|---|---|
| AgentTaskFile | Table System.Agents."Agent Task File" |
The file to attach. |
Returns
| Type | Description |
|---|---|
| Codeunit System.Agents."Agent Task Message Builder" |
This instance of the Agent Task Message Builder. |
UploadAttachment
Uploads a file to the task message. The file will be attached when the message is created. It is possible to attach multiple files to the message.
procedure UploadAttachment(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if the attachment was uploaded, false otherwise. |
GetLastAttachment
Get the last attachment that was added to the task message.
procedure GetLastAttachment(): Record "Agent Task File"
Returns
| Type | Description |
|---|---|
| Table System.Agents."Agent Task File" |
The last attachment that was added to the task message. |
GetAttachments
Get the last attachment that was added to the task message.
procedure GetAttachments(var TempAttachments: Record "Agent Task File" temporary): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| TempAttachments | Table System.Agents."Agent Task File" |
Returns
| Type | Description |
|---|---|
| Boolean |
True if any attachments exist for the task message, false otherwise. |