You need to sign in to do that
Don't have an account?
Approve list of Records in a single button click- Approve
I would appreciate if someone would help me in achieving this
This is custom approval process
List of records in Table are child records of Quote. Clik Here Existing Look & Feel
Existing functionality - on Click of Approve Button That particular Row will be updated, In code we are passing the Id through Param
<apex:form > <apex:pageBlock title="Custom Approval" id="pg"> <apex:pageBlockButtons location="top"> <apex:commandButton value="Manual Add" /> <apex:commandButton value="Send All"/> <apex:commandButton value="Remove All"/> </apex:pageBlockButtons> <apex:pageBlockSection id="pgs" columns="1"> <apex:pageBlockTable value="{!childRecs1}" var="temp" id="pgt"> <!--<apex:column value="{!temp.Name}" breakBefore="true">--> <apex:column headerValue="Name"> <apex:outputLink value="/{!temp.Id}" target="_top"> <apex:inputField value="{!temp.Name}"/> </apex:outputLink> </apex:column> <apex:column value="{!temp.Approval__Step_Name__c}" headerValue="Rule" /> <apex:column value="{!temp.Approval__Assigned_To_Name__c}" headerValue="Assigned To" /> <apex:column value="{!temp.Approval__Status_Link__c}" headerValue="Status"/> <apex:column value="{!temp.Approval__Action__c}" headerValue="Approval Action" /> <apex:column value="{!temp.Approval__Approver_Comments__c}" headerValue="Approver Comments"/> <apex:column > <apex:commandButton value="Send Now"/> </apex:column> <apex:column > <apex:commandButton value="Remind"/> </apex:column> <apex:column > <apex:commandButton value="Approve" action="{!Approve}" reRender="pg"> <apex:param value="{!temp.id}" name="CurrentPageName1" assignTo="{!CurrentPageName}"/> </apex:commandButton> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form>
public class QuoteApprove { public List<Approval__Approval_Request__c>childRecs1 {get;set;} public Proposal__Proposal__c appQuote; public Approval__Approval_Request__c appr {get; set;} public String CurrentPageName {get; set;} //Constructor public QuoteApprove(ApexPages.StandardController controller) { appQuote = new Proposal__Proposal__c (id=Apexpages.currentPage().getParameters().get('id')); Proposal__Proposal__c cpqna = [SELECT Id, (SELECT Id, Approval__Approver_Comments__c, Approval__Step_Name__c, Approval__Assigned_To_Name__c,Name, Approval__Approval_Status__c , Approval__Action__c, Approval__Status_Link__c From QPApprov__ApprovalRequests__r) FROM Proposal__Proposal__c WHERE ID =:accid]; childRecs1 = new List<Approval__Approval_Request__c>(); childRecs1 = cpqna.QPApprov__ApprovalRequests__r; } public String accid = System.currentPagereference().getParameters().get('id'); //this method returns the list of Approval records associated to Quote public PageReference Approve() { System.debug('sgfsdfjsfdj:::::::::::::'+CurrentPageName); Approval__Approval_Request__c appr = [SELECT id, Approval__Approval_Status__c, Approval__DateApproved__c FROM Approval__Approval_Request__c Where id=:CurrentPageName limit 1]; appr.Approval__DateApproved__c = datetime.Now(); appr.Approval__Approval_Status__c = 'Approved'; update appr ; //PageReference nextPage =page.QuoteApproveSatya; PageReference nextPage = new PageReference('/apex/Quote_detail_approval?id='+appQuote.id); nextpage.setRedirect(true); return nextPage; } }
Expecting functionality - If Single user have more than 1 record to approve, he should be able to approve list of records in a single click.
Queries - How to update list of child records in a single action
How to show button once for list of records, Rather showing buttons in every single row?