Display variable in RITM and TASK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 09:52 AM
Hi all,
In the catalog item, there's one field to get the location of the user. I am populating it using Auto populate. This field is not visible in the portal.
There's a condition to check if the user belongs to particular location, if user belongs to that location, then displays another variable field on the portal for user to select.
Everything on the portal side is working as expected.
There are only 2 UI Policy.
1. To hide all the variables on portal.
2. To display another variable field based on the user location.
When I submit the request, there's no variable visible on the RITM aw well as TASK. I have made all the variables available in the workflow TASK.
Even if 'Applies on catalog Tasks' and 'Applies on Requested Item' is unchecked for the first UI policy, on the RITM it is not displaying any values. It displays only 'location of the user' variable but the value is blank.
I tried in multiple ways, still not able to debug this.
Can anybody please let me know what changes has to be done?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 11:27 PM
Hi @DaniJ ,
No, the field values weren't visible in the RITM or TASK when using the auto-populate option, so I used the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 05:10 AM
Can you share a sample of the script you used please.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 07:03 AM
Sure @DaniJ
I'm using a OnLoad Client Script
function onLoad() {
var ga = new GlideAjax('global.getUserLocationdetails');
ga.addParam('sysparm_name', 'getUserRegion');
ga.getXML(getReign);
function getReign(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('location_of_the_user', answer);
}
}
Script Include
var getUserLocationdetails = Class.create();
getUserLocationdetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUserRegion: function() {
var grUser = new GlideRecord('sys_user');
grUser.get(gs.getUserID());
if (grUser) {
var loc = grUser.location.getRefRecord();
if (loc.isValidRecord()) {
return loc.country;
}
}
},
type: 'getUserLocationdetails'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2024 10:09 AM
In the Catalog UI Policy Action list, add the "Clear the variable value" column, set it to false.