• Ella Fitzpatrick
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi All,

I downloaded the free app "Require Opportunity Contact Roles" which installs a field, Apex and Validation rule:

Field = Has Primary Contact (checkbox)
Validation Rule = Has Primary Contact has to be ticked if the Probablity of the Opportunity is 30% or above
Apex = Checks the Has Primary Contact Field once a Primary Contact is added.

HOWEVER, the Apex code needs to be rewritten to match up to our specific stage names etc and im not familiar with Apex at all and am not sure what each part of it means and where I need to put which field name.

Below is the Apex class detail.  I would greatly appreciate it if someone could explain to me what exactly I need to replace their field names with. I.e. Role = Business User in the Apex is the name of the specific Role that has to be added to the Opportunity for the checkbox to be ticked:

public class test_updatecontactrolecount
{
 public static testMethod void testcreateopptywithconditionandrole()
{
//Insert Opportunities 
try
{
    Opportunity Oppty = new Opportunity(Name='Oppty_test1',StageName='Stage 1 - Unqualified Prospect',Type ='New Business', CloseDate=System.Today());
    insert Oppty;
    
    // insert contact
    Contact[] cont = new Contact[]
    {
        new Contact(LastName = 'testcontact1'),
        new Contact(LastName = 'testcontact2')
    };    
    insert cont;    
    // insert contact role     
    OpportunityContactRole [] ocr = new OpportunityContactRole[]
    {
    new OpportunityContactRole(Role ='Business User',OpportunityId=Oppty.id ,Contactid = cont[0].id ,Isprimary = True),
    new OpportunityContactRole(Role ='Business User',OpportunityId=Oppty.id ,Contactid = cont[0].id ,Isprimary = False)
    };
    insert ocr;    
    Oppty.StageName = 'Stage 3 - Eval Request';    
    //Update opportunity
    
    Test.StartTest();
    update Oppty;
    Test.StopTest();
    
    Oppty =[SELECT Number_of_Contacts_Roles_Assigned__c,Primary_Contact_Assigned__c FROM Opportunity WHERE Id = :Oppty.Id];
    system.assert (Oppty.Number_of_Contacts_Roles_Assigned__c == 2);
    system.assert (Oppty.Primary_Contact_Assigned__c == True);
}
catch (System.DmlException e)
{
    System.assert(false);
}        

}


Any help you can provide would be much appreciated :) 

Hello All,

I need formula help! I have 3 custom dependent picklist fields on my Contact Object:

1. How contact data found?
2. What Show Team?
3. What competitor Show?

These are linked up in dependent picklists, which works as follows:
IF the answer to 1 is "Competitor Show" then the user has to specificy what show team they are from in field 2 "Labels OR Aerospace", then depending on what answer they give determines what values they can choose in field 3, "what competitor show?".

I need a validation rule formula that will do the following:

Competitor show is only 1 of 10 values available in field 1.  IF the answer to field 1 is Competitor Show then they have to have an answer in both 2 and 3.

Does anyone know how i would write this formula?

Thank you all in advance!!

Ella 

Hello All,

I need formula help! I have 3 custom dependent picklist fields on my Contact Object:

1. How contact data found?
2. What Show Team?
3. What competitor Show?

These are linked up in dependent picklists, which works as follows:
IF the answer to 1 is "Competitor Show" then the user has to specificy what show team they are from in field 2 "Labels OR Aerospace", then depending on what answer they give determines what values they can choose in field 3, "what competitor show?".

I need a validation rule formula that will do the following:

Competitor show is only 1 of 10 values available in field 1.  IF the answer to field 1 is Competitor Show then they have to have an answer in both 2 and 3.

Does anyone know how i would write this formula?

Thank you all in advance!!

Ella