• Srini
  • NEWBIE
  • 90 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 67
    Replies
Hi Team,

Can any one please help me to create a Validationrule for below senario.
 
Is this approvedRequest #Approval Status
<Blank><Blank>Not Submitted
<Blank><Completed>Submitted for Approval
Yes<Completed>Approved
Yes<Blank>Not Submitted
No<Completed>Rejected
No<Blank>Not Submitted


Thanks in Advance
Hi Team,

We have a requirement to create batchapex. Mentioned the senario below.We have two fields(Checkboxes) are avalable in Opprtunity.
1.Last 30 days (Formula)
2.Last 30 Days (Workflow)

3.Last 730 days (Formula)
4.Last 730 Days (Workflow)

Hear If Formula field(Last 30 days)is true then workflow field(Last 30 Days) automatically should be true ,Similorly same to Last 730 days(Formula)is true  it should be true  for Last 730 Days (Workflow). Can any one please help us to create batch apex for the above requirement.

Thanks in Advance
Hi Team,

We have updated the Total_Sw_Channel_Manager__c and Total_Sw_Account_Manager__c field on opportunity using trigger which is working fine mentiiend below.But problem is this is effecting some other functionality.So we want to create batch apex based on below trigger logic.Can any one please help me to creating batch logic.

trigger OpportunitySplitTrigger on OpportunitySplit (after insert,after update, before delete,after unDelete) 
{
    set<id> oppIds = new set<id>();
    if(trigger.isafter)
    {
        for(OpportunitySplit opsp : trigger.new)
        {
            if((trigger.isupdate && opsp.Role_Name__c != trigger.oldmap.get(opsp.id).Role_Name__c ) || trigger.isinsert)
            oppIds.add(opsp.opportunityId);
        }
    }
    if(trigger.isbefore && trigger.isdelete)
    {
        for(OpportunitySplit opsp : trigger.old)
        {
            if(RecourssionClass.iscalledsplitdeletefunctionality == false){
                RecourssionClass.iscalledsplitdeletefunctionality = true;
                //oppIds.add(opsp.opportunityId);
            }
        }
    }
    
    if(oppIds.size()>0)
    {
        list<opportunity> lstOppToUpdate = new list<opportunity>();
        for(Opportunity opp : [select id,Total_Sw_Channel_Manager__c,Total_Sw_Account_Manager__c,(select id,Role_Name__c  from OpportunitySplits where Role_Name__c ='SW Account Manager' OR Role_Name__c ='SW Channel Manager') from opportunity where id in:oppIds])
        {
            integer sumAcMngr =0;
            integer sumChMgnr =0;
            if(opp.OpportunitySplits.size()>0)
            {
                for(OpportunitySplit oSplit : opp.OpportunitySplits)
                {
                    if(oSplit.Role_Name__c =='SW Account Manager' )
                        sumAcMngr+=1; 
                    else if(oSplit.Role_Name__c =='SW Channel Manager')
                        sumChMgnr +=1;
                }
            }
            opp.Total_Sw_Channel_Manager__c = sumChMgnr;
            opp.Total_Sw_Account_Manager__c= sumAcMngr;
            lstOppToUpdate.add(opp);
        }
        if(lstOppToUpdate.size()>0)
            update lstOppToUpdate;
    }
}

Thanks in Advance