I am working on the Maestro flow in which I used to read the mail box and create a queue in the orchestrtaor and in the next node I am using an agent which after reading the mail create a ticket in jira but i am unable to pass the email body to the agent input mandatory field as from the previous node I get only outlook mail count and error message. so kindly let me know if any one knows about the issue and how I resolve this? Thanks In advance.
Hello @rahul.kumar,
The output you are passing seems to be from the queue/orchestrator node, so you are receiving only count/error details. The email body will come from the Read Mail/Get Emails node output.
Add a Script node between the mail node and the agent node, extract the first email from the mail list, and pass the body as an output variable to the agent.
// Extract the first EmailMessage record
const emailMessage = vars.response[0] ?? {};// Extract fields
const HasAttachments = emailMessage[“HasAttachment”];
const Subject = emailMessage[“Subject”] ?? “”;
const FromAddress = emailMessage[“FromAddress”] ?? “”;
const ToAddress = emailMessage[“ToAddress”] ?? “”;
const MessageDate = emailMessage[“MessageDate”] ?? “”;
const FromName = emailMessage[“FromName”] ?? “”;
const emailMessageID = emailMessage[“Id”] ?? “”;
// Use HtmlBody first if available, otherwise TextBody
const EmailBody = emailMessage[“HtmlBody”] ?? emailMessage[“TextBody”] ?? “”;// Return cleaned values
return {
HasAttachments: HasAttachments,
Subject: Subject,
EmailBody: EmailBody,
FromAddress: FromAddress,
ToAddress: ToAddress,
MessageDate: MessageDate,
FromName: FromName,
EmailMessageID: emailMessageID
};
Then map EmailBody from this script’s output to the mandatory input field of your agent.
Also, check that vars.response is pointing to the mail reading node output, not the queue creation output. If you are handling multiple emails, loop through the mail collection and create one queue item per email with Subject, FromAddress, and EmailBody.
You would have option to insert variable from multiple nodes so try to fet the trigger or get email node
Cheers
You should be able to insert variables from multiple nodes. When mapping the Agent input, select the output from the Trigger/Get Emails node rather than the Queue/Orchestrator node, as the email body is typically available only in the mail node output. If the field is not exposed, use a Script node to extract HtmlBody/TextBody and pass it to the Agent.
Reference: Maestro - Overview
Happy Automation!
- Create a String variable
- Use an Assign activity to store the required text in the variable.
- Add a Send Outlook Mail Message
In this way we can pass a variable of email body.