• Madhavi B T
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I created a Lightning Component that will update the value of the field "Submit Go-No Go Question?" from the Opportunity Object.

I created the following:
Apex Class - updateCheckBoxPlan
=================================
public class updateCheckBoxPlan {
@AuraEnabled
public static void updateCheck(){
list Pl_list = new list();
pl_list = [select id,Opportunity.Submit_Go_No_Go_Question__c from Opportunity Limit 1];
Opportunity p =new Opportunity();
p.id=pl_list[0].id;
p.Opportunity.Submit_Go_No_Go_Question__c=true;
update p;
}
}
=================================
Component - Submit
=================================
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" controller="updateCheckBoxPlan">
    <aura:attribute name="updateCheckBox" type="Opportunity" default="{'sobjectType':'Opportunity'}"/>
    <lightning:button variant="brand" label="Confirm" onclick="{!c.updateCheck11}"  />
</aura:component>
=================================
Controller - SubmitGNGController
=================================
({
updateCheck11 : function(c, e, h) {
h.updateCheck11_helper(c,e,h);
},
})
=================================
Helper - SubmitGNGHelper
=================================
({
updateCheck11_helper : function(c,e,h) {
alert('Success!');
var save_action = c.get("c.updateCheck");
save_action.setParams({
});
$A.enqueueAction(save_action);
}
})
=================================

Any help is much appreciated!
Hi  
I am new in salesforce  i am beginner so please help me


Thanks in advance
 
I have two custom objects say custobj1 and custobj2. In custobj1, In custobj1, I have a date/time field say date_time_custobj1__C and in custobj2 I have another  field but its only date field say date__custobj2__c. Now I need to compare values in these two fields If One Field value is greater then another filed value thats the condition is i enter less value compare to other filed then its throughs the error using trigger   So Please Help me How to use trigger for this what i do write in trigger for this Scenario 
trigger Example123 on Case (before insert, before update) {

    public List <Account> lstAcc =  new List<Account>();
    public Id accountOwner;
   /* For (Case c : Trigger.new){
        lst.add(c.id);
    }*/
    //system.debug('******' +lst);
     list<case> cc= [select id,AccountId, case.Account.OwnerId, AdditionalCon__c from case where id =: Trigger.new];
     system.debug('******' +cc);
     
      for(Case cas : cc){
      lstAcc = [Select Id, Ownerid from Account where Id  =: cas.AccountId]; 
      }
     for (Case c: cc){ 
       // system.debug('c.account.Ownerid**********'+c.account.Ownerid);     
         if((Trigger.isInsert || Trigger.isUpdate ) && Trigger.isBefore ){  //Before Insert       
            //system.debug('c.account.Ownerid**********'+c.account.Ownerid);  
             if(c.AdditionalCon__c ==null ){

                for(Account a : lstAcc ){
                    if(c.AccountId == a.Id){
                    accountOwner = a.OwnerId;
                    }   
                } 
                 
               system.debug('AccountOwner**********'+accountOwner);  
               c.AdditionalCon__c = accountOwner; 
               system.debug('AdditionalCon :' +c.AdditionalCon__c);
           }
       } 
          //lst.add(c);
    }
    
        //update lst;
           }