• Rachel Linder 8
  • NEWBIE
  • 70 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 46
    Replies
I have written process builder flow for an email alert. The first set of criteria is met to send an email alert the first time the criteria is met. The second set of criteria is met to send an email any time the fields change after the initial criteria being sent. Right now it is skipping the initial criteria alert and only sending the ischanged criteria. Not sure what to do to correct this.

Initial Criteria to be Met to Send Initial Email
User-added image
Initial Crtieria Above defined
Initial Criteria:
 
  1. Stage Name equals Closed Won
  2. Foot Traffic Reports equals DAP
  3. Foot Traffic Reports equals DAP2
  4. Foot Traffic Reports equals DAP3
  5. Cross-Channel Reports Is Null False
  6. MTA Reports Is Null False
  7. TV Reports equals Grace
  8. TV Reports equals Tune
  9. Measurement Reports Offered equals Yes
  10. Record Type Name equals Viant MS
  11. Last Modified Profile ID equals xxxxx1
  12. Last Modified Profile ID equals xxxxx2
Filter Logic
(1 AND 9 AND 10 AND (11 OR 12)) AND (2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8)

Advanced is checked as yes

IsChanged Criteria after Initial Criteria being met
User-added image
Below is my current formula field used in a field update WFR.
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"NCS"), 
ISPICKVAL(Direct_Match_Vendor__c,"NCS")), 
"NCS", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Comscore"), 
ISPICKVAL(Direct_Match_Vendor__c,"Comscore")), 
"Rentrak", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Experian"), 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c, "Experian"),
ISPICKVAL(Direct_Match_Vendor__c,"Experian"),
ISPICKVAL(Data_Partners_EU__c, "Experian")), 
"Experian", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Argus"), 
ISPICKVAL(Direct_Match_Vendor__c,"Argus")), 
"Argus", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c,"Epsilon"), 
ISPICKVAL(Data_Partners_EU__c, "Epsilon")), 
"Epsilon", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"StatSocial"), 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c, "StatSocial"),
ISPICKVAL(Direct_Match_Vendor__c,"StatSocial"),
ISPICKVAL(Data_Partners_EU__c, "StatSocial")), 
"StatSocial", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Crossix"), 
ISPICKVAL(Direct_Match_Vendor__c,"Crossix")), 
"Crossix",  
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Symphony"), 
ISPICKVAL(Direct_Match_Vendor__c,"Symphony")), 
"Symphony", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Urban Science"), 
ISPICKVAL(Direct_Match_Vendor__c,"Urban Science")), 
"Urban Science", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"84.51"), 
ISPICKVAL(Direct_Match_Vendor__c,"84.51")),
"84.51",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Acxiom"), 
ISPICKVAL(Direct_Match_Vendor__c,"Acxiom")),
"Acxiom",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Alliant"), 
ISPICKVAL(Direct_Match_Vendor__c,"Alliant")),
"Alliant",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"AMEX Advance"), 
ISPICKVAL(Direct_Match_Vendor__c,"AMEX Advance")),
"AMEX Advance",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Ansa/RSi"), 
ISPICKVAL(Direct_Match_Vendor__c,"Ansa/RSi")),
"Ansa/RSi",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Datalogix"), 
ISPICKVAL(Direct_Match_Vendor__c,"Datalogix")),
"Datalogix",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Dun & Bradstreet"), 
ISPICKVAL(Direct_Match_Vendor__c,"Dun & Bradstreet")),
"Dun & Bradstreet",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"HG Data"), 
ISPICKVAL(Direct_Match_Vendor__c,"HG Data")),
"HG Data",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Infogroup"), 
ISPICKVAL(Direct_Match_Vendor__c,"Infogroup")),
"Infogroup",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Inscape"), 
ISPICKVAL(Direct_Match_Vendor__c,"Inscape")),
"Inscape",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"IRI"), 
ISPICKVAL(Direct_Match_Vendor__c,"IRI")),
"IRI",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Kantar"), 
ISPICKVAL(Direct_Match_Vendor__c,"Kantar")),
"Kantar",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Neustar"), 
ISPICKVAL(Direct_Match_Vendor__c,"Neustar")),
"Neustar",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Oracle (BlueKai)"), 
ISPICKVAL(Direct_Match_Vendor__c,"Oracle (BlueKai)")),
"Oracle (BlueKai)",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"PeopleFinders DaaS"), 
ISPICKVAL(Direct_Match_Vendor__c,"PeopleFinders DaaS")),
"PeopleFinders DaaS",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Transunion"), 
ISPICKVAL(Direct_Match_Vendor__c,"Transunion")),
"Transunion",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Nielsen Catalina"), 
ISPICKVAL(Direct_Match_Vendor__c,"Nielsen Catalina")),
"NCS",
null 
))))))))))))))))))))))))))

