• amrit
  • NEWBIE
  • 115 Points
  • Member since 2010

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 93
    Questions
  • 123
    Replies
Hi,

I have two trigger on one object RFP__c.
First trigger which will update values on picklist.Second Trigger will execute based on updated picklist value.
These two trigger works independently.Any idea how to execute together.


Thanks
Amritha

Hi,

 

Is it possible to get the count of date field in report. In this  report im not able to get no:of days spent in HeadQuarter,Ex-Station,Out-Station.It shows record count and no:of days spent as 68 . I wanted to know out of those 30 days how many days he worked in Head quarters, Ex-station and outstation.  

 

Thanks

Hi,

 

Im not able to get coverage for formula field.there is a formula field named stage in RFP__c  which is taking value form Opportunity stage.Imgetting 0 coverage if i used opportunity in test class otherwise it is 65%

This is the test class

@isTest
private class TestRFPupdatevaluesTrigger{
 
  static testmethod void testTriggerMethod(){
        try{
            
            Account a= new Account(Name='AccTest1');
             Test.starttest();
            insert a;
           
               Account_Region_c__c ar = new Account_Region_c__c(Name='APAC',Origin_Parent__c=a.id);
                insert ar;
            
               Account_Entity__c ae=new Account_Entity__c(Name='Test12',Account_Region__c=ar.id);
                insert ae;
            
                Contact c=new Contact(LastName='Test1',Account_Region__c=ar.id,Accounts_Entity__c=ae.id);
                insert c;
                                CPI__c cpi=new CPI__c(Completes_Required__c=100,Name='General',Incidence_Rate__c=0.01,Bid_LOI_in_minutes__c=5,Audience__c='Gen Pop',Market__c='India',Actual_CPIchanged__c=3);
                insert cpi;
                CPI__c cpi1=new CPI__c(Completes_Required__c=0,Name='General',Incidence_Rate__c=0.01,Bid_LOI_in_minutes__c=0,Audience__c='Gen Pop',Market__c='India',Actual_CPIchanged__c=0);
                insert cpi1;
                List<RFP__c > rfplist= new List<RFP__c >();
                RFP__c rf=new RFP__c(Name='a',Rate_Card__c='General',Completes_Required__c=100,Incidence_Rate__c=0.01,Bid_LOI_in_minutes__c=5,Audience__c='Gen Pop',Market__c='India');
                insert rf;

               RFP__c rf1=new RFP__c(Name='b',Rate_Card__c='General',Completes_Required__c=0,Incidence_Rate__c=0.0,Bid_LOI_in_minutes__c=0,Audience__c='B2B',Market__c='India');
                insert rf1;
                
                
                 rf=cpi.Actual_CPIchanged__c;
                 rf=cpi.Actual_CPIchanged__c;
                 
                 rf1.Actual_CPI__c=cpi1.Actual_CPIchanged__c;
                 rf1.Proposed_CPI__c=cpi1.Actual_CPIchanged__c;
                System.assertEquals(3, rf.Actual_CPI__c);
                System.assertEquals(0, rf1.Actual_CPI__c);
                update rf;
                update rf1;
                rfplist.add(rf);
                rfplist.add(rf1);


              

Below code is not getting coverage:

 for(RFP__c r : trigger.new){

 

    if((r.Audience__c == 'B2B' || r.Audience__c == 'Gen Pop') && r.Stage__c == 'RFP_Received')
    {    
        aud.add(r.Audience__c);
    }
   
   
}



//If audience is B2B or Genpop
try{
if(aud.size()>0){
    Map<Decimal, CPI__c> cpi1 = new Map<Decimal, CPI__c>();
 
    for(CPI__c obj1 : [SELECT Id, Bid_LOI_in_minutes__c,Actual_CPI__c,Incidence_Rate__c,Actual_CPIchanged__c,Audience__c,Stage__c, Completes_Required__c,Name,Market__c  FROM CPI__c WHERE    (Bid_LOI_in_minutes__c IN :bid
                               AND  Completes_Required__c IN: comp AND Incidence_Rate__c IN:inc AND Audience__c IN:aud AND Name IN:ratecard AND Market__c IN:market)]){
        cpi1.put(obj1.Completes_Required__c , obj1);
        system.debug('CPI'+cpi1);
    }
 
 
    if(cpi1.size()>0){
    
         
        
           for(RFP__c r2 :trigger.new){
                
                        r2.Actual_CPI__c = cpi1.get(r2.Completes_Required__c).Actual_CPIchanged__c;
                        if(r2.Proposed_CPI__c == 0.00 )
                    {
                        r2.Proposed_CPI__c= cpi1.get(r2.Completes_Required__c).Actual_CPIchanged__c;
                                         }
                               
    
    }
   }
    else{
        
           for(RFP__c  r2 : trigger.new){
             
               r2.Actual_CPI__c =0.00;
            }
             
    }
}    
}

catch(exception e){
}


}
           
                           
     

 

 

Hi,

 

Here Im trying to create a trigger where there is master object (Custom object-Opportunity) and child object(RFP).

Im mapping values from other object (Ratecard) when i entered some parameters in RFP.

In RFP there are some parameters(CompletesRequired,BID,Incidence rate,Market,Audience,Ratecard).We have same fields in Ratecard object with Actual CPI (currency) which we are uploading through dataloader.

When i entered these parameters in RFP the ActualCpi will populate automatically in RFP Object.

this scenario is working for one RFP entry.How can i use lists in this case for multiple rfp entry.

 

trigger RFPupdate on RFP__c (before insert, before update) {
 
 
Set<Decimal> comp = new Set<Decimal>();
Set<Decimal> bid  = new Set<Decimal>();
Set<Decimal> inc  = new Set<Decimal>();
List<String> aud  = new List<String>();
List<String> stage = new List<String>();
List<String> stage2 = new List<String>();
List<String> market=new List<String>();
List<String> ratecard =new List<String>();
List<Id> opp=new List<Id>();
 
for(RFP__c r : trigger.new){
 
 
    if(r.Completes_Required__c != null){
        comp.add(r.Completes_Required__c);
       } 
    if(r.Bid_LOI_in_minutes__c != null){ 
        bid.add(r.Bid_LOI_in_minutes__c);
        }
    if(r.Incidence_Rate__c != null)
    {
        inc.add(r.Incidence_Rate__c);
     }
    if((r.Audience__c == 'B2B' || r.Audience__c == 'Gen Pop') && r.Stage__c == 'RFP_Received')
    {    
        aud.add(r.Audience__c);
    }
    if(r.Market__c != null)
    {
        market.add(r.Market__c);
    }
   if(r.Rate_Card__c != null)
   {
     ratecard.add(r.Rate_Card__c);
   }
   if(r.Opportunity__c!=null)
   {
      opp.add(r.Opportunity__c);
      system.debug('Opp*****'+opp);
   }
}
 
//If audience is B2B or Genpop
try{
if(aud.size()> 0){
    Map<Decimal, CPI__c> cpi1 = new Map<Decimal, CPI__c>();
 
    for(CPI__c obj1 : [SELECT Id, Bid_LOI_in_minutes__c,Actual_CPI__c,Incidence_Rate__c,Actual_CPIchanged__c,Audience__c,Stage__c, Completes_Required__c,Name,Market__c  FROM CPI__c WHERE    (Bid_LOI_in_minutes__c IN :bid
                               AND  Completes_Required__c IN: comp AND Incidence_Rate__c IN:inc AND Audience__c IN:aud AND Name IN:ratecard AND Market__c IN:market  )]){
        cpi1.put(obj1.Completes_Required__c , obj1);
        system.debug('CPI'+cpi1);
    }
 
    // We have all the reference data we need, last loop on the each Opportunity
 
    if(cpi1.size()>0){
    
       system.debug('CPISize@@@@@@@'+cpi1.size());
        for(RFP__c rf1: trigger.new){
         
                system.debug('^^^^^^^^^^^^^^^RFP'+rf1);
                rf1.Actual_CPI__c = cpi1.get(rf1.Completes_Required__c).Actual_CPIchanged__c;
                   system.debug('ActualCPI################'+rf1.Actual_CPI__c);
                    if(rf1.Proposed_CPI__c == 0.00 ){
                        rf1.Proposed_CPI__c= cpi1.get(rf1.Completes_Required__c).Actual_CPIchanged__c;
                        system.debug('ProposedCPI##############'+rf1.Proposed_CPI__c);
                    }
                               
       
        
        }
    
   } 
    else{
        for(RFP__c  rf1 : trigger.new){
            
               rf1.Actual_CPI__c =0.00;
            
        }      
    }
}    
}
 
catch(exception e){
}
 
}

Hi,

 

I have created a time dependent workflow .

The rule criteria is NOT(ISBLANK(Closed_Date__c)) && (TODAY() <= Closed_Date__c) && OR(NOT(ISPICKVAL(Stage__c , 'RFP_Status_Won')),NOT(ISPICKVAL(Stage__c , 'RFP_Status_Lost')))

 

Closed date is date field which is updating through other workflow.it will calculate as Bid date+60

 

Here time dependent workflow will only work when deactivate other workflow.But i cannot deactivate the other workflow on closed date .Is there any solution for this

 

Hi,

 

 Im using dupecatcher to avoid duplicate leads. I have issues in lead page there are three email field ie
Email1, Email2, Email3. I have entered 'test@gmail.com' in Email1 field in first lead. If I enter same email id in Email2  field in second lead alert is not throwing. Dupecatcher will only throw exception if i enter email id in corresponding field ie Email1 field.I checked with dupecatcher support team ,this was their reply
If the Filter checks Leads, then it’s not possible to cross match rules.
The only way to cross match rules in DupeCatcher is
if you have a multi-object filter (Lead against Contact or Account).
Hence it is not possibel through Dupe catcher .Is there any other way to solve this issue

 

Thanks

Hi,

 

I have a trigger in opportunity where im updating a currency fields (Proposed value, Actual value) when stage is 'Received'. 

Proposed value is an editable field.I can update the value in Proposed Value .But When i changed the Proposed value and update stage as 'Submitted' .The value is not getting updated. It s showing old value.

 

trigger CPIupdatevalues on Opportunity__c (before insert, before update) {


Set<Decimal> comp = new Set<Decimal>();
Set<Decimal> bid  = new Set<Decimal>();
Set<Decimal> inc  = new Set<Decimal>();
List<String> aud  = new List<String>();
List<String> stage = new List<String>();

List<String> market=new List<String>();
List<String> ratecard =new List<String>();

for(Opportunity__c l : trigger.new){

   if(l.Stage__c == 'Received'){
    if(l.Stage__c == 'Received'){
        stage.add(l.Stage__c);
    }
 
    if(l.Completes_Required__c != null){
        comp.add(l.Completes_Required__c);
       } 
    if(l.Bid_LOI_in_minutes__c != null){ 
        bid.add(l.Bid_LOI_in_minutes__c);
        }
    if(l.Incidence_Rate__c != null)
    {
        inc.add(l.Incidence_Rate__c);
     }
    if(l.Audience_B2B_B2C__c == 'B2B' || l.Audience_B2B_B2C__c == 'Gen Pop' &&l.Audience_B2B_B2C__c != 'Niche' )
    {    
        aud.add(l.Audience_B2B_B2C__c);
    }
    if(l.Market__c != null)
    {
        market.add(l.Market__c);
    }
   if(l.Rate_Card__c != null)
   {
     ratecard.add(l.Rate_Card__c);
   }
}
}

//If audience is B2B or Genpop
try{
if(aud.size()> 0){
    Map<Decimal, CPI__c> cpi1 = new Map<Decimal, CPI__c>();


    for(CPI__c obj1 : [SELECT Id, Bid_LOI_in_minutes__c,Actual_CPI__c,Actual_CPIchanged__c,Audience__c,Stage__c, Completes_Required__c,Name,Market__c FROM CPI__c WHERE    Bid_LOI_in_minutes__c IN :bid
                               AND  Completes_Required__c IN: comp AND Incidence_Rate__c IN:inc AND Audience__c IN:aud AND Name IN:ratecard AND Market__c IN:market AND Stage__c IN:stage ]){
        cpi1.put(obj1.Completes_Required__c , obj1);
        system.debug('CPI'+cpi1);
    }
    system.debug('@@@@@@@@@@@@@@<@@@cpi @@@@@@@@'+'cpi1 ');

    // We have all the reference data we need, last loop on the each Opportunity


    if(cpi1.size()>0){
        for(Opportunity__c l1 : trigger.new){
             
                l1.ActualValue__c = cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c;
                    if(l1.ProposedValue__c == 0 ){
                        l1.ProposedValue__c= cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c;//Updating Proposed value    
                    
                    }
            
        }  
        
    }
    else{
        for(Opportunity__c l1 : trigger.new){
            
                l1.Actual_CPI__c =0;
            
        }      
    }
    
}
}
catch(exception e){
}
}

 

Anyidea why it was not updating

Hi

 

I have created a workflow in Opportunity.

If Opportunity stage doesn’t close (won or lost) on or before Expected date of closure__c. Stage should automatically update as RFP_Unknown.An email alert should sent to Accunt manager.

Expected Date of closure__c is date field in opportunity which is calculating thrugh workflow field update (Bidsentdate__c(date field)+60=Expected date of closure__c  if Bidsentdate__c is filled).

I set criteria as

AND(Opportunity(C): Stagenot equal toRFP_Status_Won,RFP_Status_Lost (Expected Dateof closure < today OR Expected Dateof closure = today))
Always stage is updating as RFP_Unknown.Is this bcz of other workflow
 
Can anyne help on this issue
 
 

Hi,

 

I have a trigger which updating values in two fields ActualCPI and Proposed CPI.Here im able to insert the values in both field. Proposed CPI is an editable field.I want to change the value in Proposed CPI.But Im not able to update the value in Proposed CPI.

How can we make a field editable in trigger.

 

trigger CPIupdatevalues on Opportunity__c (before insert, before update) {


Set<Decimal> comp = new Set<Decimal>();
Set<Decimal> bid = new Set<Decimal>();
Set<Decimal> inc=new Set<Decimal>();
List<String> aud=new List<String>();

List<String> market=new List<String>();
List<String> ratecard =new List<String>();

for(Opportunity__c l : trigger.new){
    if(l.Completes_Required__c != null){
        comp.add(l.Completes_Required__c);
       } 
    if(l.Bid_LOI_in_minutes__c != null){ 
        bid.add(l.Bid_LOI_in_minutes__c);
        }
    if(l.Incidence_Rate__c != null)
    {
        inc.add(l.Incidence_Rate__c);
     }
    if(l.Audience_B2B_B2C__c == 'B2B' || l.Audience_B2B_B2C__c == 'Gen Pop' &&l.Audience_B2B_B2C__c != 'Niche' )
    {    
        aud.add(l.Audience_B2B_B2C__c);
    }
    if(l.Market__c != null)
    {
        market.add(l.Market__c);
    }
   if(l.Rate_Card__c != null)
   {
     ratecard.add(l.Rate_Card__c);
   }
}


if(aud.size()> 0)
{
Map<Decimal, CPI__c> cpi1 = new Map<Decimal, CPI__c>();


for(CPI__c obj1 : [SELECT Id, Bid_LOI_in_minutes__c,Actual_CPI__c,Actual_CPIchanged__c,Audience__c, Completes_Required__c,Name,Market__c FROM CPI__c WHERE    Bid_LOI_in_minutes__c IN :bid
                               AND  Completes_Required__c IN: comp AND Incidence_Rate__c IN:inc AND Audience__c IN:aud AND Name IN:ratecard AND Market__c IN:market  ]){
    cpi1.put(obj1.Completes_Required__c , obj1);
    system.debug('CPI'+cpi1);
}
system.debug('@@@@@@@@@@@@@@<@@@cpi @@@@@@@@'+'cpi1 ');



if(cpi1.size()>0 ){

for(Opportunity__c l1 : trigger.new){

  
     
        l1.Actual_CPI__c = cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c;
        l1.CPI_in__c = cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c ;//Here Im updating Proposed CPI
       
       
    
}

}


else
{
for(Opportunity__c l1 : trigger.new){
    l1.Actual_CPI__c =0;
    
    }
}

}
if(aud.size()== 0)
{

// Now we have a set of unique bid names we want to verify, time to look them up.


for(Opportunity__c l : trigger.new){
    l.Actual_CPI__c =0;
    
    }


}



}

 

if(cpi1.size()>0 ){

for(Opportunity__c l1 : trigger.new){

  
     
        l1.Actual_CPI__c = cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c;
        l1.CPI_in__c = cpi1.get(l1.Completes_Required__c).Actual_CPIchanged__c ;//Proposed CPI
       
        system.debug('ActualCPI'+ l1.Actual_CPI__c);
        
    
}

}

 

 

Hi,

 

I have created a trigger in a custom object to update a currency field Actual CPi .I want Same field to update in another field Proposed CPi which is editable.Hence i used workflow to update Actual CPI in Proposed CPI.When i create a new record the Actaul CPI will update the value.But Proposed CPi doesnt update the Actual CPI. 

Based on execution order trigger will run first .How can i update the workflow when i create the record.

 

I used this formula for workflow :

ISCHANGED(ActualCPI)

criteria:Evaluate the rule when a record is created, and every time it’s edited

Thanks