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
Subhrajyoti NathSubhrajyoti Nath 

validation

why we should use the validations for restricting the users based on thier profile name not based on their profile id ?
Best Answer chosen by Subhrajyoti Nath
Kevin AkermanisKevin Akermanis
To expand on this a little bit...  Best practice is that you should not be doing any configuration/dev work directly in your Production org, rather you should be spinning up a sandbox, performing your changes in there and migrate that up to Prod using tools like Change sets.

If we take that background context into consideration now, that is why hard coding IDs is a bad idea as the Profile ID will have a different value in your Sandbox vs. in your Production environment.  This means that your validation will break once you've migrated it into Production.

All Answers

ManojjenaManojjena

Hi Subhrajyoti Nath,

We hould not hard code any id it may ver from organisation to organisation that is why we should use Name in place of Id .

I think you ar ecleaar now .
Let me know if it helps !!
Thanks
Manoj

Kevin AkermanisKevin Akermanis
To expand on this a little bit...  Best practice is that you should not be doing any configuration/dev work directly in your Production org, rather you should be spinning up a sandbox, performing your changes in there and migrate that up to Prod using tools like Change sets.

If we take that background context into consideration now, that is why hard coding IDs is a bad idea as the Profile ID will have a different value in your Sandbox vs. in your Production environment.  This means that your validation will break once you've migrated it into Production.
This was selected as the best answer
Subhrajyoti NathSubhrajyoti Nath
Thanks guyzz