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
ShriramShriram 

Issues related to Record Type

Hi

I have created two Record type say A, B for a custom object and assigned the record type to repective page layout say A, B.
When a user clicks on the continue button after choosing the record type I want to check if a record already exists for the selected record type. If a record type exists then one more record cannot be added to the same record type.
In this case i need to show a error message and redirect the user back to original screen.

I am wondering how this funtctionality can be achieved ?
Anyinputs and sample code would do wonders for me..

Thanking in advance..

Regards



deshawdeshaw
Do you mean, "You only need to have a record for each record type and not more than one?"

You can use a trigger "before insert" and throw the error before the user tries to save the object.
The other way is to write the Scontrol, which does the job of the above trigger well before the window being shown to the user.

Regards,
Manickkam.