Skip to main content
Encora Lab (Encora) 님이 #Data Management에 질문했습니다

I have an APEX class with an @InvocableMethod which is executing from Process builder on Lead object,

I am trying to assign Owner for new lead based on round robin arrangement, but its throwing 

 

My Code:

String lo=fetchLeadOwner(activeLOs);

System.debug('We chose ::'+lo+':: Based on less number of leads');

leadDetails.OwnerId = lo; // here getting System.FinalException: Record is read-only

update leadDetails;

LOG:

 

USER_DEBUG|[15]|DEBUG|We chose ::0052h000000WhyWAAS:: Based on less number of leads

 

STATEMENT_EXECUTE|[16]

 

HEAP_ALLOCATE|[16]|Bytes:4

 

EXCEPTION_THROWN|[16]|System.FinalException: Record is read-only

 

HEAP_ALLOCATE|[16]|Bytes:23

 

FATAL_ERROR|System.FinalException: Record is read-only

 

 
답변 2개
  1. 2019년 8월 21일 오후 4:41
    Did you query the lead record again in the Class? Process Builder acts like an after trigger in that the record is readonly.
0/9000