I have started a case statement below. My question is  how would I condense the above into to one case statement as there are two different picklist values being used one from opportunity and one from opportunity products.
CASE(Data Partners Entire Campaign,
“NCS”, “NCS”,
“Comscore”, “Comscore”,
“Experian”, Experian”
“Argus”, “Argus”,
“Epsilon”, “Epsilon”,
“StatSocial”, “StatSocial”,
“Crossix”, “Crossix”,
“Symphony”, “Symphony”,
“Urban Science”, Urban Science”,
“84.51”, “84.51”,
“Acxiom”, “Acxiom”,
“Alliant”, “Alliant”,
“AMEX Advance”, “AMEX Advance”,
“Ansa/RSi”, “Ansa/RSi”,
“Datalogix”, “Datalogix”,
“Dun & Bradstreet”, “Dun & Bradstreet”,
“HG Data”, “HG Data”,
“Infogroup”, “Infogroup”,
“Inscape”, “Inscape”,
“IRI”, “IRI”,
“Kantar”, “Kantar”,
“Neustar”, “Neustar”,
“Oracle (Blue Kai)”, “Oracle (Blue Kai)”,
“PeopleFinders DAAS”, “PeopleFindersDAAS”,
“Transunion”, “Transunion”,
“Nielsen Catalina”, “NCS”,
“Vizio”, “Inscape”,
“”)

 

We have the following record type for Accounts:

Holding Company
Main Agency
Local Agency
Advertiser

What we need is a validation rule that allows only the System Administrator to EDIT those record types? Hhow do I write this rule?

 

I am deploying a new trigger. And It is failing. I am not a developer so I do not know how to correct the error. Any help would be appreciated. Here is the Apex Test Failuers error:

User-added image
The "TestClass" code is: 
 
@isTest(SeeAllData=true)
private class TestClass {

