Custom Actions

In 2026 how can i run a rowCustomAction
I have created my rowCustomAction but it is not fireing.

in pageload i have

    $this->CustomActions["call"] = new ListAction(
        "call",
        "Call For",
        Allowed: IsLoggedIn(),
        Method: ActionType::AJAX,
        Select: ActionType::SINGLE,
        ConfirmMessage: "Call?",
        Icon: "fa-solid fa-bell-concierge ew-icon",
        Success: "callActionSuccess"
    );

thanks

Since your ListAction does not have the handler, you still need to implement handler on the server side by Row_CustomAction server event, read Page_Load -> Example 3. Note also that your posted code should be for Page_Load, not Row_CustomAction.

thanks, i got it working using example 3. but how can i auto refresh the page after?

Since you use:

You need to handle it in your sucess function (e.g. callActionSuccess in your example). For example, you may call window.reload() when necessary.

thans

thanks when i use the callActionSuccess the pages refreshes on both failed and success but i dont get any success or failed message

	$this->CustomActions["trigger"] = new ListAction(
		"trigger",
		"Trigger",
		IsLoggedIn(),
		ActionType::AJAX,
		ActionType::SINGLE,
		"Port Triggered?",
		"fa-solid fa-phone ew-icon",
		  "callActionSuccess",
		function ($row) {
			$result = $this->update(
				[
					"triggeredBy" => CurrentUserID(),
					"triggeredDate" => new \DateTime(),
					"portstatus" => "Triggered"
				],
				[
					"id" => $row["id"],
					"portstatus" => "call-for",
					"Status" => "Accepted"
				]
			);

			if ($result > 0) {
				return true;
			}

			$this->setFailureMessage(
				"Failed to Trigger, Status must be Accepted and PortStatus = Call-For"
			);

			return false;
		},
		"Trigger Successfully",
		"Failed to Trigger"
	);
// Global user functions
window.callActionSuccess = function(data) {
console.log(data);

...
if (data?.success) {
    window.location.reload();
}
...

};

also tried

	$this->CustomActions["trigger"] = new ListAction(
		"trigger",
		"Trigger",
		IsLoggedIn(),
		ActionType::AJAX,
		ActionType::SINGLE,
		"Port Triggered?",
		"fa-solid fa-phone ew-icon",
		"callActionSuccess",
		fn ($row) => $this->update(
				[
					"triggeredBy" => CurrentUserID(),
					"triggeredDate" => new \\DateTime(),
					"portstatus" => "Triggered"
				],
				[
					"id" => $row\["id"\],
					"portstatus" => "call-for",
					"Status" => "Accepted"
				]
			) > 0 ,
	
		"Trigger Successfully",
		"Failed to Trigger"
	);

When you use ActionType::AJAX, you handle the result by your own success function, setting server side failure message won't work. You should return response for your success function, e.g. if your function expects data as an object, you should return an object (associative array in PHP):

$this->Response = new JsonResponse(["success" => true, "message" => "Trigger Successfully"]);

so your success function can read data.success and show the data.message.

is this correct?

	$this->CustomActions\["trigger"\] = new ListAction(
		"trigger",
		"Trigger",
		IsLoggedIn(),
		ActionType::AJAX,
		ActionType::SINGLE,
		"Port Triggered?",
		"fa-solid fa-phone ew-icon",
		"",
		function ($row) {
			$success = $this->update(
				[
					"triggeredBy"   => CurrentUserID(),
					"triggeredDate" => new \\DateTime(),
					"portstatus"    => "Triggered",
				],
				[
					"id"         => $row\["id"\],
					"portstatus" => "call-for",
					"Status"     => "Accepted",
				]
			) > 0;

			$this->Response = new JsonResponse(\[
				"success" => $success,
				"message" => $success
					? "Trigger Successfully"
					: "Failed to Trigger",
			\]);
			return $success;
		}
	);

basically want it to say Successfully and refresh the table, or just refresh
many thanks

No, your code is incorrect.

  1. Note that:

        /**
         * Executes an SQL UPDATE statement on a table
         *
         * Table expression and columns are not escaped and are not safe for user-input.
         *
         * @param array<string, mixed> $data (unquoted column name as key)
         * @param array<string, mixed> $criteria (unquoted column name as key)
         * @param array<string, ParameterType> $types (quoted column name as key)
         *
         * @return int|numeric-string The number of affected rows.
         *
         * @throws Exception
         */
        public function update(array $data, array $criteria = [], array $types = []): int|string
    

    You better convert the $success to bool.

  2. Your window.callActionSuccess() shown above did not handle the success/error message.

are you able to update my code for me please as i dont fully understand.
basicly i want to show the Success or Failure message and if success then refresh the page after the message

many thansk

You may post the code the you have tried for discussion.