function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Praveen NPraveen N 

value is not setting to VF page.

Hi ,

 

I am using same VF and class for new reocrd creation and editing the record. i have one select list generating values dynamically. while editing the record it is not setting the actual value(which was selected in creation) to select list .

i am not putting the logic to dynamically generating select list values. while editing it is setting values to reamining fields but not for select list . is there any solution for this?

Visual force page:

 

<apex:page Controller="DGApprovalBusinessReview" tabStyle="Approval__c" id="apppage" action="{!initialize}">

<apex:form id="appform" >
<apex:sectionHeader title="Approval" subtitle="{!Oppty.Name}"/>
<apex:pageBlock title="Approval Request Form: Business Review" id="apppageblock">
<apex:actionFunction name="EnableSWSections" action="{!SWSpecificSection}" rerender="apppageblock" status="Refreshing"/>
<apex:actionFunction name="SoftwareField" action="{!SoftwareSelection}" reRender="Opptyp,ela" status="Refreshing" />

<apex:pageBlockButtons >
<apex:commandButton action="{!customSave}" value="Save" />
<apex:commandButton action="{!Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" title="Opportunity Information" id="pbsec">
<apex:outputField value="{!Oppty.Opportunity_ID__c}"/>
<apex:outputField label="Opportunity Type" value="{!Oppty.Type}"/>
<apex:SelectList value="{!approvalObj.Solution_Mix__c}" id="solmix" size="1" onchange="EnableSWSectionsJS();">
<apex:selectoptions value="{!solutionmixvals}" />
</apex:SelectList>
</apex:pageBlockSection>

<apex:pageBlockSection columns="1" title="BG Specific Information(SW)" id="swsection" rendered="{!IF( SolutionMix == 'Product',true,false)}">
<apex:pageBlockSection columns="2" title="Opportunity Type" id="Opptyp">
<apex:inputField value="{!approvalObj.Software__c}" id="Software" />
<apex:inputField label="Support Type" value="{!approvalObj.Support_Type__c}" id="supprttyp" />
</apex:pageBlockSection>

<apex:pageBlockSection columns="1" title="BG Specific Information(SW)" id="swsectionservices" rendered="{!IF(SolutionMix == 'Service',true,false)}">
<apex:pageBlockSection columns="2" title="Opportunity Type" id="Service-Opptyp">
<apex:inputField label="Services" value="{!approvalObj.Services__c}" id="Services"/>
<apex:inputField label="Education" value="{!approvalObj.Education__c}" id="Education"/>
<apex:inputField label="SaaS" value="{!approvalObj.SaaS__c}" id="saas" />
<apex:inputField label="3rd Party Products + Services" value="{!approvalObj.Third_Party_Products__c}" id="thirdproduct" />
<apex:inputField label="Is Deal being financed?" value="{!approvalObj.Is_Deal_being_financed__c}" />
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>


</script>
</apex:page>

 

 

Apex class:

 

 

 

 

public with sharing class DGApprovalBusinessReview{
public String id;
public String rectypeid{get;set;}
public String AppId;
public String OptyId;
public Approval__c approvalObj{get;set;}
public Opportunity oppty {get; set;}
public List<SelectOption> solutionMixVals{set;get;}

public DGApprovalBusinessReview() {
OptyId = ApexPages.currentPage().getParameters().get('Id');
AppId = ApexPages.currentPage().getParameters().get('AppId');
Opp = [select Amount from Opportunity where Id =:OptyId];
If(ApexPages.currentPage().getParameters().get('RecordType') != null)
{
rectypeid=ApexPages.currentPage().getParameters().get('RecordType');
}
If(AppId != null && AppId != '')// for if record is editing.
{

approvalObj = [SELECT Solution_Mix__c,Software__c,Support_Type__c,Services__c,Education__c,SaaS__c,Third_Party_Products__c FROM Approval__c where id =:AppId];
solutionMixVals=new List<SelectOption>();
SolutionMix();
}
else
{
approvalObj = new Approval__c(Opportunity__c=OptyId,RecordTypeId=rectypeid);
solutionMixVals=new List<SelectOption>();

}
}

Public PageReference SWSpecificSection(){

SolutionMix = approvalObj.Solution_Mix__c;
solMix=approvalObj.Solution_Mix__c;
return null;
}

Public PageReference SoftwareSelection(){


IsSoftware = approvalObj.Software__c;
if(IsSoftware!= null){
if(IsSoftware.Contains('Private Stack Perpetual Lic to ES (ELA)') || IsSoftware.Contains('License + Support (ELA)'))
IsELA = true;
else
IsELA = false;
}
return null;
}
public PageReference customSave(){
try{

If(AppID != null && AppID != '')
{
update approvalObj;
}
else
{
approvalObj.status__c='Open';
system.debug('RecordType'+rectypeid);
approvalObj.RecordTypeId=rectypeid;
insert approvalObj;
}
PageReference pr = new PageReference('/apex/DGApprovalBusinessReviewDetail?Id='+approvalObj.id);
pr.setRedirect(true);

return pr;
}catch(Exception e){
ApexPages.addmessages(e);
return null;
}
}

 

}

 

Thanks in advance.

 

Praveen