    static testMethod void myUnitTest() {
        Profile p = [Select id from Profile where Name ='System Administrator']; 
        Profile EUP = [Select id from Profile where Name ='EU - Standard User w/ Reporting'];
        user u = [select id, ProfileId, UserRoleId,Name, Team__c, Territory__c, Region__c from User where /*Name =: 'Gavin Barber']; //*/ProfileId =: EUP.Id and isActive = true limit 1]; //
        user u2 = [select id, ProfileId, UserRoleId,Name, Team__c, Territory__c, Region__c from User where /*Name =: 'Amy Harrington'];//*/ProfileId =: p.Id and isActive = true limit 1]; //
        
         /*User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
      EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
      LocaleSidKey='en_US', ProfileId = p.Id, 
      TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@testorg.com');*/
        Date d = System.Today(); 
                
        DateTime dt = system.now();
        date flightstart = date.valueof(dt.addMonths(-3));
        date flightend = date.valueof(dt.addMonths(3));
        string ThisWeek1 = dt.format('w');
        string LastWeek = dt.addDays(-7).format('w');
        integer Lastweeki = integer.valueof((string)Lastweek);
        integer thisweeki = integer.valueof((string)thisweek1);
        string thisyear = dt.format('yyyy');
        string thisMonth = dt.format('MMMM');
        string Quarter = ThisMonth == 'January' ? 'Q1' : ThisMonth == 'February' ? 'Q1' : ThisMonth == 'March' ? 'Q1' : ThisMonth == 'April' ? 'Q2': ThisMonth == 'May' ? 'Q2' : ThisMonth == 'June' ? 'Q2' : ThisMonth == 'July' ? 'Q3' : ThisMonth == 'August' ? 'Q3' : ThisMonth ==  'September' ? 'Q3' : ThisMonth ==  'October' ? 'Q4' : ThisMonth == 'November' ? 'Q4' : ThisMonth == 'December' ? 'Q4' : '' ;
            list<Quota__c> qtalist = new list<Quota__c>();
            Quota__c testqta = new Quota__c (OwnerId = u2.Id, January__c = 100, February__c = 100, March__c = 100, April__c = 100, May__c = 100, June__c = 100, July__c = 100, August__c = 100, September__c = 100, October__c = 100, November__c = 100, December__c = 100, RecordTypeId = '012500000009iOD',Year__c = '2013',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa');
                qtalist.add(testqta);
            Quota__c qta3 = new Quota__c (OwnerId = u2.Id, January__c = 2, February__c = 2, March__c = 2, April__c = 2, May__c = 2, June__c = 2, July__c = 2, August__c = 2, September__c = 2, October__c = 2, November__c = 2, December__c = 2, RecordTypeId = '012500000009iOD',Year__c = '2012',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa');
                qtalist.add(qta3);
            Quota__c qta2 = new Quota__c (name ='default',OwnerId = u2.Id, January__c = 2, February__c = 2, March__c = 2, April__c = 2, May__c = 2, June__c = 2, July__c = 2, August__c = 2, September__c = 2, October__c = 2, November__c = 2, December__c = 2, RecordTypeId = '012500000009iOD',Year__c = '2012',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa');
                qtalist.add(qta2);
            insert qtalist;
         test.startTest();
            list<Account> AdvertiserList = new list<Account>();
            id holdingcompanyrt = utils.getRecordTypeId('Account', 'Holding Company');
            Account HoldingCompany =    new Account(Name = 'Test HoldingCompany', RecordTypeId = holdingcompanyrt, OwnerID = u2.Id);
                insert HoldingCompany;
            id mainagencyrt = utils.getRecordTypeId('Account', 'Main Agency');  
            Account MainAgency = new Account(Name = 'Test Main Agency', RecordTypeId = mainagencyrt,OwnerID = u2.Id,Holding_Company_Name__c = HoldingCompany.Id);  
                insert MainAgency;   
            id LocalAgencyrt = utils.getRecordTypeId('Account','Local Agency');
            Account LocalAgency = new Account(Name = 'Test Local Agency', RecordTypeId = LocalAgencyrt, Main_Agency__c = MainAgency.Id, Holding_Company_Name__c = HoldingCompany.Id, SageID__c ='ABC100');
                insert LocalAgency;
            Account LocalAgency2 = new Account(Name = 'Test Local Agency2', Main_Agency__c = MainAgency.Id ,RecordTypeId = LocalAgencyrt, SageID__c ='ABC100');
                insert LocalAgency2; 
            id Advertiserrt = utils.getRecordTypeId('Account', 'Advertiser');
            Account Advertiser = new Account(Name = 'Test Advertiser', RecordTypeId = Advertiserrt, Local_Agency__c = LocalAgency.Id );
                insert Advertiser;
                Advertiser.BillingState = 'Idaho';
                Advertiser.BillingCountry = 'United States';
                Advertiser.Create_Sage__c = true;
                Advertiser.SageID__c = '';
                Advertiser.Main_Agency__c = null;
                    update Advertiser;  
                Advertiser.BillingState = '';
                    update Advertiser;
                Advertiser.SageID__c ='100ABC';
                    update Advertiser;  
           test.stopTest();
            
                    
    }
    static testmethod void testmethod2() {
        test.startTest();   
        Opportunity opp = [select id from Opportunity where Name IN('test') and CloseDate >: system.today()-60 and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: true limit 1];
         
            opp.move_all_flight_dates__c = true;
            opp.ContractStartDate__c = system.Today();
            opp.ContractEndDate__c = system.Today()+90;
            update opp;
        test.stopTest();
    }       
    static testmethod void testmethod5() {
        test.startTest();    
        Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: true limit 1];

            opp.StageName = 'Closed Won';
            opp.HasSageID__c = false;
            opp.Exception__c = false;
            opp.SVP_Email__c = null;
            
            update opp;
            delete opp;
        test.stopTest();
    }       
    static testmethod void testmethod4(){
        test.startTest();
        Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' limit 1];
        OpportunityTeamMember ot = new OpportunityTeamMember(UserId = '005500000018PC2', TeamMemberRole='Account Manager',Split__c = 50,Date_Split_Starts__c = system.Today(),Date_Split_Ends__c=system.Today()+30, OpportunityId = opp.Id);
            insert ot;
        test.stopTest();
    }
    static testmethod void testmethod6(){
         test.startTest();  
       /*    Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: false limit 1];
           Product2 prod = new Product2(name='test product',CanUseRevenueSchedule=True);
                insert prod;  
           PricebookEntry pbe = new PricebookEntry(UnitPrice=0, UseStandardPrice=true,Product2Id=prod.id, Pricebook2Id = '01s50000000IJr3',IsActive=true);
                insert pbe;                 
           OpportunityLineItem oliUS = new OpportunityLineItem(UnitPrice=0,Quantity=1,PricebookEntryId=pbe.Id ,OpportunityId=opp.id, Placement__c = 'aaa', Flight_Start_Date__c =system.today()-1,Flight_End_Date__c = system.today()+30, Rev_Type__c = 'CPM',Rate__c = 1, insertbudget__c = 600, distribute_evenly__c = true );
                 insert oliUS;*/
         test.stopTest();
    }
    
    static testmethod void testmethod3(){
        PageReference pageref = new Pagereference('apex/Account_Transfer2');
        test.setcurrentpage(pageRef);
        
        //Instantiate the standard controller
        Account act = new Account();
        ApexPages.StandardController sc = new Apexpages.standardController(act);
        
        //Instantiate the extension
        //Account_Transfer2 ext = new Account_Transfer2(sc);
        
        //Do the work
        //ext.getEmps();
        //ext.del();
        //ext.onSave();
        //ext.AccountWork();
        //ext.NextPage();
        //ext.Opportunity_Transfer();
    }
    
}

 
I have started writing the following trigger to update child records based on a checkbox field being updated on the Parent Record:

trigger Agency_in_Collections on Account (after update) {
 
   for (Account Agency: Trigger.new){
        Account oldAgency = Trigger.oldMap.get(Agency.Id);
           if(oldAgency.Agency_in_Collections__c != Agency.Agency_in_Collections__c && Agency.Agency_in_Collections__c == true)
              {
              List<Account> children = [ SELECT Id, AccountID, Agency_in_Collections__c from
                Account where AccountID = :Agency.ID];
                  List<Account> newids = new List <Account>
                  ();
                    for(Account acc: children){
                       if(acc.Agency_in_Collections__c != acc.Agency_in_Collections__c){
                           acc.Agency_in_Collections__c = acc.Agency_in_Collections__c;
                               newids.add(acc);
                               }
                            }
                            if (newids.isEmpty()== false){
                                update newids;
                            }
                     }
          }
 }


The checkbox field on the Parent Record is called "Agency in Collections". The field name on the Child Record is "Agency on Collections". 

I was working on this in sandbox and was getting an error when saving the trigger. The error is: 

User-added image
Please help. If there is a better way as well please let me tknow.
 
We have an excel worksheet that we would like to automate in salesforce. What we would like is that team members can create a form from salesforce then save that form and it populates fields within the opportunity. We have some team members on Classic and some on Lightning so this process would need to work in both UI's.

What is the best way to accomplish this?

We are in the process of moving from Classic to Lightning. We are missing some fields on the Lightning Add Products window that are on the Classic Add Products Window, as well as the order is different in Lightning then in Classic. It seems that there is a Visualforce Page that has been created for adding products. In case it is important, upon saving the product(s) after all fields are complete there is a trigger on the backend that will divide the budget up across the flight dates.

CLASSIC - ADD PRODUCTS WINDOW

User-added image


LIGHTNING ADD PRODUCTS WINDOW
User-added image

In the lightning add products window you can see that there are fields missing (budget and distribute evenly) and the order of the fields is different then in the Classic Add Products window. Some of the fields in classic are custom fields. We need the lightning window to include all of the same fields as Classic and it would be extremely helpful to have them display in the same order.

I am not a developer and not familiar with Visualforce so I don't know where to start in the troublshooting process. We did run the Lightning Experience Readiness report and it shows to concerns around the visiualforce page. Here are the two issues:

User-added image


If it is needed and there is a way to attach the Visualforce Markup for the page please let me know how to do that.
Thank you.

I am trying to write a workflow rule that will send an email when an opportunity team member is added to an opportunity. I have a rule working that will send the email based on criteria. But now there is a request that it does not be sent of the opportnity record type is ABC type. How would i update the rule? This is what i have currently.
User-added image
We would like to copy the account billing address to a contract (not contact) record upon saving the contract record. We have a lookup relationship to the account (standard field within the comtract record). Can this be done via a formula field?

Hello,
I need a way to create a field on the opporutnity level that looks at the opportunity team members and counts of there are or are not any team members. I can't do this via a rollup field. I tried a formula field but can't find a way to get to the opportunity team level.

Any suggestions?
Thank you.

I need a validation rule for a picklist field (Adelphic PAS) that makes it required for all users except for the System Administrator.
Any help. This is what i have started but I think I am way off.

AND( ISPICKVAL(Programmatic_Account_Strategist_PAS__c, " "), 
$Profile.Name <> "System Administrator")
Hello,
I wrote a trigger on the task object. What the trigger is supposed to accomplish is looking at a name in a field on the task, then going to a custom object to find that name, and when the name is found pull the email from that custom object onto the task. 
Can you please review my code below and let me know if this will accomplish what I need? Then I will need to deploy it. I know the process for how to deploy the trigger but do I need to create a test case first? And if so what would that test class look like?
____________________________________________________________________________________________________________________
TRIGGER
trigger TaskAccountManagerEmailTrigger on Task (before insert, before update) {

    map<string, string> DM = new map<string, string>();
    Set<String> Person = new Set<String>();
    For(Task t: trigger.new)
    {
        if(t.Account_Manager__c!=null)
        Person.add(t.Account_Manager__c);
    } 
    
    List<Holding_Object__c> HoldingLst = new List<Holding_Object__c>();
    if(Person!=null && Person.size()>0)
    {
       HoldingLst=[select Persons_Name__c, Email_Address__c from Holding_Object__c where Persons_Name__c in: Person];
    }
    
    if(HoldingLst!=null && HoldingLst.size()>0)
    {
        for(Holding_Object__c hd : HoldingLst)
        {
            DM.put(hd.Persons_Name__c, hd.Email_Address__c);
        }
    }
    
    for(Task t: trigger.new)
    {
        if(DM.Containskey(t.Account_Manager__c) && DM.get(t.Account_Manager__c)!=null)
        t.Account_Manager_Email__c = DM.get(t.Account_Manager__c);
    }
    
}
I need to make some changes to some test classes that I didn't create.

Before I make those changes can you let me know the following:
  1. I am assuming I need to make these changes in our sandbox and then deploy to production. Is this correct?
  2. If I make these changes will it disrupt anything we currently have running in production? Or are these strictly used when testing during deployment of things such as triggers?
I need to avoid having any issues arise in the production environment.

I sincerely appreciate the help.
I am trying to deploy the following trigger into production. I am getting a code coverage error of 69%. It shows it failed with two test classes. What can I do to correct. I need to unfortunately have this deployed this evening or first thing in the morning. Any help would be greatly appreciated. I am a Salesforce Administrator not a Developer so I am a beginner to say the least.

TRIGGER CODE
trigger Opportunity_Adelphic_AE_Email_Trigger on Opportunity (before insert, before update) {

    map<string, string> DM = new map<string, string>();
    Set<String> Person = new Set<String>();
    For(Opportunity opp : trigger.new)
    {
        if(opp.Adelphic_AE__c!=null)
        Person.add(opp.Adelphic_AE__c);
    } 
    
    List<Holding_Object__c> HoldingLst = new List<Holding_Object__c>();
    if(Person!=null && Person.size()>0)
    {
       HoldingLst=[select Persons_Name__c, Email_Address__c from Holding_Object__c where Persons_Name__c in: Person];
    }
    
    if(HoldingLst!=null && HoldingLst.size()>0)
    {
        for(Holding_Object__c hd : HoldingLst)
        {
            DM.put(hd.Persons_Name__c, hd.Email_Address__c);
        }
    }
    
    for(opportunity opp : trigger.new)
    {
        if(DM.Containskey(opp.Adelphic_AE__c) && DM.get(opp.Adelphic_AE__c)!=null)
        opp.Adelphic_AE_Email__c = DM.get(opp.Adelphic_AE__c);
    }
    
}


MassLeadConverterControllerTest Test Class Error:
Error Message: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: [BillingCountry]

Stack Trace: Class.MassLeadConverterControllerTest.massLeadTest: line 11, column 1

test_updatecontactrolecount​ Test Class Error:
Error Message: System.Exception: Assertion Failed

Stack Trace: Class.test_updatecontactrolecount.testcreateopptywithconditionandrole: line 38, column 1
 
I am new to this org I am currently working in. I am deploying my first trigger as an admin. I received the attached 2 errors. Any ideas on how I can troubleshoot these:

User-added image
I am writing my first trigger. It involves two objects:
  1. Opportunity (Standard Object)
  2. Holding Object (Custom Object) 
What is supposed to happen is the following:

A name is chosen from a picklist field on the opportunity. Upon save the trigger should go look at the Holding Object object and find that name and pull the email address from that Persons record on the custom object.

Here is screenshot of what I have so far including the error.

User-added image

The actual code is below (in case the above is hard to read):

trigger Opportunity_Adelphic_AE_Email_Trigger on Opportunity (after update, before insert, before update, before delete) {
Opportunity [] opp = trigger.new;
                //Fill in the Adelphic AE email fields based on the person selected from the drop down list. 
                    for(integer i=0;i <opp.size();i++){

                        Set<string> Person = new Set<string>();
                        Person.add(trigger.new[i]. Adelphic_AE__c);

                        
                        if(Person.Size() > 0){
                            map<string, string> DM = new map<string, string>();
                                Holding_Object__c [] DMM = [select Persons_Name__c, Email_Address__c from Holding_Object    __c where Persons_Name__c in: Person ];
                                    for(Holding_Object__c lzip: DMM){
                                        DM.put(lzip.Persons_Name__c, lzip.Email_Address__c);
                                    }
                                    for(Holding_Object__c h: DMM){
                                        trigger.new[i]. Adelphic_AE_Email__c = DM.get(trigger.new[i]. Adelphic_AE__c);
           }
}

The error I am receiving is: "Compile Error: unexpected syntax: 'mismatched input '<EOF>' expecting RCURLY' at line 20 column 1.

Any feedback and guidance would be appreciated.
We would like to copy the account billing address to a contract (not contact) record upon saving the contract record. We have a lookup relationship to the account (standard field within the comtract record). Can this be done via a formula field?
I have written process builder flow for an email alert. The first set of criteria is met to send an email alert the first time the criteria is met. The second set of criteria is met to send an email any time the fields change after the initial criteria being sent. Right now it is skipping the initial criteria alert and only sending the ischanged criteria. Not sure what to do to correct this.

Initial Criteria to be Met to Send Initial Email
User-added image
Initial Crtieria Above defined
Initial Criteria:
 
  1. Stage Name equals Closed Won
  2. Foot Traffic Reports equals DAP
  3. Foot Traffic Reports equals DAP2
  4. Foot Traffic Reports equals DAP3
  5. Cross-Channel Reports Is Null False
  6. MTA Reports Is Null False
  7. TV Reports equals Grace
  8. TV Reports equals Tune
  9. Measurement Reports Offered equals Yes
  10. Record Type Name equals Viant MS
  11. Last Modified Profile ID equals xxxxx1
  12. Last Modified Profile ID equals xxxxx2
Filter Logic
(1 AND 9 AND 10 AND (11 OR 12)) AND (2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8)

Advanced is checked as yes

IsChanged Criteria after Initial Criteria being met
User-added image
Below is my current formula field used in a field update WFR.
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"NCS"), 
ISPICKVAL(Direct_Match_Vendor__c,"NCS")), 
"NCS", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Comscore"), 
ISPICKVAL(Direct_Match_Vendor__c,"Comscore")), 
"Rentrak", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Experian"), 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c, "Experian"),
ISPICKVAL(Direct_Match_Vendor__c,"Experian"),
ISPICKVAL(Data_Partners_EU__c, "Experian")), 
"Experian", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Argus"), 
ISPICKVAL(Direct_Match_Vendor__c,"Argus")), 
"Argus", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c,"Epsilon"), 
ISPICKVAL(Data_Partners_EU__c, "Epsilon")), 
"Epsilon", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"StatSocial"), 
ISPICKVAL(Opportunity.Data_Partners_EU_Entire_Campaign__c, "StatSocial"),
ISPICKVAL(Direct_Match_Vendor__c,"StatSocial"),
ISPICKVAL(Data_Partners_EU__c, "StatSocial")), 
"StatSocial", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Crossix"), 
ISPICKVAL(Direct_Match_Vendor__c,"Crossix")), 
"Crossix",  
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Symphony"), 
ISPICKVAL(Direct_Match_Vendor__c,"Symphony")), 
"Symphony", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Urban Science"), 
ISPICKVAL(Direct_Match_Vendor__c,"Urban Science")), 
"Urban Science", 
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"84.51"), 
ISPICKVAL(Direct_Match_Vendor__c,"84.51")),
"84.51",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Acxiom"), 
ISPICKVAL(Direct_Match_Vendor__c,"Acxiom")),
"Acxiom",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Alliant"), 
ISPICKVAL(Direct_Match_Vendor__c,"Alliant")),
"Alliant",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"AMEX Advance"), 
ISPICKVAL(Direct_Match_Vendor__c,"AMEX Advance")),
"AMEX Advance",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Ansa/RSi"), 
ISPICKVAL(Direct_Match_Vendor__c,"Ansa/RSi")),
"Ansa/RSi",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Datalogix"), 
ISPICKVAL(Direct_Match_Vendor__c,"Datalogix")),
"Datalogix",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Dun & Bradstreet"), 
ISPICKVAL(Direct_Match_Vendor__c,"Dun & Bradstreet")),
"Dun & Bradstreet",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"HG Data"), 
ISPICKVAL(Direct_Match_Vendor__c,"HG Data")),
"HG Data",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Infogroup"), 
ISPICKVAL(Direct_Match_Vendor__c,"Infogroup")),
"Infogroup",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Inscape"), 
ISPICKVAL(Direct_Match_Vendor__c,"Inscape")),
"Inscape",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"IRI"), 
ISPICKVAL(Direct_Match_Vendor__c,"IRI")),
"IRI",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Kantar"), 
ISPICKVAL(Direct_Match_Vendor__c,"Kantar")),
"Kantar",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Neustar"), 
ISPICKVAL(Direct_Match_Vendor__c,"Neustar")),
"Neustar",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Oracle (BlueKai)"), 
ISPICKVAL(Direct_Match_Vendor__c,"Oracle (BlueKai)")),
"Oracle (BlueKai)",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"PeopleFinders DaaS"), 
ISPICKVAL(Direct_Match_Vendor__c,"PeopleFinders DaaS")),
"PeopleFinders DaaS",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Transunion"), 
ISPICKVAL(Direct_Match_Vendor__c,"Transunion")),
"Transunion",
IF(or( 
ISPICKVAL(Opportunity.Data_Partners_Entire_Campaign__c,"Nielsen Catalina"), 
ISPICKVAL(Direct_Match_Vendor__c,"Nielsen Catalina")),
"NCS",
null 
))))))))))))))))))))))))))

