Changing Color on the SAM Renewals Calendar

HenryD
Tera Guru

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

8 REPLIES 8

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

 

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"

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

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