Custom field to perform CustomAction

Hi,

I have changed a custom field to a button and i want to perform customAction when clicked on the button.
This button can be viewed in the View Page.
//here is my button:

//This is my ListOption_Load:
$this->CustomActions[“order”] = new ListAction(“order”, “Add To MY Cart”, IsLoggedIn(), ACTION_AJAX, ACTION_SINGLE,“” ,“fas fa-cart-plus ew-icon”);

//This is my Row_CustomAction
$oid = ExecuteScalar(“SELECT OrderNo FROM mycart ORDER BY OrderNo DESC LIMIT 1”);
$myResult = Execute(“INSERT INTO cartdetails (OrderNo, SellerID, CustomerID, Code, Qty, Price, Status)
VALUES(‘$oid’, '” . $row[“UsersID”] . “', ‘$cuid’, '” . $row[“Code”] . “', ‘1’, '” . $row[“Price”] . “', ‘1’ )
ON DUPLICATE KEY UPDATE Qty = Qty+1”);

Note: As it is this code is doing its job "without the custom field as a button.

can you guys pls. let me know how to connect this button to this custom action.

Thank you

You may see the JavaScript code in Server Events and Client Script > ListOptions_Rendered > Example 2.

Thank you,
could pls. give me some ideas on how to implement
on how to connect with view page

Please note that Row_CustomAction does not support in View Page. That server event only supports to be run in List Page.