• prabhakaran Chockalingam 5
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Regex Ends with and Special Characters Questions
I'm currently using regex to determine if a value begins with certain characters like this.  (?i)^(BN|LID).*   This would match a string beginning with BN or LID and be case insensitive.  

I'm struggling with the syntax to apply the same logic to ends with.  I know you use the $ for ends with but I'm not sure of the order.  would this be correct?  *.(?i)(BN|LID)$

Also does anyone know how I could include a dash in the logic?  So I would want to know if a string begins with "A-" or ends with "A-1"  
Hi guys,

hope you can help me.

I have this two fields under Project__C namely as Primary_Solution_Series__cand Secondary_Solution_Series__c and another field wherein results/sum are being put namely as Allocated_OEM_Project_Forecast__c.

the scenario is I have a product forecast under agreement which is under project meaning the product forecast is the grand child of project.

under the productforecast there are fields namely Quantity and Product(Primary and Secondary Series)

example is below

User-added image 

what i want is that if S332U if chosen as Primary_Solution_Series__c  it will auto recalculate having the sum 13000 in the  Allocated_OEM_Project_Forecast__c under the Project__c and if Primary_Solution_Series__c is has chosen S3320 it will recalculate having the sum 8500.

another what is the sum of the Allocated_OEM_Project_Forecast__c will also be written on Agreement__c under the field OPA_Lifetime_Product_Forecast__c. wherein the Agreement__c is the child or Project__c

I already have the delete/add function my problem is that when Primary_Solution_Series__c  and Secondary_Solution_Series__c  has changed it doesn't recalculate.
Set<ID> poemId = new Set<ID>();
        Set<ID> poemssId = new Set<ID>();
        Set<ID> pmmfId = new Set<ID>();
        List<Apttus__APTS_Agreement__c> AgreementToUpdate = new List<Apttus__APTS_Agreement__c>();
        List<Project__c> PaneltoUpdate = new List<Project__c>();
        Double pfSum = 0;
        
        for(Project__c pfc: newProject){
            poemId.add(pfc.id);
            poemssId.add(pfc.Primary_Solution_Series__c);
            pmmfId.add(pfc.Secondary_Solution_Series__c);}
        
        for(Apttus__APTS_Agreement__c agr : [select id FROM Apttus__APTS_Agreement__c where  Panel__c =: poemId]){
            poemId.add(agr.id);
        
        for(APTS_Product_Forecast__c pf : [SELECT APTS_Quantity__c , APTS_Price_Agreement__c, Panel__c FROM APTS_Product_Forecast__c WHERE (product_is_primary__c = TRUE OR product_is_secondary__c = TRUE ) AND APTS_Price_Agreement__c != NULL AND  APTS_Price_Agreement__c =: poemId]){
                                                  
            pfSum +=pf.APTS_Quantity__c;
        
        
        for(Project__c prj: [Select Id, Primary_Solution_Series__c, Secondary_Solution_Series__c from Project__c where Id =: poemId]){
            if(prj.Primary_Solution_Series__c != oldMap.get(prj.id).Primary_Solution_Series__c || prj.Secondary_Solution_Series__c != oldMap.get(prj.id).Secondary_Solution_Series__c)
                prj.Allocated_OEM_Project_Forecast__c = pfSum;
            PaneltoUpdate.add(prj);
        }
        
        for(Apttus__APTS_Agreement__c agmt: [Select Id from Apttus__APTS_Agreement__c where ID =: poemId]){
            agmt.OPA_Lifetime_Product_Forecast__c = pfSum;
            AgreementToUpdate.add(agmt);}
    }
Regex Ends with and Special Characters Questions
I'm currently using regex to determine if a value begins with certain characters like this.  (?i)^(BN|LID).*   This would match a string beginning with BN or LID and be case insensitive.  

I'm struggling with the syntax to apply the same logic to ends with.  I know you use the $ for ends with but I'm not sure of the order.  would this be correct?  *.(?i)(BN|LID)$

Also does anyone know how I could include a dash in the logic?  So I would want to know if a string begins with "A-" or ends with "A-1"  
Hey guys,

I am kinda new to APEX triggers and I try to solve the following challange:

I built a trigger which updates 2 fields (integer field and picklist field) depending on 2 other picklist fields. Behind those updated fields are some values like:
if(ScoreAbs <= 21){
                a.ScoreTotal__c = 'Bronze';
            }else if(ScoreAbs > 21 && ScoreAbs <= 28){
                a.ScoreTotal__c = 'Silver';
            }else if(ScoreAbs > 28 && ScoreAbs <= 33){
                a.ScoreTotal__c = 'Gold';
            }else if(ScoreAbs > 33){
                a.ScoreTotal__c = 'Platinum';
            }
"ScoreAbs" is calculated via another method. That trigger works fine and there are no errors in it. Now I need to change values within the above code, e.g.  values like 21, 33, 28 etc...
After I changed those values in the first trigger I want to update all leads (something about 2000) with another trigger. Best way would be to press a button within the lead record view.

Do i need to save all leads to a list via a query first to update them after via "update leadList"? Or what would be the best way to get this problem solved?

Thanks!
Best
 
  • January 13, 2017
  • Like
  • 0
Hi Folks,

Please help I want to create the inbound email services through which the lead will be generated once the email is recieved. The issue is how to fetch the information from the email body which is sent by the different user. For example the name of the Lead is hiding in the email body.

Please help me to write the code to extract the info from the email body.