Draft and Populate Catalog Item Variables From Flow or Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi,
I have a requirement where if a user gets deactivated from our organization, we need a request submitted to revoke their software license. How can this be achieved?
Currently, it's somewhat of a manual process, although it is mostly automated other than two button clicks for the user. We currently have a flow that is triggered when a user's record changes from Active = True to Active = False and when that happens, it checks if any requests exist that have a software license effective date that is still effective as of today's date or in the future. When it finds the request, it sends an email to the Assigned To user that the Requested For user has been deactivated and to click a button on the notification to revoke their software license. The user clicks a button on the email, and it automatically opens the catalog item in our Service Portal and automatically populates the variables in the form, so all the user has to do is click Submit.
Here is a snapshot of the flow:
Here is the mail script on the notification that populates the variables for the user when they click the botton:
var sysid = current.sys_id;
var nameOfPerson = current.variables.name_of_person.getValue();
url = gs.getProperty('glide.servlet.uri') + 'sp?id=sc_cat_item&sys_id=12345678910&sysparm_category=12345678910&request=revoke&name_of_person=' + nameOfPerson + '&revoked=' + sysid;
template.print(global.OutlookRoundedButtonDynamic('Revoke License', '16', 'FFFFFF', 'ce1141', '7', '20%', url) + ' ');
When the Assigned To user clicks the Revoke License button on the email, the catalog item opens in the browser and auto-populates the variables from the URL and the Assigned To user just has to click Submit.
We would like to automate this further to where, instead of sending an email notification and have the Assigned To user click a button to submit the request for revoking the software license, we just want a request automatically submitted without any inputs from users.
Is this possible via flow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi,
Yes, this requirement can be fully automated using Flow Designer, and based on your current setup, you are already very close
From your flow, instead of sending an email and relying on user interaction, you can directly create the revoke request within the flow itself.
Suggested Approach:
Trigger (Already Implemented)
Your flow triggers when the User record changes from Active = true → false, which is correct.Identify Active Licenses
Continue using your lookup step to identify active software license requests (based on effective date).Replace Notification with Automation
Instead of sending an email with a button, remove that step and add a “Create Catalog Request Item” action.Create Revoke Request Automatically
Configure the action as follows:Catalog Item → Revoke License item
Requested For → Deactivated user
Opened By → System / Flow user
Map required variables:
name_of_person = User name
revoked = Original request/sys_id
Any other required fields
Handle Multiple Licenses (If Applicable)
If multiple active licenses exist, add a For Each loop and create one revoke request per license.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
@ayushraj7012933 thank you for the feedback! I am almost ready to complete the flow!
I have a one question, I noticed during testing, the Requested For field is blank when it tried to auto-generate the revocation request. Do you know how I can accomplish this?
Typically, this field is populated using our record producer script below:
var userEmail= producer.user_Email;
if (userEmail) {
var grUser = new GlideRecord('sys_user');
grUser.addActiveQuery();
grUser.addQuery('email', userEmail);
grUser.query();
if (grUser.next()) {
current.requested_for = grUser.sys_id;
}It looks like this script isn't running when it's being created from the flow. See below where Opened By and Requested For are both blank.
All the other variables populated as expected! Any idea how I can populate the Opened By, Requested For?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
@neil_b ,
Try to map the requested for with the record which is triggering the flow.Means whenever you are the requested for value use data pill and select flow triggered record.
If my response helped, mark it as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@Dinesh Chilaka I don't appear to have the option to map the Requested For with a data pill.
