You need to sign in to do that
Don't have an account?
LoneStar69
Updating selected records using a custom button
Hi Guys,
I am trying to create a custom button on list view that allows updation of selected records.
VF Page -
<apex:page standardController="Test__c" extensions="SetUpdation" sidebar="false" showHeader="false">
<apex:form >
<apex:pageBlock title="Update">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Test__c.Situation__c}" />
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!todo}" value="Save" status="closer"/>
<apex:commandButton value="Cancel" action="{!cancel}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller -
public with sharing class SetUpdation {
ApexPages.StandardController stdcontroller ;
public SetUpdation(ApexPages.StandardController controller) {
stdcontroller = controller;
}
public PageReference todo(){
stdcontroller.save();
return (new pagereference('/apex/confirm').setredirect(true));
}
}
Now how to code this to update the selected records.
As i don't have that logic in place, it just creates a new record on Test__c when clicking save on my vf page.
Appreciate your help!
Thanks a lot.
I am trying to create a custom button on list view that allows updation of selected records.
VF Page -
<apex:page standardController="Test__c" extensions="SetUpdation" sidebar="false" showHeader="false">
<apex:form >
<apex:pageBlock title="Update">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Test__c.Situation__c}" />
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!todo}" value="Save" status="closer"/>
<apex:commandButton value="Cancel" action="{!cancel}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller -
public with sharing class SetUpdation {
ApexPages.StandardController stdcontroller ;
public SetUpdation(ApexPages.StandardController controller) {
stdcontroller = controller;
}
public PageReference todo(){
stdcontroller.save();
return (new pagereference('/apex/confirm').setredirect(true));
}
}
Now how to code this to update the selected records.
As i don't have that logic in place, it just creates a new record on Test__c when clicking save on my vf page.
Appreciate your help!
Thanks a lot.
Hi , I assume that you wan to select the records in the visualforce page and want to save only those records ?
I am trying to place a custom button on the list view to perform a mass update of the selected records.
Something like - https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=906F0000000AZlAIAW
But i am unable to code to make this work for the selected records.