- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 04:33 AM
Hi all,
I have implemented a flow to send a reminder when the incident is awaiting requester for 3 days. To do that, I have created a trigger for every update on the incident table, with the condition "waiting reason = awaiting requester".
Now, I`m trying to replicate the flow for the sc_req_item table, but I can´t create a trigger as for the incident table. For the sc_req_item table, the trigger action is Service Catalog. How can I replicate this condition using the Service Catalog trigger?
Regards.
Solved! Go to Solution.
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 09:31 AM
I'm afraid that won't work. Do that in a business rule instead, probably more straight forward (if you insist on using Flow Designer elements, you can call a subflow or action via script using the Flow API).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 09:57 AM
Once your flow with the Service Catalog trigger is published, you need to map it to the catalog item / record producer. If the Flow field is not visible on the catalog item, just add it to the form. This flow will then run for items raised via that catalog item.
If you already have a flow for it, consider building your functionality inside a sub-flow instead, and add that to the main flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 07:12 AM
Thanks for your response.
The item already has a workflow. Can I set a flow and workflow for an item or just one of them? I need to trigger the flow for every update, how can I do to trigger the sc_req_item table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 09:31 AM
I'm afraid that won't work. Do that in a business rule instead, probably more straight forward (if you insist on using Flow Designer elements, you can call a subflow or action via script using the Flow API).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 08:53 AM
I have created an action with the following code:
(function execute(inputs, outputs) {
var grScReqItem = new GlideRecord('sc_req_item');
grScReqItem.addQuery('state',-5);
grScReqItem.addQuery('u_hold_reason',1);
grScReqItem.addQuery('sys_id',inputs.sysID);
grScReqItem.setLimit(1);
grScReqItem.query();
gs.log(grScReqItem.getEncodedQuery());
if (grScReqItem.next()) {
outputs.result = "true";
}
else outputs.result = "false";
})(inputs, outputs);
When I execute it using the background script, it works fine, but when I test the action, I dont know why SN is adding queries to it. Looking into logs table, I have checked that ServiceNow is modifying my query. Thats the query from the logs after being executed: logs: state=-5.0^u_hold_reason=1^sys_id=34a1acfc87cd611036cb113e3fbb351f^watch_listCONTAINSsystem^ORrequest.requested_for=system^ORopened_by=system
The query watch_listCONTAINSsystem^ORrequest.requested_for=system^ORopened_by=system is not part of my query, but is executed.