Calendar report UI Builder click event to open new tab

saranmix
Tera Contributor

Hi,

I'm new to the UI Builder,
I create new workspace including Calendar report component that show event of incident record
something like this

calendar_report_ui_builder.jpg

 

And I want to open that incident record in a new tab when clicking on that incident.
I try to print the payload with console.log

 

function handler({api, event, helpers, imports}) {
    console.log(JSON.stringify(event.payload));
}

 

it show the result like this

 

{"event":{"sysId":"a4b77ece1b0c7d1056cda712f54bcb03","title":"INC0023814 - TESTT!!","start":"2023-07-17 09:46:57","end":"2023-07-17 10:46:57","bgColor":"","description":"TESTT!!","rawEvent":{"sysId":"a4b77ece1b0c7d1056cda712f54bcb03","title":"INC0023814 - TESTT!!","start":"2023-07-17 09:46:57","end":"2023-07-17 10:46:57","bgColor":"","description":"TESTT!!"},"id":"11","startMS":1689562017000,"startMoment":"2023-07-17T02:46:57.000Z","endMS":1689565617000,"endMoment":"2023-07-17T03:46:57.000Z","endUTCOffsetMS":25200000,"startUTCOffsetMS":25200000,"ariaLabel":"","chunksLength":1,"table":"incident"},"chunkStartDateMoment":"2023-07-17T02:46:57.000Z","chunkEndDateMoment":"2023-07-17T03:46:57.000Z","chunkStartDateMS":1689562017000,"chunkEndDateMS":1689565617000}

 

I try to get sysId by testing with console.log(event.payload.sysId) but it return with undefined.
So, please help me how to get the sysId and how to do a client script to open incident record in a new browser tab.
Or if you have other solution that easier than this please advice.
 
Sorry for my bad english.

Best regards,
Saran
 
4 REPLIES 4

Antoni Zahariev
Tera Guru

Hi,

 

If you haven't figured this out, here is the tip 🙂

The Calendar Report component has the following payload:

{event: object, chunkStartDateMoment: object, chunkEndDateMoment: object, chunkStartDateMS: object, chunkEndDateMS: object}

 

and the same can be seen in your result.

 

As the sysId is within the event object, you can access it in the script as follows:

var payloadSysId = event.payload.event.sysId;

 

or at the 'Link to destination' event:

AntoniZahariev_0-1696827936467.png

 

Hi Antoni, Can I get the client script for the same requirement. I'm looking for an onClick behavior when a user clicks it has to navigate them into the record in Workspace 

were you able to figure this out?

joshmorris
Tera Guru

Hi, did you ever figure this out, Im trying to do the same thing