LoginSignup
0
0

More than 3 years have passed since last update.

apex:commandLink で action を実行完了後に VF にリダイレクトさせる

Posted at

めもです

やりたいこと

ボタンクリックで非同期で Apex の処理を実行し、完了後に VF にリダイレクトしたい。
例:自前のリストビューで指定のレコードを削除するボタンをクリックし、処理が完了したら画面を再読み込みしたい。

やりかた

<apex:commandLink value="レコード削除" action="{! deleteRecord }">
    <apex:param name="foo" value="bar" assignTo="{! foobarVal }" />
</apex:commandLink>
public PageReference deleteRecord() {

    // レコード削除処理

    String routing = '/apex/MyVfPage';
    PageReference newView = new PageReference(routing);
    newView.setRedirect(true);
    return newView;
}

クエリ文字列が必要な場合は末尾に /apex/MyVfPage?foo=bar のように追加する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0