• Avinash Gangadhare
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies
I have a requirement while inserting and updating of information records ,fetch values from opportunity and populate on Information object . opportunity is a lookup field on Information object.I have tried below code using triggers.  please tell me  where did i mistake.Its very urgent. Thanks in advance.

public static void TMOppCompInfo(List<Competitive_Infomation__c> complst)
    {
        
        List<Infomation__c> lstcompinfo = new List<Infomation__c>();
        set<id> oppid = new set<id>();
        Id TMoppRecord = Schema.SobjectType.Opportunity.getRecordTypeInfosByName().get('machinery').getRecordTypeId();
        Id CloseOut = Schema.SobjectType.Competitive_Infomation__c.getRecordTypeInfosByName().get(' Information - Close Out').getRecordTypeId();
        for(Competitive_Infomation__c comp : complst)
        {
            oppid.add(comp.Sub_Opportunity_Name__c);
         }
       
       List<opportunity> lstoppcomp = [select id,Emissions_Unit__c,Emissions_Guaranteed__c,Reason_for_Guarantee__c,Guaranteed_NOx_15_O2_ppm__c,Liquid_NOx_15_O2_ppm__c,
                                        Guaranteed_CO_15_O2_ppm__c,Liquid_CO_15_O2_ppm__c,CBR_Temperature_Range_Unit__c,Temperature_Range__c,
                                       Load_Range_pct__c,CBR_Engine_Emissions_Controls__c from opportunity where id =: oppid and recordType.Name = 'machinery' ];
      IF(lstoppcomp.size()>0)
     {
        for(Competitive_Infomation__c compinfo : complst)
         {
          
           if(compinfo.Emissions_Same_as_Solar__c == 'same' && compinfo.RecordTypeId == CloseOut)
           {
               for(opportunity opplst : lstoppcomp)
              {
              
                  compinfo.NOx_Emissions_15_O2__c = opplst.Guaranteed_NOx_15_O2_ppm__c;
                  compinfo.CO_Emissions_15_O2__c = opplst.Guaranteed_CO_15_O2_ppm__c;
                  compinfo.Liquid_NOx_Emissions_15_O2__c = opplst.Liquid_NOx_15_O2_ppm__c;
                 
               
           }
         }
       }
trigger InsertContact on Account (after insert, after update) {
if( Trigger.isUpdate && Trigger.isAfter){
        AccountContact.AccountBillingModify(Trigger.new);
    }
}


//Handler class

public class AccountContact{
 public static void AccountBillingModify(List<Account> acctList){
        
        Map<Id, Account> accsWithContactMap = new Map<Id, Account>([select id, BillingPostalCode, (select Id, MailingPostalCode from Contacts) 
                                                                    from account
                                                                    where id in :acctList]);
        for (Account acc: acctList){
            for(Contact con : accsWithContactMap.get(acc.Id).Contacts){
                if(acc.BillingPostalCode != con.MailingPostalCode){                    
                    acc.OutofZip__c = true;
                }
            }
        }
    }
}

 
Hi Team,
I have created a VF page using standarController as Opportunity but it is not fetching the opportunity records(same is happening with Contact object too), whereas the same code is working fine with all other standar and custom object.

code below
<apex:page standardController="Contact" recordSetVar="cons">
    <apex:form >
    <apex:pageBlock title="Data from SF" >
        <apex:pageBlockSection title="Sub data" columns="1" >
        <apex:pageBlockTable value="{!cons}" var="c">
           <!-- <apex:column headerValue="Id of account along with link">
                <apex:outputLink value="/{!c.Id}">{!c.Id}</apex:outputLink>
            </apex:column> --->
            <apex:column value="{!c.Name}"/>
           
          </apex:pageBlockTable>
        </apex:pageBlockSection>
        <apex:commandButton value="Next" action="{!Next}"/>
         <apex:commandButton value="Previous" action="{!previous}"/>
  
        </apex:pageBlock>
    </apex:form>
</apex:page>
I have a requirement while inserting and updating of information records ,fetch values from opportunity and populate on Information object . opportunity is a lookup field on Information object.I have tried below code using triggers.  please tell me  where did i mistake.Its very urgent. Thanks in advance.

public static void TMOppCompInfo(List<Competitive_Infomation__c> complst)
    {
        
        List<Infomation__c> lstcompinfo = new List<Infomation__c>();
        set<id> oppid = new set<id>();
        Id TMoppRecord = Schema.SobjectType.Opportunity.getRecordTypeInfosByName().get('machinery').getRecordTypeId();
        Id CloseOut = Schema.SobjectType.Competitive_Infomation__c.getRecordTypeInfosByName().get(' Information - Close Out').getRecordTypeId();
        for(Competitive_Infomation__c comp : complst)
        {
            oppid.add(comp.Sub_Opportunity_Name__c);
         }
       
       List<opportunity> lstoppcomp = [select id,Emissions_Unit__c,Emissions_Guaranteed__c,Reason_for_Guarantee__c,Guaranteed_NOx_15_O2_ppm__c,Liquid_NOx_15_O2_ppm__c,
                                        Guaranteed_CO_15_O2_ppm__c,Liquid_CO_15_O2_ppm__c,CBR_Temperature_Range_Unit__c,Temperature_Range__c,
                                       Load_Range_pct__c,CBR_Engine_Emissions_Controls__c from opportunity where id =: oppid and recordType.Name = 'machinery' ];
      IF(lstoppcomp.size()>0)
     {
        for(Competitive_Infomation__c compinfo : complst)
         {
          
           if(compinfo.Emissions_Same_as_Solar__c == 'same' && compinfo.RecordTypeId == CloseOut)
           {
               for(opportunity opplst : lstoppcomp)
              {
              
                  compinfo.NOx_Emissions_15_O2__c = opplst.Guaranteed_NOx_15_O2_ppm__c;
                  compinfo.CO_Emissions_15_O2__c = opplst.Guaranteed_CO_15_O2_ppm__c;
                  compinfo.Liquid_NOx_Emissions_15_O2__c = opplst.Liquid_NOx_15_O2_ppm__c;
                 
               
           }
         }
       }
Hi All,

I am trying to create a rollup field from the opportunity to the account. I would like to be able to only roll up the amount of an opportunity if it has closed with in the last 30 days. I created a formula field on the opportunity but it will not allow me to use that in the rollup criteria. 

Is there any other way to accomplish this?

Thanks for your help,
Edward
<apex:page >
  
  <apex:form >
  
  <html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
 $(document).ready(function() {

    $("#name").focusout(function() {
       
         var value =$('#name').val();
         
          if(value==""){
          
                   $('#name_Error').html(" name is Required!");

          }else{
           $('#name_Error').empty();
          
          return true;
          }
    });

});
</script>
</head>
<body>


 <input type="text"  id="name"/><span id="name_Error" class="Errormessage"></span>
 
 <br/>
<apex:inputText styleClass="form-control" html-placeholder="Name"  id="name" /><span id="name_Error" class="Errormessage"></span>

</body>
</html>
</apex:form>
</apex:page>

Hi , here iam using the html input  , the jquery is working , when iam using the apex:input text, the value is not working ?? may i get any solution ?
I have a wiered problem with my org. This came up after i enabled Person Account. Now i don't want to use it but as we cannot disable it i am missing some of basic functionality.

The most basic one is Lookup Fields on Opportunity are not getting saved. Here are the screen shots have a look. I have tried looking into before Trigger, after Trigger, in Workflow, and Process Builders, but not found any clue to my bad luck. Can anyone help with this?
User-added image

User-added image