Row_CustomAction doesn't refresh update data

Hi there:

I’ve this code was working in v2022

public function pageLoad(): void {
	 $this->CustomActions["VB"] = new ListAction("VB", "Visto Bueno", Allowed: IsLoggedIn(),Method:ActionType::POSTBACK , Select: ActionType::MULTIPLE);
}
public function rowCustomAction(string $action, BaseEntity $row): bool {
    if ($action == "VB") {
    $newRow = ["VB_JefeObra" => "SI"]; 
    $result = $this->update($newRow, ["id_parte" => $row["id_parte"]]);
    if (!$result) { // Failure
        $this->setFailureMessage("Failed to update record, ID = " . $row["id_parte"]);
        return false; // Abort and rollback
    } elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
        $this->setSuccessMessage("Se han actualizado todos los partes seleccionados");
    }
    return true; // Success
}
return true;	
}

In v2022 version, after update the page I got the refreshed data showing.
Now in v2026 version, I get the success message, but the data don't change.
It's updated in the db and it's updated if I refresh the page with F5.
I've tried with POSTBACK,REDIRECT and AJAX method with the same result.

Thanks a lot

Double check your code in Page_Load server event.

You may refer to its documentation, see Example 3.

Hi mobhar:

Thanks for the answer. I’ve rewrited the script according example 3. Just code in Page_Load and not in row_customaction:

public function pageLoad(): void {
	$this->CustomActions["vb_jdo"] = new ListAction(
		"vb_jdo",
		"Dar VB (JdO)",
		IsLoggedIn(),
		ActionType::POSTBACK,  // Tested AJAX, POSTBACK, REDIRECT
		ActionType::MULTIPLE,
		"¿Confirmar VB para los partes seleccionados?",
		"fa-solid fa-check ew-icon",
		"",
		function ($row) {
			return $this->update(
				["VB_JefeObra" => "SI"],             // SET
				["id_parte" => $row["id_parte"]] // WHERE
			) > 0;
		},
		"Success message",
		"Error message"
	);
}

Same behaviour, I get the “Success message”, the fields are updated, but the page not refresh the updated values. If I press F5, then I get the updated values

Well, I think you need to send your .pmp and .sql file to Support for checking.

1 Like

If you use REDIRECT, when the user click the custom action button, the user will be redirected, not for your case.

If you use AJAX and you want to refresh, you need to provide the Success argument for the ListAction, it is a JavaScript function name.

If you want to post back and refresh page, you should use POSTBACK. Click Tools -> Update Template to the latest template and try again.

1 Like

Great!! Now it’s working.

Thanks a lot