SalesforceAskUser
Ask a user a question via Salesforce Chatter and process the reply directly into the investigation.
python · Salesforce
Source
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def salesforce_ask_user(): retries = int(demisto.args().get("retries")) persistent = demisto.args().get("persistent") == "true" for _i in range(retries): res = demisto.executeCommand("addEntitlement", {"persistent": persistent}) if isError(res[0]): if "[investigations] [investigation] (15)" in res[0]["Contents"]: time.sleep(1) continue return_error(res.Contents) entitlement = res[0]["Contents"] break comment_suffix = f" - #{demisto.incidents()[0]['id']} {entitlement}" task = demisto.args().get("task") if task: comment_suffix += f" #{task}" text = demisto.args().get("text", "") if not text: option1 = demisto.args().get("option1") option2 = demisto.args().get("option2") text += "Please reply with either " + option1 + " or " + option2 additional_options = demisto.args().get("additionalOptions") if additional_options: additional_options_list = additional_options.split(",") text += " or " text += (" or ").join(additional_options_list) text += "\n\nDemistoID: " + comment_suffix oid = demisto.args().get("oid") return oid, text def main(): oid, text = salesforce_ask_user() comment = demisto.executeCommand("salesforce-push-comment", {"oid": oid, "text": text}) demisto.results(comment) if __name__ in ["__main__", "builtin", "builtins"]: main()
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.