You need to sign in to do that
Don't have an account?
priya bhawna shetty
vf related:want to see only updated opportunity,when click save.
hello guys
hope all doing well
heres my problem again
i displayed list of opportunity names along with Editable input field stagenames parallelly so when i enter any stagename and after clicking save ,only modified opportinities should be updated, not all ,
heres the process i did
1.for previous value of stagename i have taken map i.e with map. map<id,string> map9=new map<id,string>(); id=opportunity id and string=stagename.
2.in for loop i put if condition comparing previous value and current value.
3.now i throwed all map values to list by declaring new list.
4.i updated opportunity in new list.
5.i did all this in "hitme" button method
HERES MY PAGE AND CONTROLLER:
<apex:page controller="opportunitydisplaycon9" id="thePage">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!hitme}" value="hitme"/>
</apex:pageBlockButtons>
<apex:dataTable value="{!opportunity}" var="opp" id="theTable" styleClass="tableClass">
<apex:facet name="caption">opportunity Details</apex:facet>
<apex:column >
<apex:facet name="header">opportunity Name</apex:facet>
<a href="/{!opp.Id}">{!opp.name}</a>
</apex:column>
<apex:column >
<apex:facet name="header">opportunity stage</apex:facet>
<apex:inputField value="{!opp.stagename}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class opportunitydisplaycon9 {
public List<opportunity> opp9;
map<id,string> map9=new map<id,string>();
public PageReference hitme() {
opportunity opp;
for(opportunity opp:opp9)
{
if(opp.stagename!=map9.get(opp.id).stagename)
{
list<opportunity> list9=new list<opportunity>();
list9.addall(map9);
update opp9;
return null;
}
public List<opportunity> getopp9()
{
opp9 = [select name,stagename from opportunity limit 10];
return opp9;
}
}
THANKS
hope all doing well
heres my problem again
i displayed list of opportunity names along with Editable input field stagenames parallelly so when i enter any stagename and after clicking save ,only modified opportinities should be updated, not all ,
heres the process i did
1.for previous value of stagename i have taken map i.e with map. map<id,string> map9=new map<id,string>(); id=opportunity id and string=stagename.
2.in for loop i put if condition comparing previous value and current value.
3.now i throwed all map values to list by declaring new list.
4.i updated opportunity in new list.
5.i did all this in "hitme" button method
HERES MY PAGE AND CONTROLLER:
<apex:page controller="opportunitydisplaycon9" id="thePage">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!hitme}" value="hitme"/>
</apex:pageBlockButtons>
<apex:dataTable value="{!opportunity}" var="opp" id="theTable" styleClass="tableClass">
<apex:facet name="caption">opportunity Details</apex:facet>
<apex:column >
<apex:facet name="header">opportunity Name</apex:facet>
<a href="/{!opp.Id}">{!opp.name}</a>
</apex:column>
<apex:column >
<apex:facet name="header">opportunity stage</apex:facet>
<apex:inputField value="{!opp.stagename}"/>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class opportunitydisplaycon9 {
public List<opportunity> opp9;
map<id,string> map9=new map<id,string>();
public PageReference hitme() {
opportunity opp;
for(opportunity opp:opp9)
{
if(opp.stagename!=map9.get(opp.id).stagename)
{
list<opportunity> list9=new list<opportunity>();
list9.addall(map9);
update opp9;
return null;
}
public List<opportunity> getopp9()
{
opp9 = [select name,stagename from opportunity limit 10];
return opp9;
}
}
THANKS
Looks like this has been addressed in the other post.
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000A0rNIAS
Reply back if you are still facing any issues.
Regards,
Ashish