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
saimounikasaimounika 

Issue with Restrict Reflective Access to Non-Global Controller Constructors in Packages critical update

Hi,
My lightning component and apex class are not a part of managed package and they are public. However i am still getting the "ApexType does not have a no-arg constructor" error after enabling this critical update.

I am getting this error when i am passing the wrapper class list from lightning component to apex class.So, I have serialzed the wrapper class in lightning component and deserialized in apex class. Then the issue got fixed.

Anyone else faced the same issue ? Why I am facing this issue with component which are not a part of managed packages/namespace?
Is this a valid fix?

Thanks!
VinayVinay (Salesforce Developers) 
Hi,

Review below link which has similar issue and try workaround mentioned.

https://salesforce.stackexchange.com/questions/312706/critical-update-error-now-showing-up

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
saimounikasaimounika
Hi Vinay,

The blog is having a solution for managed package. My issue is different here.

Thanks!
KalyanCharanKalyanCharan
Hi Mounika,

We ran into the same issue while passing a wrapper list from aura controller to apex. Can you share how you serialized and deserialized the wrapper list to solve this?
saimounikasaimounika
Hi Kalyan,

We have serialized the list in aura controller as below :
paramToApex:JSON.stringify(component.get("/your parameter/"));

And deserialized in apex class as below
List<wrapperCls>wrpLst=new List<wrapperCls>();
wrpLst=(List<wrapperCls>)JSON.deserialize(paramToApex,List<wrapperCls>.class);

Also ,you have to change the apex class input parameter type to string(In the above syntax the string parameter is "paramToApex") as we are serializing and sending in aura.Hope this helps :)

Thanks,
Mounika