• Domnic Johnson
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 25
    Replies
We have a pick list on our web to lead form and I would like to add a validation on the field, we have validation on other field. 

Is someone could help out in adding a validation rule here for lead_source I will really appreciate
<!-- This Response MUST BE ADDED to the Member's response list in order to use it FIRST (Cannot be set by default in settings). -->
      <p style="border-bottom: 1px solid grey;"></p>
      <input style="display:none" type="text" id="firstname" name="xxxxxxxxxx" size="40" autocomplete="off">

      <label for="first_name">First Name: <span style="color:darkred;">*</span><span style="float:right;">indicates
          required</span><span style="float:right;color:darkred;">*&nbsp;</span></label>
      <div id="VIPregistration_first_name_errorloc" class="form-error-text"></div><input id="first_name" maxlength="40"
        name="first_name" size="40" type="text" autocomplete="given-name">


      <label for="last_name">Last Name: <span style="color:darkred;">*</span></label>
      <div id="VIPregistration_last_name_errorloc" class="form-error-text"></div><input id="last_name" maxlength="80"
        name="last_name" size="80" type="text" autocomplete="family-name">


      <label for="email">Email: <span style="color:darkred;">*</span></label>
      <div id="VIPregistration_email_errorloc" class="form-error-text"></div><input id="email" maxlength="80" name="email"
        size="80" type="email" autocomplete="email">


      <label for="phone">Phone: <span style="color:darkred;">*</span></label>
      <div id="VIPregistration_phone_errorloc" class="form-error-text"></div><input id="phone" maxlength="18" minlength="10"
        name="phone" size="18" type="tel" autocomplete="tel" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" />
		
		
		<label for="lead_source">How did you hear about this opportunity?<span style="color:darkred;">*</span></label><select type="source" required="required" id="lead_source" name="lead_source">
              
              
              
              <option value="">--None--</option>
                           		
					<option value=" Condos -  Email Updates">Condos -  Email Updates</option>
					<option value="Google">Google</option>
					<option value="Bing">Bing</option>
					<option value="Facebook">Facebook</option>
					<option value="Instagram">Instagram</option>
					<option value="Twitter">Twitter</option>
					<option value="YouTube">YouTube</option>
					<option value="TV Ad">TV Ad</option>
					<option value="Radio Ad">Radio Ad</option>
					<option value="Flyer Ad">Flyer Ad</option>
					<option value="Referral">Referral</option>
					</select><br>

---------------------------------------------------------


  <script type="text/javascript">

  var frmvalidator = new Validator("VIPregistration");
    frmvalidator.EnableOnPageErrorDisplay();
    frmvalidator.EnableMsgsTogether();

    frmvalidator.addValidation("first_name", "req", "Please enter your First Name");
    frmvalidator.addValidation("first_name", "maxlen=40", "Our Apologies, First Name is Limited to 40 Characters Only");
    frmvalidator.addValidation("first_name", "alpha_s", "Name can Contain Alphabetic Characters Only");

    frmvalidator.addValidation("last_name", "req", "Please enter your Last Name");
    frmvalidator.addValidation("last_name", "maxlen=80", "Our Apologies, Maximum 80 Characters are Permitted for Your Last Name");

    frmvalidator.addValidation("email", "maxlen=80");
    frmvalidator.addValidation("email", "req", "Please enter your Email Address");
    frmvalidator.addValidation("email", "email");

    frmvalidator.addValidation("phone", "maxlen=18", "Please Enter Your 10 Digit Phone Number");
    frmvalidator.addValidation("phone", "req", "Please enter your Phone Number with Area Code");
    frmvalidator.addValidation("phone", "minlen=10", "Please Enter Your 10 Digit Phone Number");

 
Hi there, 

So, I set up google recaptcha and whats happening right now even if captcha box is not checked user and able to click on submit button and the form is going to thank you page but in reality the lead is not getting created because captcha is not getting validated.

What I want is to have a validation rule which will throw a pop up message or visual direct the end users to fill in the recaptcha check box if the submit button is clicked before click on submit form button.

Thanks

 
Hi Everyone, 

So we got this trigger from a external source and we now notice that it is working well as expected that the trigger is not allowing to change ownership of lead records for all users. 

Is there a way we can add one more logic in this excisting code to allow all user to be able to change ownership of lead records, please?