I have started a case statement below. My question is  how would I condense the above into to one case statement as there are two different picklist values being used one from opportunity and one from opportunity products.
CASE(Data Partners Entire Campaign,
“NCS”, “NCS”,
“Comscore”, “Comscore”,
“Experian”, Experian”
“Argus”, “Argus”,
“Epsilon”, “Epsilon”,
“StatSocial”, “StatSocial”,
“Crossix”, “Crossix”,
“Symphony”, “Symphony”,
“Urban Science”, Urban Science”,
“84.51”, “84.51”,
“Acxiom”, “Acxiom”,
“Alliant”, “Alliant”,
“AMEX Advance”, “AMEX Advance”,
“Ansa/RSi”, “Ansa/RSi”,
“Datalogix”, “Datalogix”,
“Dun & Bradstreet”, “Dun & Bradstreet”,
“HG Data”, “HG Data”,
“Infogroup”, “Infogroup”,
“Inscape”, “Inscape”,
“IRI”, “IRI”,
“Kantar”, “Kantar”,
“Neustar”, “Neustar”,
“Oracle (Blue Kai)”, “Oracle (Blue Kai)”,
“PeopleFinders DAAS”, “PeopleFindersDAAS”,
“Transunion”, “Transunion”,
“Nielsen Catalina”, “NCS”,
“Vizio”, “Inscape”,
“”)

 

