在插入之前选中“输入”复选框-Salesforce
我有一个可视化的强制页面,显示链接到所选父案例的当前子案例 每个子案例都有一个专用的复选框 我需要能够只添加一个评论到选定的子案例,而不是所有的子案例在插入之前选中“输入”复选框-Salesforce,salesforce,apex,Salesforce,Apex,我有一个可视化的强制页面,显示链接到所选父案例的当前子案例 每个子案例都有一个专用的复选框 我需要能够只添加一个评论到选定的子案例,而不是所有的子案例 <apex:outputText value="this is a test" rendered="false" /> <apex:datatable value="{!related}" var="rel" width="80%"> <apex:commandButton valu
<apex:outputText value="this is a test" rendered="false" />
<apex:datatable value="{!related}" var="rel" width="80%">
<apex:commandButton value="Save" action="{!save}"/>
<apex:column headervalue="Select" width="10%">
<apex:inputCheckbox value="{!rel.c.UpdateChildcases__c}"/><p/>
</apex:column>
<apex:column headervalue="Case Number" width="30%">
<apex:outputLink value="/{!rel.c.Id}" target="_blank">{!rel.casenumber}</apex:outputLink><p/>
</apex:column>
<apex:column headervalue="Account Name" width="30%">
<apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.account.name}</apex:outputLink><p/>
</apex:column>
<apex:column headervalue="Subject" width="30%">
<apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.subject}</apex:outputLink><p/>
</apex:column>
</apex:datatable>
<apex:commandButton value="Save" action="{!Save}" />
</apex:form>
</apex:page>
{!相关案例编号}
{!rel.account.name}
{!相关主题}
要插入的注释从文本区域拾取
public with sharing class ParentCases {
public List related {get; set;}
public String mysearchtext {get; set;}
public boolean selected {get; set;}
public ParentCases(ApexPages.StandardController std) {
selected = false;
Case cs = (Case) std.getRecord();
related = [select id, CaseNumber, Subject, description, Status, UpdateChildcases__c , child_update__c, account.name from Case where parentId = :cs.id];
}
public void Save() {
List<CaseComment> childCom = new List<CaseComment>();
for (integer i = 0; i < related.size(); i++) {
CaseComment newCom = new CaseComment();
newCom.CommentBody = mysearchtext;
newCom.IsPublished = TRUE;
newCom.ParentId = related[i].id;
childCom.add(newcom);
}
if (!childCom.isEmpty()) {
insert childCom;
}
}
}
public与共享类ParentCases{
与公共列表相关的{get;set;}
公共字符串mysearchtext{get;set;}
已选择公共布尔值{get;set;}
公共家长案例(ApexPages.StandardController std){
所选=假;
Case cs=(Case)std.getRecord();
相关=[从parentId=:cs.id]的案例中选择id、案例编号、主题、描述、状态、更新案例、子案例更新、帐户名];
}
公共作废保存(){
List childCom=新列表();
对于(整数i=0;i
这将更新所有子记录。我真的需要限制插入到选定的。
??在for循环中检查UpdateChildcases\uu\c字段值:
for (integer i = 0; i < related.size(); i++) {
if (related[i].UpdateChildcases__c) {
CaseComment newCom = new CaseComment();
newCom.CommentBody = mysearchtext;
newCom.IsPublished = TRUE;
newCom.ParentId = related[i].id;
childCom.add(newcom);
}
}
for(整数i=0;i
p.S.解释了如何在不使用自定义布尔字段的情况下实现相同的功能