SalesforceAskUser

Ask a user a question via Salesforce Chatter and process the reply directly into the investigation.

python · Salesforce

Details

IDSalesforceAskUser
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658

README

Asks a user a question via Salesforce Chatter and process the reply directly into the investigation.

Script Data


Name Description
Script Type python
Tags -

Dependencies


This script uses the following commands and scripts.

  • salesforce-push-comment

Inputs


Argument Name Description
persistent Indicates whether to use a one-time entitlement or a persistent one.
replyEntriesTag The tags to add on comment reply entries.
retries The number of times to try and create an entitlement when there is a failure.
task The task that should be closed with the reply. If none, then no playbook tasks will be closed.
option1 The first option for a user reply. Options cannot contain whitespaces.
option2 The second option for the user reply. Options cannot contain whitespaces.
oid The object ID of the subject.
additionalOptions A comma delimited list of additional options (in cases where more than 2 options are needed). Options cannot contain whitespaces.
text The text of the chatter comment. If not given, a default post message will be generated based on option arguments.
link The link to add to the message.

Outputs


There are no outputs for this script.

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401
from SalesforceAskUser import salesforce_ask_user


def test_salesforce_ask_user(mocker):
    """
    Given:
        - The script args.
    When:
        - Running the salesforce_ask_user function.
    Then:
        - Validating the outputs as expected.
    """
    mocker.patch.object(demisto, "results")
    mocker.patch.object(
        demisto,
        "args",
        return_value={
            "retries": 1,
            "persistent": "true",
            "option1": "yes",
            "option2": "no",
            "task": "task1",
            "additionalOptions": "1,2,3",
        },
    )
    mocker.patch.object(demisto, "incidents", return_value=[{"id": 1}])
    mocker.patch.object(demisto, "executeCommand", return_value=[{"Contents": "entitlement", "Type": "text"}])

    _, text = salesforce_ask_user()
    assert "Please reply with either " in text