- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
02-02-2023 02:59 AM
Hi,
Is there a way to configure pre-process rule to link and run preprocess script? I have to link incidents with few identical fields and set some fields values using script. I thought to make preprocess script which will do both, but I ran into a problem. As I see during preprocess the incident doesn't have ID assigned yet, so I can't use command linkIncidents, because it requires ID of this incident.
02-07-2023 04:33 PM
Hi @jakub_gawinkowski – The pre-process rule actions are one-or-the-other: you can either have the pre-process rule Link/Link and close or Run a script, but not both. Custom pre-process scripts give you a lot of flexibility, but they can also be more difficult to troubleshoot than a playbook. For your use case, the best approach may be to handle the needed actions within the playbook rather than in a pre-process script.
That being said, the only way I've found to get the incident linking behavior you're looking for within a pre-process script is to have the script actually create the incident, by running createNewIncident, in place of the incoming incident, because that way you can get the incident ID from the result of createNewIncident. I am attaching a proof-of-concept script that shows how this works for your reference. Please be sure to read the warning in the description carefully and test this out in dev first, because the script can send your server into an infinite loop if the pre-process rule is not filtered correctly.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!