• Amrin.
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies
 

Hi,

 

I need help in updating a parent record field with Yes or No value.

 

When I create a child record with lookup field value as hardcoded value, trigger get save but doesnt allow to save child record.

This is the code i am not able to save the child record. On child record I have visualforce page.

 

trigger ENT_Trigger_PopulateDistressedAA on ENT_NMTC_Distressed_Area_Association__c (after insert, after update)
{
    set<id> DealIDs = new set<id>();
    set<id> DdataIDs = new set<id>();
    
    for(ENT_NMTC_Distressed_Area_Association__c l : trigger.new)
    {
        DealIDs.add(l.NMTC_Deal__c);
    }
   
    List<ENT_NMTC_Deal__c> deals= [select id, PovRate2530__c from ENT_NMTC_Deal__c where id in :DealIDs ];
    
      deals[0].PovRate2530__c = 'No';
      
        
  for(ENT_NMTC_Distressed_Area_Association__c l : trigger.new)
        { 
        
           if(l.NMTC_Deal__c == 'Poverty Rates Greater Than 25 Percent')
           {
            deals[0].PovRate2530__c = 'Yes';
           
           }

        else

         {
             deals[0].PovRate2530__c = 'No';  
         }
        }
    update deals;    
}

 

This code executes but doesnt work...

As i have VF page on child object its not allowing me to save the record.

 

I feel its a lookup field (NMTC_Deal__c) so its not reading the value.. may be I am wrong.

 

Please help!!!!

 

bob_buzzard can u pls help??

  • December 28, 2012
  • Like
  • 0

Suppose there is a VF

 

<apex:page standardController="Acc" extensions="Acc_Ext">

    <apex:commandButton action={!Run} value="Run">

</apex:page>

 

In Acc_Ext I want to call a method from another class i.e Sub_Acc_Ext. And Sub_Acc_Ext has got method as Run()

How to call this Run() in my Acc_Ext class????

 

Please help!!!!!!!!!!!!!!

  • December 19, 2012
  • Like
  • 0

In formula its displaying me record id, I want to display a record name. What is the possible way I tried adding TEXT() at the begnning but its not working.

 

 NMTC_Fund_Partnership__r.NMTC_Fund__r.General_Partner_Master_Allocatee__c 

 

Here in formula  "General_Partner_Master_Allocatee__c" is lookup field. 

  • October 30, 2012
  • Like
  • 0

I am getting following error..


Error: t Compile Error: Constructor not defined: [selectOption].<Constructor>(String, String) at line 11 column 20

Please help

 

VFP :

 

<apex:page controller="t">
<apex:form >
  <apex:pageBlock >
  
      <apex:actionFunction name="RenderSection" action="{!RenderSec}"/>
  
      <apex:pageBlockSection>
          <apex:selectList multiselect="false" size="1" onChange="RenderSection() ;" value="{!SelectedVal}">
              <apex:selectOption itemLabel="--None--" itemValue=""/>
              <apex:selectOptions value="{!myList}"/>
          </apex:selectList>
      </apex:pageBlockSection>
  
      <apex:pageBlockSection rendered="{!showAccount}">
          <apex:outputLabel value="This Section will show account fields"/>
      </apex:pageBlockSection>
  
      <apex:pageBlockSection rendered="{!showContact}">
          <apex:outputLabel value="This section will show contact fields"/>
      </apex:pageBlockSection>
  
  </apex:pageBlock>
</apex:form>
</apex:page>

 Class :

public class t
{
    public List<SelectOption> myList {get; set;}
    public boolean showAccount {get; set;}
    public boolean showContact {get; set;}
    public String SelectedVal {get; set;}
    
    public t()
    {
        myList = new List<SelectOption>() ;
        myList.add(new SelectOption('Account' , 'Account')) ;
        myList.add(new SelectOption('Contact' , 'Contact')) ;
        
        showAccount = false ;
        showContact = false ;
        SelectedVal = '' ;
    }
    
    public PageReference RenderSec()
    {
        if(SelectedVal == 'Account')
        {
            showAccount = true ;
            showContact = false ;
        }
        if(SelectedVal == 'Contact')
        {
            showAccount = false ;
            showContact = true ;
        }
        return null ;
    }
}
  • October 26, 2012
  • Like
  • 0

Hi,

Currently I have 4 objects A,B,C and D these are the parent object for Object O.  So when I come from record A, on object O page layout i want to display only A's lookup field and hide rest 3  lookup fields B,C, D.

Similarly when I come from record B, on O's page layout I want to display B's lookup field and hide 3 rest lookup fields A,C, D.

And so on for remaining 2 objects..

 

I know this can be achieved through record type, but in my requirement they dont want to achieve it through standard record type so I want to use Visualforce page to avoid record type selection menu.

 

I have done some initial hands on but not getting up to the mark... please help!!!!

 

NOTE:I have replaced Fund, CDE, Allocatee and Project with A, B, C and D and program with O.

 

