UI Builder - event mapping

Pallavi Gaikwad
Tera Expert

Hi All,

 

I'm building a custom workspace. In that workspace I want to implement page navigation between list page and record details page. After clicking on any record its details should be open in record details page.

 

I'm using a list component. have added 'cell link clicked' event to that page.  Added link to destination handler to that event. However I'm unable to pass sys_id of selected record. Not sure from where I can get sys_id of selected record so that I can pass it. 


Please let me know how can I pass sys_id of selected record to record details page.

Thanks in advance!

2 ACCEPTED SOLUTIONS

Sarthak Kashyap
Kilo Sage

Hi @Pallavi Gaikwad ,

 

You can find the dynamic sys_id and table name 

 

Create two Client state parameter 1. table_name and 2. sys_id and create client script and add below code

console.log("Clicked = " + JSON.stringify(event));
console.log("Table name = " + event.payload.table);
console.log("Record id = " + event.payload.sys_id);
api.setState("tableName", event.payload.table);
api.setState("sys_id", event.payload.sys_id);

 

Now call above client script in your event called "cell link clicked" or "Link to Destination" also check the logs if your client script is calling or not.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

View solution in original post

Hi @Sarthak Kashyap 

 

Thank you for the solution. Able to access sys_id and table name from event payload. 

 

Need to dot walk as below and it works.

event.payload.cell.metadata.openRecordMetadata.sysId
event.payload.cell.metadata.openRecordMetadata.table

View solution in original post

5 REPLIES 5

Sarthak Kashyap
Kilo Sage

Hi @Pallavi Gaikwad ,

 

You can find the dynamic sys_id and table name 

 

Create two Client state parameter 1. table_name and 2. sys_id and create client script and add below code

console.log("Clicked = " + JSON.stringify(event));
console.log("Table name = " + event.payload.table);
console.log("Record id = " + event.payload.sys_id);
api.setState("tableName", event.payload.table);
api.setState("sys_id", event.payload.sys_id);

 

Now call above client script in your event called "cell link clicked" or "Link to Destination" also check the logs if your client script is calling or not.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

Hi @Sarthak Kashyap 

 

Thank you for the solution. Able to access sys_id and table name from event payload. 

 

Need to dot walk as below and it works.

event.payload.cell.metadata.openRecordMetadata.sysId
event.payload.cell.metadata.openRecordMetadata.table

lauri457
Giga Sage

If you add the record list component on a page it should be added with presets. There is a list controller that has a reference link selected -event with Nav item selected - Data resource -handler. Here you can edit the route to your record page if not named the default "record".  You can also easily expose an event object by defining a client script that has console.log(event) and binding it as an event handler to the event you want then observing from the browser console

 

 

Hi @lauri457 

 

Thank you for reverting. yes, adding a console log for event helped me to trace the JSON and accessing sys id and table name.