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
VICKY_SFDCVICKY_SFDC 

LWC RECORD FORM

Hi ,My requirement is I want to Create an Opportunity Record With Help Of Form,,

Requirement:
a)If i use any special chracter like "!@#$%^&*" in Name field it will throw an Custom Exception i.e ---->Special Chracter Not Allowed.

b)For type and StageName Field There should be a picklist field In Form.

c)There shoud be a custom checkbox field in form ,,so when we checked  and save in form,,,,,it will show as checked in Record as well

I ALREADY  Gone through multiple links ,,,didn't find the solution so m posing here


 
ShivankurShivankur (Salesforce Developers) 
Hi Vikas,

You can utilize the lightning-record-form (https://developer.salesforce.com/docs/component-library/bundle/lightning-record-form/documentation) documentation to implement this requirement.

For the other requirements mentioned, you can go with following approaches:
a) Create a validation rule with following type of condition to show error:
NOT(
        REGEX( Oppo_Name__c , "[!,@,#,$,%,^,&,*]*")
 )
Refer to similar example: https://www.infallibletechie.com/2012/11/validation-rule-for-numbers-and-special.html

b) If your org uses record types, picklist fields display values according to your record types. You must provide a record type ID using the record-type-id attribute in record form, if you have multiple record types on an object and you don't have a default record type. Otherwise, the default record type ID is used.

c) You might want to create a custom checkbox field and add to the record form while creating the record, so the values stores in database will show up when record is created and viewed.

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.