Changing Color on the SAM Renewals Calendar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 08:40 AM - edited ‎03-31-2025 08:52 AM
Hello, New to SAM Workspace a bit and only really done configurations on the table, I have a question on how can I change the colors on the Renewal Calender in Software Asset Workspace to show RED if the entitlement is expired, & show orange if its 60 days from expiring. I have other colors I need for certain dates as well but im trying to even figure out where can I go to make this happen, Thank you in Advance!
Screenshot is my view of the Renewals Calendar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 09:30 AM
Hello @HenryD
Please use below 👇 modified script - there are few changes that I made here and there.
function script({api, event}) {
const today = new Date();
const endDate = new Date(event['end_date']); // Variable name for event end date
const diffInTime = endDate - today;
const diffInDays = Math.ceil(diffInTime / (1000 * 60 * 60 * 24)); // Fixed division
let progressColor = '#0AB8D9'; // Default color
let pillColor = 'blue';
if (diffInDays < 0) {
progressColor = 'red';
pillColor = 'red';
} else if (diffInDays <= 60) {
progressColor = 'orange';
pillColor = 'orange';
}
return {
setBarColor: progressColor,
setPillColor: pillColor
};
}
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 09:46 AM
Hello, I just tried that with the edits and i am still getting the purple, i wonder if it has anything to do with that "progress color"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 09:54 AM
Hello @HenryD
Can you try adding logs like below 👇
function script({api, event}) {
const today = new Date();
const endDate = new Date(event['end_date']);
console.log('Today: ' + today);
console.log('End Date: ' + endDate);
const diffInTime = endDate - today;
const diffInDays = Math.ceil(diffInTime / (1000 * 60 * 60 * 24));
console.log('Days Difference: ' + diffInDays); // Log difference in days
let progressColor = '#0AB8D9',
pillColor = 'blue';
if (diffInDays < 0) {
progressColor = 'red';
pillColor = 'red';
} else if (diffInDays <= 60) {
progressColor = 'orange';
pillColor = 'orange';
}
console.log('Progress Color: ' + progressColor);
console.log('Pill Color: ' + pillColor);
return {
setBarColor: {
setColor: {
progress: progressColor,
pillColor: pillColor
}
}
};
}
Replace console.log with gs.log or gs.info and check where the script is breaking, but it should work correctly. Since, I helped you with your original query.
Please mark my answer as helpful/accept solution. This will help me be recognized for the efforts.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 12:11 PM
Hi, for the logs message it does not populate, I wonder if i need to go into the UI Builder for this? i tried searching withing UI builder but have yet to find the renewal calendar for SAM