salesforce - 如何在visualforce的顶点命令按钮中调用参数化控制器?
问题描述
我有以下类型的顶点类
public standardcontroller(){
List<account> accountList = [SELECT Name FROM Account LIMIT 20];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accountList);
List<Account> selected=ssc.getSelected();
}
public PageReference save(List<Account> selected){
if(code logic)
}
视觉力页面包含一个命令按钮
<apex:commandButton action="{!save}" value="Save" id="theButton"/>
从vf页面调用save方法时如何传递选择的参数列表
解决方案
您必须检索该记录的 ID(如果是详细信息按钮)
Id recordId = standardController.getId();
Account record = (Account) standardController.getRecord();
PageReference pdfPage = new PageReference('/apex/YOURVFPAGENAME');
pdfPage.getParameters().put('id',recorded);
现在您有了该记录的 ID,现在您可以根据该 ID 在控制器中执行任何操作。
推荐阅读
- api - 应用程序脚本:将过滤后的范围粘贴到特定列中的下一个空行
- api - PancakeSwap API / 使用 Binance Smart Chain 的 API 交换 BNB
- python-3.x - 更新数据库问题中的信息
- c# - 带有 MVVM 表单的 XAML 从一个用户控件导航到另一个用户控件
- r - 在 Mac 上的 Rstudio 上下载 ggplot 时出现问题
- python - 附加图标时,Pyinstaller 应用程序将无法工作(Macbook)
- c++ - 为什么修改后的引用不会改变线程?
- python - 在python中使用数组预测值
- swift - 用于 macOS Swift AppKit 应用程序的类似 Dock 行为的 API
- python-3.x - 如何在 django-import-export 中使用 ForeignKeywidget 解决 MultipleObjectsReturned