additional task to a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:11 PM
Hi Experts
i have attached a snippet of my current workflow which calls a REST API, it works as expected.
i have a additional requirement to ,create a task and assign it to a fulfilment group.
i do not want to change the existing workflow as its working as expected.
please guide me thru creating a task , not sure how to get the values to populate into the task
i can provide some more info if needed
Thank You
Levino
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:28 PM
Hi @levino
Can you let us know when you want to create catalog task ? & where do you want it means after API got successful or if it gets fails...??
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:30 PM
Hi Vishal
create task should be the last step after the REST API succeeds.
the workflow is on the sc_req_item table
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:36 PM
Hi @levino
It will be better if you create catalog task in workflow itself because once API got successful I can see screenshot shared by you the the workflow will end means RITM will be closed completed.
you can put the catalog task after "Chrome/Firefox extension access request" activity's "success" node.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:53 PM
Hi Vishal
in my task , how do i pass in these values as per the script, to show in the task
Thanks
Levino
workflow.scratchpad.ReferenceNumber = current.number;
if (current.variables.url_of_extension_from_the_chrome_web_store){
workflow.scratchpad.ChromeExtensionURL = current.variables.url_of_extension_from_the_chrome_web_store.toString();
} else {
workflow.scratchpad.ChromeExtensionURL = '';
}
if (current.variables.url_of_extension_from_the_firefox_web_store){
workflow.scratchpad.FireFoxExtensionURL = current.variables.url_of_extension_from_the_firefox_web_store.toString();
} else {
workflow.scratchpad.FireFoxExtensionURL = '';
}
var requested_by = current.variables.requested_by;
var requestorByRecord = new GlideRecord('sys_user');
requestorByRecord.addQuery('sys_id', requested_by);
requestorByRecord.query();
if (requestorByRecord.next()){
workflow.scratchpad.RequestedByEmail = requestorByRecord.email;
}
var gr = new GlideRecord('sys_rest_message');
gr.addQuery('name', 'MiB SC-Orch Job Management');
gr.query();
if (gr.next()){
var restMessage = gr.getUniqueValue();
var grHttpMethod = new GlideRecord('sys_rest_message_fn');
grHttpMethod.addQuery('rest_message', restMessage);
grHttpMethod.addQuery('function_name',current.cat_item.name);
grHttpMethod.query();
if (grHttpMethod.next()){
workflow.scratchpad.message = grHttpMethod.sys_id;
}
}
var time = new GlideDateTime().getNumericValue();
workflow.info(time + " ref number: " + workflow.scratchpad.ReferenceNumber);
workflow.info(time + " Chrome extension URL is: " + workflow.scratchpad.ChromeExtensionURL);
workflow.info(time + " Firefox extension URL is: " + workflow.scratchpad.FireFoxExtensionURL);
workflow.info(time + " Requested by Email is: " + workflow.scratchpad.RequestedByEmail);
workflow.info(time + " HTTP method is: " + workflow.scratchpad.message);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:56 PM
is it create task of create catalog task?