• Ishan Singh 4
  • NEWBIE
  • 30 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 12
    Replies
Error element myRule_1_A1 (FlowRecordCreate).
This error occurred when the flow tried to create one or more records: The flow failed to access the value for myVariable_current.Lead__r.Id because it hasn't been set or assigned.. You can look up ExceptionCode values in the SOAP API Developer Guide (https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.salesforce.com%2Fdocs%2Fatlas.en-us.api.meta%2Fapi%2Fsforce_api_calls_concepts_core_data_objects.htm%23&data=01%7C01%7Cishan.singh%40mirketa.com%7C1926b9cb26244bc56cd708d81f17a949%7C52fa2bd8925246718c3ea372d414d3be%7C0&sdata=vH7xag6ZpErenpqK7dJmXA7YjPZFedOVsSDAz0rQHnM%3D&reserved=0" style="color:blue; text-decoration:underline).
I have mentioned below details in Task created by batch class 
Task C = new Task();
            C.Subject= 'xxx';
            C.ActivityDate = date.today();
            C.OwnerId = l.OwnerId;
            C.WhoId=l.Id;
            C.Type = 'yyy';   
I am creating process builder correctly 



 

I have configured my salesforce org with JOT form. My lead assignment rule is also active. But due to some reason it is not working. Can any one suggest me why it is not working and hot to run it.

Thank you  

Health status is a field whose value can be 'Healthy' or 'healthy'. So i want to use contains in my code so that in either way it should run. I am using it as shown below:

l.Health_Status__c.contains('Healthy')
l is a variable 
Date Todaydate =system.today();
    if ( l.Age__c == Todaydate)

Age__c is formula field
my query parameter is correct
Using debug log I found code is not going below "if"
The size of data may very from 100 to 100000 depending on query. So can someone suggest me a mulesoft connector to perform it. Like I Query, query all, Bulk api or anything. If you can point out the limitations of that connector then it will be fabulous.   
If you are sugesting for process builder please specify the criteria and if you are doing it with report then also specify what filters I should use.

I have a duplicae matching rule as below:
1. Last name should not be the same.
2. Phone number should not be the same.  

Currently I am using duplicate rule but through it I am not able to send email. If you are suggesting for a process builder then please mention the criteria to trigger it.
The Matching rules are:
Last name
Phone number  

I have a trigger which works on (after insert, after update) 

but due to some reason the task owner is not assigned when task is created but when I update the task it's owner name populates. I can not do any changes in existing code beacuse it's too complex. So is there any way by which I can update a task owner when 'Round_Robin_ID__c ' field = 1 to XYZ  

I am trying this   -    newTask.Lead__c.RR_ID__c == 2

newTask = new task[on task object]
RR_ID__c = custom field on lead object 

Error - Variable does not exist: newTask.Lead__c
There is a custom field name - RR id on lead object.
I want to access that RR id field in my apex class from Task object 
Currently  I am using NEXT_N_DAYS : 7 but it is running for leads with 7 days and also for less than 7 days
The formula for due date is correct. This problem is coming when a lead is inserted on monday and according to formula of due date when a lead is entered on sunday, the task generated due date should be on next day.  
 for(Lead l: scope)
        {
            
            if(l.State!=''){ //State is not empty
                l.State__c =l.State__c;
            }else{    //State is empty
                l.State__c ='Default';}
            
            
            l.Age__c = l.Current_Age__c;
            
        }
        update scope;
    }
There is a custom field name - RR id on lead object.
I want to access that RR id field in my apex class from Task object 

Currently I am using duplicate rule but through it I am not able to send email. If you are suggesting for a process builder then please mention the criteria to trigger it.
The Matching rules are:
Last name
Phone number  

I have a trigger which works on (after insert, after update) 

but due to some reason the task owner is not assigned when task is created but when I update the task it's owner name populates. I can not do any changes in existing code beacuse it's too complex. So is there any way by which I can update a task owner when 'Round_Robin_ID__c ' field = 1 to XYZ  

I am trying this   -    newTask.Lead__c.RR_ID__c == 2

newTask = new task[on task object]
RR_ID__c = custom field on lead object 

Error - Variable does not exist: newTask.Lead__c
There is a custom field name - RR id on lead object.
I want to access that RR id field in my apex class from Task object 
The formula for due date is correct. This problem is coming when a lead is inserted on monday and according to formula of due date when a lead is entered on sunday, the task generated due date should be on next day.  
 for(Lead l: scope)
        {
            
            if(l.State!=''){ //State is not empty
                l.State__c =l.State__c;
            }else{    //State is empty
                l.State__c ='Default';}
            
            
            l.Age__c = l.Current_Age__c;
            
        }
        update scope;
    }
global class BirthdayCard implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc)
     {
        return Database.getQueryLocator([SELECT OwnerId,DOB_Formula__c,Id,Possible_Followup_Date__c FROM Lead WHERE DOB_Formula__c =  NEXT_N_DAYS:7 AND Possible_Followup_Date__c != null]);
    }
    global void execute(Database.BatchableContext bc, List<Lead> scope)
    { 
        List<Task> listOfTask = new list<Task>();
        
        for(Lead l : scope)
        {
            Task B = new Task();
            B.Subject= 'Send Birthday Card';
            B.ActivityDate = date.today();
            B.OwnerId = l.OwnerId;
            B.WhoId=l.Id;
            listOfTask.add(B);
 
batchClass

global class BirthdayCard implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc)
     {
        return Database.getQueryLocator([SELECT dateOfBirth__c,Id,Possible_Followup_Date__c FROM Lead WHERE dateOfBirth__c =  NEXT_N_DAYS:7 AND Possible_Followup_Date__c != null]);
    }
    global void execute(Database.BatchableContext bc, List<Task> scope)
    {
        for(Task l : scope)
        {
            Task B = new Task();
            B.Subject= 'Send Birthday Card';
            B.ActivityDate = date.today();
            B.OwnerId = l.OwnerId;
            B.WhoId=l.Id;
            
                   
       }
        insert scope;
    }
    global void finish(Database.BatchableContext bc){}
    
}

testClass:

@isTest
public class BirthdayCardTest{
    @isTest
    public static void BirthdayCard(){
        List<Lead> leadList = new List<Lead>();
        {
            Lead ld = new Lead();
            ld.lastname = 'test';
            ld.dateOfBirth__c = date.today().addDays(7);
            ld.Status = 'Unqualified';
            ld.State__c='Test';
            ld.Policy_DB_Amount__c=100000;
            ld.Company='Mirketa';
            ld.Possible_Followup_Date__c=date.today()
            
           leadList.add(ld);  
        }
        insert leadList;
        Test.startTest();
        Database.executeBatch(new BirthdayCard());
        Test.stopTest();
    }
}