<apex:page standardController="program__c" extensions="Program_Ext" id="pagecamt">
<apex:form id="frmCmpt">

<apex:pageBlock tabStyle="program__c" >
<apex:pageBlockButtons >

<apex:commandButton action="{!save}" value="Save" />
<apex:commandButton action="{!Cancel}" value="Cancel" />

</apex:pageBlockButtons>



<apex:pageBlockSection title="Information" columns="1">

<apex:inputField value="{!program__c.Name}" id="inputTypeField" required="true" />

<apex:inputField value="{!program__c.Fund__c}" id="form2" rendered="{!showlen}" />
<apex:inputField value="{!program__c.CDE__c}" id="form3" rendered="{!showlen1}" />
<apex:inputField value="{!program__c.Allocatee__c}" id="form4" rendered="{showlen2}" />
<apex:inputField value="{!program__c.Project__c}" id="form5" rendered="{!showlen3}"/>


</apex:pageBlockSection>



</apex:pageBlock>
</apex:form>
</apex:page>

 

CONTROLLER

 

public class Program_Ext {

public Program_Ext(ApexPages.StandardController controller) {

}


public Boolean showLen {
get {
if (program__c.Fund__c!= null && program__c.CDE__c == null && program__c.Allocatee__c== null && program__c.Project== null ) {
return true;
} else {
return false;
}
}
set;}

public Boolean showLen1 {
get {
if ( program__c.CDE__c != null && program__c.Fund__c == null && program__c.Allocatee__c  == null &&  program__c. Project__c == null) {
return false;
} else {
return true;
}
}
set;}

 

 public Boolean showLen2 {
get {
if ( program__c.Allocatee__c != null && program__c.CDE__c == null && program__c.Fund__c == null &&  program__c. Project__c == null) {
return false;
} else {
return true;
}

set;}

 

public Boolean showLen1 {
get {
if ( program__c.CDE__c == null && program__c.Fund__c == null && program__c.Allocatee__c ==null && program__c. Project__c != null) {
return false;
} else {
return true;
}

set;}

}

 

 

its still showing all the lookup fields on Vf and not hiding any.. please help

 

  • October 21, 2012
  • Like
  • 0

Can anybody tell me how to add calendar on visualforce page... 

  • September 15, 2011
  • Like
  • 0

Suppose there is a VF

 

<apex:page standardController="Acc" extensions="Acc_Ext">

    <apex:commandButton action={!Run} value="Run">

</apex:page>

 

In Acc_Ext I want to call a method from another class i.e Sub_Acc_Ext. And Sub_Acc_Ext has got method as Run()

How to call this Run() in my Acc_Ext class????

 

Please help!!!!!!!!!!!!!!

  • December 19, 2012
  • Like
  • 0

Here is my code, I am getting error as, Error: Unknown property 'Product_Association__cStandardController.Program_Association__c'

 

Please help!!!!!!!!!

I am getting following error..


Error: t Compile Error: Constructor not defined: [selectOption].<Constructor>(String, String) at line 11 column 20

Please help

 

VFP :

 

<apex:page controller="t">
<apex:form >
  <apex:pageBlock >
  
      <apex:actionFunction name="RenderSection" action="{!RenderSec}"/>
  
      <apex:pageBlockSection>
          <apex:selectList multiselect="false" size="1" onChange="RenderSection() ;" value="{!SelectedVal}">
              <apex:selectOption itemLabel="--None--" itemValue=""/>
              <apex:selectOptions value="{!myList}"/>
          </apex:selectList>
      </apex:pageBlockSection>
  
      <apex:pageBlockSection rendered="{!showAccount}">
          <apex:outputLabel value="This Section will show account fields"/>
      </apex:pageBlockSection>
  
      <apex:pageBlockSection rendered="{!showContact}">
          <apex:outputLabel value="This section will show contact fields"/>
      </apex:pageBlockSection>
  
  </apex:pageBlock>
</apex:form>
</apex:page>

 Class :

public class t
{
    public List<SelectOption> myList {get; set;}
    public boolean showAccount {get; set;}
    public boolean showContact {get; set;}
    public String SelectedVal {get; set;}
    
    public t()
    {
        myList = new List<SelectOption>() ;
        myList.add(new SelectOption('Account' , 'Account')) ;
        myList.add(new SelectOption('Contact' , 'Contact')) ;
        
        showAccount = false ;
        showContact = false ;
        SelectedVal = '' ;
    }
    
    public PageReference RenderSec()
    {
        if(SelectedVal == 'Account')
        {
            showAccount = true ;
            showContact = false ;
        }
        if(SelectedVal == 'Contact')
        {
            showAccount = false ;
            showContact = true ;
        }
        return null ;
    }
}
  • October 26, 2012
  • Like
  • 0

Can anybody tell me how to add calendar on visualforce page... 

  • September 15, 2011
  • Like
  • 0

 

Hi

 

 I want to create a custom button in opportunity layout page, such that when I click the button, a section in opportunity should become hidden. When I click again it should appear again. Basically it should hide/unhide on successive clicks