Limitations to the scripts are documented
here (re and the Java class java.util.Date are the only allowed imports
).
You cannot modify other incidents within a script. I posted an idea that I think this might fall under
here.
Ideally, the way to do this would be to use the query_builder like so:
parent_query = query_builder.contains(fields.incident.id, '1234').build()
children_query = query_builder.contains(fields.incident.properties.custom_parent_field, '1234').sortByAscending(fields.incident.id).build()
parent_incident_results = helper.findIncidents(parent_query)
child_incidents_results = helper.findIncidents(children_query)
if len(parent_incident_results) == 1:
parent_incident = parent_incident_results[0]
# ... do something with parent_incident here ...
# Unfortunately, this is a read-only object right now
if len(child_incidents_results ) > 0:
for child in child_incidents_results:
# ... do something with child incident of the parent here ...
# Unfortunately, this is a read-only object right now
As I mentioned in the comments in the above code, the incidents returned by findIncidents() is read-only. This is documented
here.
------------------------------
Jared Fagel
Cyber Security Analyst Intern
Public Utility
------------------------------
Original Message:
Sent: Mon July 29, 2019 01:21 PM
From: Phillip Lee
Subject: How to change incident context to write to multiple incidents within scripts?
Hello,
I have a use case where I do the following:
1) Create an artifact "Parent Incident" with value 1234
2) A rule sees new artifact "Parent Incident" with value 1234
3) Script "Script Parent Incident Add" will then do the following -
i) Fill in incident.properties.custom_parent_field = '1234'
ii)Fill in incident.properties.custom_child_fileld in incident = '1234' with current incident.id****
**** -> This is the part I can not do since the incident.id field is read only. Is there anyway to change the incident context so that I'm able to modify multiple incidents within a script? I tried to use 'import resilient', but that is an illegal import (BTW - is there any documentation for what is an allowed import?)
This use case is specifically to create a hierarchal relationship between incidents as parent/child rather than rely on relationships via artifacts.
------------------------------
Phillip Lee
------------------------------