In this video, we’ll look at… …what is a pre-publish subflow, when do
you need one, and how do you define and configure it?
You can skip to these topics from the YouTube description for this video.
In Catalog Builder, catalog items are published right away by default when the owner of the
catalog item clicks submit.
But you may want items to be reviewed before they’re published.
Let’s look at an example.
Catalog Builder allows Beth, our catalog administrator, to scale catalog development and speed up
time to deployment….
…by delegating catalog item building tasks to business owners within different business
units, or BUs.
But Beth was hearing from some managers that they wanted her to review the items before
they were published to catch typos, incorrect descriptions, or other issues.
So, Beth asks the System Administrator to require her approval of each catalog item
before they’re published.
By defining and configuring a pre-publish subflow, you can control who will review catalog
items, and define what happens if the item is rejected.
Now let’s see how to define and configure a pre-publish subflow.
In our example, the subflow will submit a request for approval from the catalog administrator
when a catalog item is submitted.
You can set up your subflow with any additional steps that may be needed before the item is
published, such as sending a notification to the catalog item owner when the item is
rejected or approved.
Logged in as System Administrator, we access Flow Designer to copy the template for the
Catalog Builder item review subflow.
Here are the inputs and outputs for this flow.
The input is the catalog item.
The output is the state of the catalog item, which is the result of the pre-publish flow
determining whether the submission should continue.
In our example, we want the reviewer to reference the catalog item during the review.
So while we have the sys_id of the catalog item, we also need its record reference, which
we can get using a Look Up Record action.
We select the Catalog Item table and add a condition that the sys_id of the record matches
the submitted catalog item.
In our example, we also want to give the reviewers a handy URL so they can preview the item with
a single click.
In this demo, the administrator has set up a flow action that generates the URL in Catalog
Builder.
Note that this action isn’t part of the base system and is only provided here as an
example.
We’ll use this action now to get the preview URL.
For the next step, we’re going to submit a catalog item request for reviewing and publishing
catalog items.
Let’s take a quick look at this catalog item.
Note that it’s used as an example in our demo and isn’t part of the base system.
You can create similar items based on your use case.
This item requires the reference to the catalog item and its URL as input variables.
Our example catalog item’s simple flow includes an approval and a task which need to be completed
before the item is published.
In your specific use case, you could include any other steps required before an item is
published.
Back in our subflow, we select Review and publish catalog items for the first catalog
item field.
For the second catalog item field, we use the Lookup Record step’s output to provide
the reference to the submitted item.
Next, we provide the preview URL of the item by using the output of the Generate Catalog
Builder URL step.
Finally, we need to specify who this is requested for—the catalog item owner.
Now we need to add an action to wait for the requested item to be inactive, meaning the
approver has approved or rejected the request.
First, we select the requested item, …
…then we set the condition that active is false.
Now we need to add flow logic to direct the flow when the catalog item is approved, or
rejected.
We set a condition that if the requested item state is closed complete, …
…then we set the state of the subflow to completed.
Now we add flow logic to end the flow.
Finally, let’s add an Else statement.
If the item isn’t approved, we set the State of the subflow to Failed.
This will ensure that the item isn’t published and goes back to the draft state.
Note that you could add an action here to send a notification to the catalog item owner
that the item was rejected.
And we add flow logic to end the flow when it fails.
Because we’ve already assigned the subflow outputs within the if statement, we delete
this step at the end.
Now let’s save the flow, publish it, and copy its sys_id from the URL.
We’ll use the sys_id to set the property specifying the subflow that needs to be used
when publishing a catalog item.
The first time you set up a pre-publish subflow, you need to create the item review flow property.
In the System Properties list, we create the new property, and paste the sys_id into the
Valuce field.
Now whenever a catalog item owner submits a catalog item, the flow will be triggered.
Let’s test out our subflow.
We’re logged in as Adela, who made a change to this catalog item, and we submit it.
When we return to our dashboard, we can see that the item is In Review.
Now let’s log in as Beth to review the approval request in Agent Workspace.
And here’s the request.
Under variables, we can see the catalog item name, and the link to preview it.
The item looks good, so let’s approve it.
After the approverin this case, the catalog administratorapproves the request, the
catalog item’s state changes to published.
If the approver rejects the request, the item along with its changes goes back to the Draft
state, but the changes are not reflected in the published item.
For more information, see our product documentation, knowledge base, or podcast.
Or ask a question in the ServiceNow Community.