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
Vladimir BessonovVladimir Bessonov 

Cannot cast type


I have the following code 
 
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Variable does not exist: PartList1 (35:89)
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Invalid loop variable type expected SObject was Propulsion_Part__c



I am getting the following errors
 
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Variable does not exist: PartList1 (35:89)
Error  force-app/main/default/classes/ObjectStatusUpdate/ObjectStatusUpdate.cls  Invalid loop variable type expected SObject was Propulsion_Part__c



What is wrong? Instead of hard coded Custom__c, I want it to define by ID passed or name 'Custom__c'. 

I saw this code in various places, but it doesn't work for me.
 
Abhishek BansalAbhishek Bansal
Both the blocks are same. Can you please add the code?