We have the following record type for Accounts:

Holding Company
Main Agency
Local Agency
Advertiser

What we need is a validation rule that allows only the System Administrator to EDIT those record types? Hhow do I write this rule?

 

I have started writing the following trigger to update child records based on a checkbox field being updated on the Parent Record:

trigger Agency_in_Collections on Account (after update) {
 
   for (Account Agency: Trigger.new){
        Account oldAgency = Trigger.oldMap.get(Agency.Id);
           if(oldAgency.Agency_in_Collections__c != Agency.Agency_in_Collections__c && Agency.Agency_in_Collections__c == true)
              {
              List<Account> children = [ SELECT Id, AccountID, Agency_in_Collections__c from
                Account where AccountID = :Agency.ID];
                  List<Account> newids = new List <Account>
                  ();
                    for(Account acc: children){
                       if(acc.Agency_in_Collections__c != acc.Agency_in_Collections__c){
                           acc.Agency_in_Collections__c = acc.Agency_in_Collections__c;
                               newids.add(acc);
                               }
                            }
                            if (newids.isEmpty()== false){
                                update newids;
                            }
                     }
          }
 }


The checkbox field on the Parent Record is called "Agency in Collections". The field name on the Child Record is "Agency on Collections". 

I was working on this in sandbox and was getting an error when saving the trigger. The error is: 