Below is the code
trigger LimitLeads on Lead ( before update )
{
    Integer maxLeads = 1;
    Decimal leadsCount;
    
    Map<Id,List<Lead>> leadsByNewOwnerId = new Map<Id,List<Lead>>();
    Map<Id,List<String>> SelectfrmQueueMap = new Map<Id,List<String>>();
    Map<Id,List<String>> LeadfrmQueueMap1 = new Map<Id,List<String>>();
    Map<Id,List<String>> LeadfrmQueueMap2 = new Map<Id,List<String>>();
    
    List<String> emailSelectList = New  List<String>();
    List<Lead> LeadList = new List<Lead>();
    
    for ( Lead lead : Trigger.new )
    {
        
        Lead oldLead = Trigger.oldMap.get( lead.Id );
        if  ( oldLead.OwnerId != lead.OwnerId &&  String.valueOf( lead.OwnerId ).left( 3 ) == '005')
        {
            if ( !leadsByNewOwnerId.containsKey( lead.OwnerId ))
            {
                leadsByNewOwnerId.put( lead.OwnerId, LeadList );
                SelectfrmQueueMap.put( lead.Id,emailSelectList);
            }
            LeadList.add(lead);
            emailSelectList.add(lead.Email);
        }
    }
  
    System.debug('leadsByNewOwnerId Size : ' + LeadList.size());
   
   List<Lead> LeadfrmQueueList1 = new List<Lead>([Select Id,Name,CreatedDate,Email,OwnerId from Lead where (OwnerId = '00G1C000004b97J') order by createdDate ASC limit 1 ]);
   List<Lead> LeadfrmQueueList2 = new List<Lead>([Select Id,Name,CreatedDate,Email,OwnerId from Lead where (OwnerId = '00G1C000004b97E') order by createdDate ASC limit 1 ]);
   
   If(LeadfrmQueueList1.size() > 0)
   {
    List<String> emailList = New  List<String>();
    emailList.add(LeadfrmQueueList1[0].Email);
   LeadfrmQueueMap1.put(LeadfrmQueueList1[0].Id, emailList);
   }
   
   If(LeadfrmQueueList2.size() > 0)
   {
    List<String> emailList = New  List<String>();
    emailList.add(LeadfrmQueueList2[0].Email);
   LeadfrmQueueMap2.put(LeadfrmQueueList2[0].Id, emailList);
   }

System.debug('SelectfrmQueueMap' + SelectfrmQueueMap);
System.debug('LeadfrmQueueMap1' + LeadfrmQueueMap1);
System.debug('LeadfrmQueueMap2' + LeadfrmQueueMap2);

Set<Id> userIds = new Set<Id>{'00515000006MBtJ', '00515000005c12P','00515000006MBtE'} ;

If(LeadList.size() > 0)
{
If(!(userIds.contains(LeadList[0].OwnerId)))
{

    If(!(SelectfrmQueueMap.equals(LeadfrmQueueMap1) || SelectfrmQueueMap.equals(LeadfrmQueueMap2)))
    {
        System.debug('Enter inside');
        for ( Lead lead : LeadList )
        {
            System.debug('Lead Before 11:' + lead );
            lead.addError (   'Users cannot have more than '+   maxLeads +   ' "Open - Not Contacted" leads.'  );
        }
    }
    else If(LeadList.size() > maxLeads )
    {
      System.debug('Enter inside loop 2');
        for ( Lead lead : LeadList )
        {
            System.debug('Lead Before 22:' + lead );
            lead.addError (   'Users cannot have more than '+   maxLeads +   ' "Open - Not Contacted" leads.'  );
        }
       
    }
    else
    {
        System.debug('Enter inside loop 3');
       for (AggregateResult result : [SELECT COUNT(Id) cid, OwnerId FROM Lead WHERE(Status = '1 Uncontacted' AND OwnerId IN :leadsByNewOwnerId.keySet()) GROUP BY OwnerId ])
        {
            System.debug('result==>' + ((decimal)result.get('cid')));
            Decimal cidsize = ((decimal)result.get('cid'));
            leadsCount = cidsize + LeadList.size();
            if(leadsCount > maxLeads)
            {
                 
                System.debug('Test:' + leadsByNewOwnerId.get( (Id) result.get( 'OwnerId' ) ) );
                for ( Lead lead : leadsByNewOwnerId.get( (Id) result.get( 'OwnerId' ) ) )
                {
                   System.debug('Lead After:' + lead );
                   lead.addError (   'Users cannot have more than '+   maxLeads +   ' "Open - Not Contacted" leads.'  );
                }
                 
            }
        }
    }
    
     System.debug('Exit');
}
}
}


 
If((LeadList[0].OwnerId != '005User1') || (LeadList[0].OwnerId != '005User2) || (LeadList[0].OwnerId != '005User3'))

Need help writing this line better
I want to restrict sales users from accepting new leads under they ownership when there are old leads in a queue

How can this be done? Please, help!
We don't want our sales user cherry picking leads from the queue so we would want them to restrict the users to just be able to pick leads which are the oldest only.

Can someone help me with a trigger or validation rule which will limit

Please suggest how I can limit the sales users to only accept the oldest leads from the queue.

Thanks, 
Domnic
Is it possible to limit the members of queue to accept only the oldest lead from a queue?

 
I have a field on user object which counts the number of leads which has lead status as uncontacted.
I have a lead queue and I want to limit the number of leads the users can accept. ( I don't want the users tp accept any leads from the queue if they have 3 uncontacted leads)
Hi, 

I want to create a new tab for our leads queue, When I use the Web Tab option and add queues URL, its a like box in box.

Can someone help me create a Visualforce page for a Queue which is on Lead object, please.

Thanks
Hi,

We want to limit users from taking not more than 3 leads from the queue. 

When the lead is in the queue the lead status will be uncontacted, so when the user goes to list view of the queue they should not be able to take 4 leads which have uncontacted status and if the users try accepting 4 leads it should not let the users complete the action with a error messsage.

Hope someone can help out.

Thanks, 
Domnic

I set up a queue for leads. I want auto response rule set up so the leads which are going into the queue to get the correct email response according to the status. 

Any suggestion on how to get this done?

Hi All, 

I want to have leads be able to take x number of leads from the queue at a time and the next time they want to take they should not be having any uncontacted leads which are coming from the queue.

Please help
Hi, 

I want to know if its possible to create a link which will take the clients to a web page where they can email opt out from all the leads related to that email.

Thanks
Hi, 

Is it possible to create a visualforce page in which we have list view button of all the users?

Right now the boss likes to see all the lead list view of our users, so he logs in as users and see the list view. 

I want to create a visualforce page from where all the list view of all the users can be accessed.

Thanks
HI Everyone, 

So, the company I joined, Get a lot of new project every week and the sales agents are pick who will be working on it (there is no fixed team or pattern who will be working on a certian project)

So, the problem is that, right now we have 2 way, 3 way, 4 way & 5 way round robin set up and Lead Assignement Rules is set up and the leads are not being disturbuted evenly to the agents. I spoke to salesforce reps and they suggested I come here and ask for help

What I was told is, "​Creating a regular number field and applying apex triggers that would meet the criteria that you have for the assignment."

If Project (XYZ) RR it to Rep 1, Rep 2 Rep 3
If Project (ABC) RR it to Rep 1, Rep 2, Rep 3, Rep 4 Rep 5
If Project (123) RR it to Rep 1, Rep 2, Rep 3, Rep 4 Rep 5

Please, suggest how to get a code.

Thanks


 
Hi All, 

After the time change the Data and Time field  (Meeting data and time) is not working fine and picked up the local time (EST - Day Light Saving) But, the Forumal Data type>Data and Time (Meeting data and time (Long Format) is not picking up the the change. Below is the screenshot of what exactly and the code,  Hoping someone could help me fix the code here. 

Thanks

Time change not reflecting in formula field
Data Type	Formula	 	 
CASE( MONTH( DATEVALUE(Meeting_Date_and_Time__c)), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 'December') +' '+ text(DAY(DATEVALUE(Meeting_Date_and_Time__c))) +', '+ TEXT(YEAR(DATEVALUE(Meeting_Date_and_Time__c))) +' at '+IF( 
OR( 
VALUE( MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 12, 2 ) ) = 0, 
VALUE( MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 12, 2 ) ) = 12 
), 
"12", 
TEXT( VALUE( MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 12, 2 ) ) 
- 
IF( 
VALUE( MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 12, 2 ) ) < 12, 
0, 
12 
) 
) 
) 
& ":" & 
MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 15, 2 ) 
& " " & 
IF( 
VALUE( MID( TEXT(Meeting_Date_and_Time__c - (4/24) ), 12, 2 ) ) < 12, 
"am", 
"pm" 
)

 
Hi, 

