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

How to make input form Readonly based on User profile in Lightning Component?

I have an Action button in our lightning Page, upon clicking it shows a form to input couple of fields and save it. But I have to make those input fields readonly for Profile 1 and editable for Profile 2.
Let me know how I can achieve this. If possible within Lightning component itself by checking profile of the current user, As I am already calling server side script upon clicking this button in doinit and form based on the return values. 
Is it possible that i get 2 return values from apex and one of them will be to read the profile and make the input fields readonly. 
pradeep kumar yadavpradeep kumar yadav
Hi Navinku,

You can use lightning:recordEditForm component, it will automatically shows fields in form according to user accessiblity.
Or, you can return a wrapper from server-side-action in doInit with your previous data along with user-profile details and apply that on component.