• aaryan sri
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies
Hi All,
Disposition creation on lead record we are creating a task record for that. I wrote a logic on task trigger to capture lead status while task record creating. On task records creation we are capturing lead memberid, date and status from associated lead. Issue is task record lead status field is not matching with current lead status. Lead status is updating after task record creates task record, so task record lead status is not matching with current lead status. Please help me out how to match task lead status with current lead status.
below is the code logic written on Task tirgger handler 

 Map<id,Lead> mapLead = new Map<id,Lead>([SELECT ID,Name,CompName_HF__c, Membbno_HF__c,Recertdate_HF__c,Status FROM Lead Where id IN:lstLeadId]);
          for(Task objTask : lstNewTaskMap)
          {
              if(objTask.Task_Created_Profile_Name__c.contains('ORS'))
                {
                    System.debug(' Entered into Lead loop' );
                    if(objTask.Subject <> NULL && objTask.Subject.contains('Call') && objTask.Status=='Completed')
                    { 
                     System.debug(' Entered into Task Type loop' );
                      objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
              
                }
                      if(objTask.whoid==null) continue;
                if(mapLead.get(objTask.whoid)==null) continue;
                if(objTask.WhoId <> NULL && objTask.WhoId.getSobjectType() == Lead.getSObjectType())
                  {
                  Lead objLead = mapLead.get(objTask.whoid);
                      system.debug('***** objLead '+ objLead);
            
                        if(objTask.Type != null && objTask.Type.contains('Call'))
                        { 
                               objTask.TaskSubtype=Static_Variables_Retention_HF.Task_SubType;
                
                        }
                            objTask.RecordTypeId=Static_Variables_Retention_HF.taskRetentionRTID;
                              system.debug('objLead.Membbno' + objLead.Membbno_HF__c);
                            objTask.Lead_MemberId_HF__c=objLead.Membbno_HF__c;
                              system.debug('objTask.LeadMemberId' + objTask.Lead_MemberId_HF__c);
                                objTask.Lead_Status_HF__c=objLead.Status;
                              system.debug('objTask.LeadStatus' + objTask.Lead_Status_HF__c);


 
HI,

  Am trying to restrict phone no to 10 digits and i should accept format either (999) 999-9999 or 999-999-9999 or 999999999.
I wrote below validation 
AND(
    NOT(ISBLANK(Prescriber_Phone_Number_Last_Fill_Date__c)),
    NOT(
        OR(
            ISNUMBER(Prescriber_Phone_Number_Last_Fill_Date__c ),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c,"[0-9]{3}-[0-9]{3}-[0-9]{4}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "\\D*?(\\d\\D*?){10}"),
            REGEX(Prescriber_Phone_Number_Last_Fill_Date__c, "[0-9]{10}")
        )
    )
)    

It is allowing more than 10 and Alphabets .

 Can somebody help me how to fix this?
 
Hi All,

Based on condition, value should store on sring. Present formula writtens below way

totalBusinessDistance = String.valueOf((Decimal)ar.get('totalBusinessDistance')-(2*(Decimal)ar.get('totalCommutingMiles')));
  
 Presently  totalBusinessDistnece storing value of totalBusinessDistance- 2*totalCommutingMiles.  Now want to be if (totalBusinessDistance- 2*totalCommutingMiles) value comes below 0 then totalBusinessDistance store only 0 other wise it  should store (totalBusinessDistance- 2*totalCommutingMiles).