Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Appointment Calendar Component get Value

Kavitha Raydurg
Tera Contributor

Hello All,

I am using Appointment Calendar component and writing the selected date and time into a custom table. I am trying to use following event to write into the table but I could not get whatever user selected date. Could you please tell me how to retrieve selected date?
there are few properties like selectedDate but I don't know how to pull. Do I need to use api.context... or event.payload....


function evaluateEvent({api, event}) {
    return {
        table: "itil_appointment",
        templateFields: "subject=Test Appointment;^notes=" + event.payload.start,
        useSetDisplayValue: false
    };
}
 
You are welcome to suggest better solution if you know.

Thanks in advance.

KavithaRaydurg_0-1741272110978.png

 

2 REPLIES 2

Andrew Bettcher
Kilo Sage

I'm trying to do something similar. I need to expose the start and end dates of the currently selected timespan. 

As you say, they're there but I just can't seem to get to them.

Did you get anywhere with this?

 

Hi Andrew, 
You can access the start & end date by using  event.payload.event.start and event.payload.event.end from the script. Hope this helps for you.