UI Builder delete record not working in client script

SundaramR
Tera Guru

 Hi,

 

I have below code in the client script to delete the record. when list simple row is clicked, but delete operation is giving the error.   looking to some help to fix this issue.

 

/**
* @Param {params} params
* @Param {api} params.api
* @Param {any} params.event
* @Param {any} params.imports
* @Param {ApiHelpers} params.helpers
*/
function handler({api, event, helpers, imports}) {
    try {
    console.log(JSON.stringify(event.payload, null, 4));
        api.data.delete_record_1.execute({
        'table': event.table,
        "recordId": event.sys_id
    });
    console.log("Delete completed");
    }catch(ex){
        console.log("Error: " + ex);
    }

}

 

Generate this error:

 

event :{"elementId":"delete_record_1","name":"DATA_OP_FAILED","payload":{"dataElemId":"delete_record_1","operation":"EXECUTE","errors":[{"message":"Invalid syntax with ANTLR error 'token recognition error at: '.a'' at line 2 column 7","errorType":"InvalidSyntax","locations":[{"line":2,"column":7}]}],"__uxfCompositionElId":"9c830cf88310a250bef196a6feaad362"},"context":{},"eventInfo":{"sourceElementId":"cm9a424ye00013j9cmmt8s35a"}}
1 ACCEPTED SOLUTION

SundaramR
Tera Guru

sorry, found the issue. I am missing payload to get the dynamic values. below works.

 

 

 api.data.delete_record_1.execute({
        'table': event.payload.table,
        "recordId": event.payload.sys_id
    });

 

View solution in original post

1 REPLY 1

SundaramR
Tera Guru

sorry, found the issue. I am missing payload to get the dynamic values. below works.

 

 

 api.data.delete_record_1.execute({
        'table': event.payload.table,
        "recordId": event.payload.sys_id
    });