Am trying to change ownersship on leads and am getting the following error, I got in touch with MC to check if they could help me but no luck so thought I would check and see if anyone could educate me and solve this issue.

Error: Apex trigger MC4SF.Lead caused an unexpected exception, contact your administrator: MC4SF.Lead: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0O1500000MiJq5EAF; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []: (MC4SF)
Hi, 

We have Person account enabled.  What am trying to achieve is,
  • To have a trigger fire when the Account_View__c field is blank
  • Every time a new lead is created in our system 
  • If Account_View__c is blank
  • Search the existing accounts for matching Name, Email & Phone ( as its person account the field name are : Name, Phone, PersonEmail)
  • Populate Account_View__c field (Agent can link this field and access leads account info)
​Hoping someone could help me out here.

Thanks 

 
Hi,

I'm trying to add mutiple fields but its giving me a error.

Can anyone help me in reducing the size of this formula.


FM_Total_Payments__c + SM_Total_Payments__c +

Agent2_Total_Payments__c + Agent3_Total_Payments__c  +

Agent4_Total_Payments__c + Agent5_Total_Payments__c + COOP_Total_Payments__c 

Thanks, 
Hi All, 

I want to check if there is a way, I could create a custom field on lead object called "Account" and this field populates ever time a new leads comes in to salesforce, the Account field should populate a associated existing account based on matching email criteria. 

