function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ishan Singh 4Ishan Singh 4 

I have created a task using batch class and now I want to create followup task using process builder but getting this error.

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 



 
ShirishaShirisha (Salesforce Developers) 
Hi Ishan,

Greetings!

I can see that you have setup the whoId to assign it to the Lead record but can you please double check,if you are passing the lead record for lead in the Process builder.

Please make sure that the Lead l variable has any value or set to any variable to pass the recordId.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri