From 58d49b0cb790358aeaf0066107bdc3fb719e4c70 Mon Sep 17 00:00:00 2001 From: Andrew Shamah <42912128+amshamah419@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:21:18 +0300 Subject: [PATCH] Email ask user add using argument (#27401) * Added the usingSender argument to enable using only one instance to send the email * Release Notes, Metadata * RM param, add generic fix --- Packs/CommonScripts/ReleaseNotes/1_11_86.md | 6 +++ .../Scripts/EmailAskUser/EmailAskUser.js | 9 +++- .../Scripts/EmailAskUser/README.md | 52 +++++++++---------- Packs/CommonScripts/pack_metadata.json | 2 +- 4 files changed, 41 insertions(+), 28 deletions(-) create mode 100644 Packs/CommonScripts/ReleaseNotes/1_11_86.md diff --git a/Packs/CommonScripts/ReleaseNotes/1_11_86.md b/Packs/CommonScripts/ReleaseNotes/1_11_86.md new file mode 100644 index 000000000000..5a16eecf8fa3 --- /dev/null +++ b/Packs/CommonScripts/ReleaseNotes/1_11_86.md @@ -0,0 +1,6 @@ + +#### Scripts + +##### EmailAskUser + +- Fixed an issue where additional arguments were not passed on to the *send-mail* command. diff --git a/Packs/CommonScripts/Scripts/EmailAskUser/EmailAskUser.js b/Packs/CommonScripts/Scripts/EmailAskUser/EmailAskUser.js index 8189f352180a..b324dfce4471 100644 --- a/Packs/CommonScripts/Scripts/EmailAskUser/EmailAskUser.js +++ b/Packs/CommonScripts/Scripts/EmailAskUser/EmailAskUser.js @@ -109,7 +109,14 @@ if (addresses.length > 0) { emailArgs.bcc = args.bcc; } - return executeCommand('send-mail', emailArgs); + // Add additional fields from args to emailArgs + for (const key in args) { + if (args.hasOwnProperty(key) && !emailArgs.hasOwnProperty(key)) { + emailArgs[key] = args[key]; + } + } + + return executeCommand('send-mail', emailArgs); } else { return {Type: entryTypes.error, ContentsFormat: formats.text, Contents: 'No email address found'}; diff --git a/Packs/CommonScripts/Scripts/EmailAskUser/README.md b/Packs/CommonScripts/Scripts/EmailAskUser/README.md index 4fc5b8e69174..2362820c7db6 100644 --- a/Packs/CommonScripts/Scripts/EmailAskUser/README.md +++ b/Packs/CommonScripts/Scripts/EmailAskUser/README.md @@ -4,10 +4,10 @@ Asks a user a question via email and process the reply directly into the investi Cortex XSOAR can use email responses within the system, e.g. when an external user's approval is required. To do this, you will create an email template with multiple choice options (e.g. Reply "Yes" if you approve and "No" if you do not). -**Before starting you will need to configure an integration capable for sending and receiving emails, such as: Mail Listener v2 and Mail Sender (New), GMail, EWS O365, O365 Outlook Mail Single User. The instance that will receive the response must be set to fetch incidents.** +**Before starting, you will need to configure an integration capable for sending and receiving emails, such as: Mail Listener v2 and Mail Sender (New), GMail, EWS O365, O365 Outlook Mail Single User. The instance that will receive the response must be set to fetch incidents.** The user who receives the mail will respond accordingly and when an answer is received, it will trigger a task to handle the response. -This is a two step task. The first, is to send an email asking the user for information. The second step, is to receive the answer and trigger a process of handling it in Cortex XSOAR. +This is a two-step task. The first, is to send an email asking the user for information. The second step, is to receive the answer and trigger a process of handling it in Cortex XSOAR. The outgoing email contains a token that will be used when the user responds to the email. According to the token, the response will be directed to the relevant incident. @@ -52,34 +52,34 @@ The tag you choose (in this case "Await") can be used in lieu of the task id in ## Script Data --- -| **Name** | **Description** | -| --- | --- | -| Script Type | javascript | -| Tags | email | -| Cortex XSOAR Version | 4.0.0+ | +| **Name** | **Description** | +|----------------------|-----------------| +| Script Type | javascript | +| Tags | email | +| Cortex XSOAR Version | 4.0.0+ | ## Inputs --- -| **Argument Name** | **Description** | -| --- | --- | -| email | The email of the user to ask. | -| subject | The subject for the email. | -| message | The message sent to the user you are going to ask. | -| option1 | The first option for a user reply.The default is "yes". | -| option2 | The second option for the user reply. The default is "no". | -| additionalOptions | The comma delimited list of additional options if there are more than 2. | -| task | Which task the reply will close. If none, then no playbook tasks will be closed. | -| roles | Send mail to all users of these roles (a CSV list). | -| attachIds | The attachments. | -| bodyType | The type of email body to send. Can be, "text" or "HTML". | -| replyAddress | The reply address for the html links. | -| replyEntriesTag | The tag to add on email reply entries. | -| persistent | Whether to use one-time entitlement or a persistent one. | -| retries | How many times to try and create an entitlement in case of a failure. | -| cc | The CC email address. | -| bcc | The BCC email address. | -| playbookTaskID | The subplaybook ID, use `${currentPlaybookID}` to get from the context, `all` to complete all tasks from all plabooks | +| **Argument Name** | **Description** | +|-------------------|------------------------------------------------------------------------------------------------------------------------| +| email | The email of the user to ask. | +| subject | The subject for the email. | +| message | The message sent to the user you are going to ask. | +| option1 | The first option for a user reply.The default is "yes". | +| option2 | The second option for the user reply. The default is "no". | +| additionalOptions | The comma delimited list of additional options if there are more than 2. | +| task | Which task the reply will close. If none, then no playbook tasks will be closed. | +| roles | Send mail to all users of these roles (a CSV list). | +| attachIds | The attachments. | +| bodyType | The type of email body to send. Can be, "text" or "HTML". | +| replyAddress | The reply address for the html links. | +| replyEntriesTag | The tag to add on email reply entries. | +| persistent | Whether to use one-time entitlement or a persistent one. | +| retries | How many times to try and create an entitlement in case of a failure. | +| cc | The CC email address. | +| bcc | The BCC email address. | +| playbookTaskID | The subplaybook ID, use `${currentPlaybookID}` to get from the context, `all` to complete all tasks from all plabooks. | ## Outputs --- diff --git a/Packs/CommonScripts/pack_metadata.json b/Packs/CommonScripts/pack_metadata.json index 00a5f98b697d..0dd91b857132 100644 --- a/Packs/CommonScripts/pack_metadata.json +++ b/Packs/CommonScripts/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Common Scripts", "description": "Frequently used scripts pack.", "support": "xsoar", - "currentVersion": "1.11.85", + "currentVersion": "1.11.86", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",