- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2024 04:23 AM
I attempted two different approaches to populate a value in my service catalog. First, I created a field in the alm_license table and used the Dictionary Calculated Value to retrieve the value. I successfully obtained the value on the form and list view. However, when I attempted to auto-populate it in a catalog variable, the value didn't display.
I tried catalog client script with a script include as well, but I didn't get any value back. I retrieved the XML from the list and realized the value was empty.
Below is the script for reference:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2024 09:49 AM - edited ‎08-04-2024 09:51 AM
Hi @Tungw,
I tried to recreate the problem statement in my PDI. I got the expected results. Check it out
for Rights allocated column, I did a script calculation as follows
(function calculatedFieldValue(current) {
function countUsage() {
var ga = new GlideAggregate('alm_entitlement');
ga.addQuery('licensed_by', current.sys_id);
ga.addAggregate('COUNT');
ga.query();
if (ga.next()) {
return parseInt(ga.getAggregate('COUNT'), 10);
}
}
// Add your code here
return countUsage(); // return the calculated value
})(current);
For Rights balance column, I did a formula calculation like this
and the XML retrieved from form view looked like this, received values as expected
and here is the form view.
If my response helped, please leave a thumbs up and mark this helpful
Regards,
Bhavani Shankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2024 09:49 AM - edited ‎08-04-2024 09:51 AM
Hi @Tungw,
I tried to recreate the problem statement in my PDI. I got the expected results. Check it out
for Rights allocated column, I did a script calculation as follows
(function calculatedFieldValue(current) {
function countUsage() {
var ga = new GlideAggregate('alm_entitlement');
ga.addQuery('licensed_by', current.sys_id);
ga.addAggregate('COUNT');
ga.query();
if (ga.next()) {
return parseInt(ga.getAggregate('COUNT'), 10);
}
}
// Add your code here
return countUsage(); // return the calculated value
})(current);
For Rights balance column, I did a formula calculation like this
and the XML retrieved from form view looked like this, received values as expected
and here is the form view.
If my response helped, please leave a thumbs up and mark this helpful
Regards,
Bhavani Shankar