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
Deepika Gupta 26Deepika Gupta 26 

Validation Rule issue

I have Req that when the new record is created that is temp account and if the parent account field is not blank then account category and subcategory must be blank.is this possible via validation rule?i yes then could any one suggest that how to do that
Krishna SambarajuKrishna Sambaraju
Try this.
AND(
	ISNEW(),
	BEGINS(Name, 'Temp'), // to check the temp account change field according to your needs
	NOT(ISBLANK(ParentId)),
	OR(
		NOT(ISBLANK(AccountCategory)),//api names of category and subcategory fields
		NOT(ISBLANK(AccountSubCategory))
	)
)
When the above Error condition is true, then display the error message "Category and Sub Category must be blank".

Hope this helps.
 
Deepika Gupta 26Deepika Gupta 26
its showing me the error that
Error: Field AccountCategory__c is a picklist field. Picklist fields are only supported in certain functions
Krishna SambarajuKrishna Sambaraju
I should have expected the Category and SubCategory fields are picklists. Here is the update.
AND(
	ISNEW(),
	BEGINS(Name, 'Temp'), // to check the temp account change field according to your needs
	NOT(ISBLANK(ParentId)),
	OR(
		NOT(ISBLANK(TEXT(AccountCategory))),//api names of category and subcategory fields
		NOT(ISBLANK(TEXT(AccountSubCategory)))
	)
)
Hope this helps.