User-added image
Please help. If there is a better way as well please let me tknow.
 

Hello,
I need a way to create a field on the opporutnity level that looks at the opportunity team members and counts of there are or are not any team members. I can't do this via a rollup field. I tried a formula field but can't find a way to get to the opportunity team level.

Any suggestions?
Thank you.

Hello,
I wrote a trigger on the task object. What the trigger is supposed to accomplish is looking at a name in a field on the task, then going to a custom object to find that name, and when the name is found pull the email from that custom object onto the task. 
Can you please review my code below and let me know if this will accomplish what I need? Then I will need to deploy it. I know the process for how to deploy the trigger but do I need to create a test case first? And if so what would that test class look like?
____________________________________________________________________________________________________________________
TRIGGER
trigger TaskAccountManagerEmailTrigger on Task (before insert, before update) {

    map<string, string> DM = new map<string, string>();
    Set<String> Person = new Set<String>();
    For(Task t: trigger.new)
    {
        if(t.Account_Manager__c!=null)
        Person.add(t.Account_Manager__c);
    } 
    
    List<Holding_Object__c> HoldingLst = new List<Holding_Object__c>();
    if(Person!=null && Person.size()>0)
    {
       HoldingLst=[select Persons_Name__c, Email_Address__c from Holding_Object__c where Persons_Name__c in: Person];
    }
    
    if(HoldingLst!=null && HoldingLst.size()>0)
    {
        for(Holding_Object__c hd : HoldingLst)
        {
            DM.put(hd.Persons_Name__c, hd.Email_Address__c);
        }
    }
    
    for(Task t: trigger.new)
    {
        if(DM.Containskey(t.Account_Manager__c) && DM.get(t.Account_Manager__c)!=null)
        t.Account_Manager_Email__c = DM.get(t.Account_Manager__c);
    }
    
}
I need to make some changes to some test classes that I didn't create.

Before I make those changes can you let me know the following:
  1. I am assuming I need to make these changes in our sandbox and then deploy to production. Is this correct?
  2. If I make these changes will it disrupt anything we currently have running in production? Or are these strictly used when testing during deployment of things such as triggers?
I need to avoid having any issues arise in the production environment.

I sincerely appreciate the help.