Thanks
Hi, 

Am trying to change ownersship on leads and am getting the following error, I got in touch with MC to check if they could help me but no luck so thought I would check and see if anyone could educate me and solve this issue.

Error: Apex trigger MC4SF.Lead caused an unexpected exception, contact your administrator: MC4SF.Lead: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0O1500000MiJq5EAF; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []: (MC4SF)
If((LeadList[0].OwnerId != '005User1') || (LeadList[0].OwnerId != '005User2) || (LeadList[0].OwnerId != '005User3'))

Need help writing this line better
I want to restrict sales users from accepting new leads under they ownership when there are old leads in a queue

How can this be done? Please, help!
We don't want our sales user cherry picking leads from the queue so we would want them to restrict the users to just be able to pick leads which are the oldest only.

Can someone help me with a trigger or validation rule which will limit

Please suggest how I can limit the sales users to only accept the oldest leads from the queue.

Thanks, 
Domnic
Is it possible to limit the members of queue to accept only the oldest lead from a queue?

 

I set up a queue for leads. I want auto response rule set up so the leads which are going into the queue to get the correct email response according to the status. 

Any suggestion on how to get this done?

Hi All, 

I want to have leads be able to take x number of leads from the queue at a time and the next time they want to take they should not be having any uncontacted leads which are coming from the queue.

Please help
Hi, 

I want to know if its possible to create a link which will take the clients to a web page where they can email opt out from all the leads related to that email.

Thanks
Hi, 

Is it possible to create a visualforce page in which we have list view button of all the users?

Right now the boss likes to see all the lead list view of our users, so he logs in as users and see the list view. 

I want to create a visualforce page from where all the list view of all the users can be accessed.

Thanks
HI Everyone, 

So, the company I joined, Get a lot of new project every week and the sales agents are pick who will be working on it (there is no fixed team or pattern who will be working on a certian project)

So, the problem is that, right now we have 2 way, 3 way, 4 way & 5 way round robin set up and Lead Assignement Rules is set up and the leads are not being disturbuted evenly to the agents. I spoke to salesforce reps and they suggested I come here and ask for help

What I was told is, "​Creating a regular number field and applying apex triggers that would meet the criteria that you have for the assignment."

If Project (XYZ) RR it to Rep 1, Rep 2 Rep 3
If Project (ABC) RR it to Rep 1, Rep 2, Rep 3, Rep 4 Rep 5
If Project (123) RR it to Rep 1, Rep 2, Rep 3, Rep 4 Rep 5

Please, suggest how to get a code.

Thanks


 
Hi, 

We have Person account enabled.  What am trying to achieve is,
  • To have a trigger fire when the Account_View__c field is blank
  • Every time a new lead is created in our system 
  • If Account_View__c is blank
  • Search the existing accounts for matching Name, Email & Phone ( as its person account the field name are : Name, Phone, PersonEmail)
  • Populate Account_View__c field (Agent can link this field and access leads account info)
​Hoping someone could help me out here.

Thanks 

 
Hi,

I'm trying to add mutiple fields but its giving me a error.

Can anyone help me in reducing the size of this formula.


FM_Total_Payments__c + SM_Total_Payments__c +

Agent2_Total_Payments__c + Agent3_Total_Payments__c  +

Agent4_Total_Payments__c + Agent5_Total_Payments__c + COOP_Total_Payments__c 

Thanks, 
Hi All, 

I want to check if there is a way, I could create a custom field on lead object called "Account" and this field populates ever time a new leads comes in to salesforce, the Account field should populate a associated existing account based on matching email criteria. 

Thanks
Hello everyone 
I have a custom field named "number of leads" associate to a campaign object and I want to calculate a number of leads associate to this company 
when a lead was registred , the value of  "number of leads " became number of leads +1
what can I do ?? 
thank you for your time
  • April 21, 2015
  • Like
  • 0