commonfields: id: SetAndHandleEmpty version: -1 name: SetAndHandleEmpty fromversion: 5.0.0 type: javascript tags: - Utility comment: |- Set a value in context under the key you entered. If no value is entered, the script doesn't do anything. This automation runs using the default Limited User role, unless you explicitly change the permissions. For more information, see the section about permissions here: - For Cortex XSOAR 6 see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/6.x/Cortex-XSOAR-Playbook-Design-Guide/Automations - For Cortex XSOAR 8 Cloud see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Create-a-script - For Cortex XSOAR 8.7 On-prem see https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8.7/Cortex-XSOAR-On-prem-Documentation/Create-a-script enabled: true args: - name: key required: true default: true description: The key to set in context. isArray: true - name: value description: The value of the key to set in context. The value is usually a DQ expression. Can be an array. isArray: true - name: append auto: PREDEFINED predefined: - "true" - "false" description: Whether to append the new context key to the existing context key. If "false", then the existing context key will be overwritten with the new context key. defaultValue: "true" - name: stringify auto: PREDEFINED predefined: - "true" - "false" description: Whether to save the argument as a string. The default value is "false". defaultValue: "false" - name: force auto: PREDEFINED predefined: - "true" - "false" description: Whether to force the creation of the context. The default value is "false". defaultValue: "false" scripttarget: 0 script: '-' tests: - SetAndHandleEmpty test - SetAndHandleEmpty_Test