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
DeveloperDeveloper 

Incorrect parameter type for function 'ISPICKVAL()'. Expected Picklist, received Text

AND(
   $Profile.Name <> "System Administrator",
  ISCHANGED(StageName),
  ISPICKVAL(StageName, "Closed Lost"),
  ISPICKVAL(Loss_Reason__c, "")
)
please help this issue ?

PLEASE
Best Answer chosen by Developer
NagendraNagendra (Salesforce Developers) 
Hi Gopal,

If you can see in the respective trailhead module it is given that "we assume that you already have the custom picklist field, Loss Reason, populated with valid reasons for losing an opportunity. Because no one should be able to save a record without providing a reason".It states there is now such field in the object which enforces you to create one Loss_Reason__c​ field with picklist values accordingly.

Please follow the below steps and give a try which should probably resolve the issue.
  • Create a custom field Loss_Reason__c(this is API name) on opportunity object.
  • Provide some picklist values for the respective field.
  • While writing the validation rule on the opportunity object refer the Loss_Reason__c field with any one of the picklist values you have created at the time of field creation.
  • Now check the syntax.
Please let us know if this helps.

Regards,
Nagendra.

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Gopal,

May I request you to please elaborate your requirement what you are trying to achieve so that we can understand better and help you accordingly.

Regards,
Nagendra.
LBKLBK
Is the custom field Loss_Reason__c of picklist type?

According to the error you are seeing, it may not.
NagendraNagendra (Salesforce Developers) 
Hi Gopal,

If you can see in the respective trailhead module it is given that "we assume that you already have the custom picklist field, Loss Reason, populated with valid reasons for losing an opportunity. Because no one should be able to save a record without providing a reason".It states there is now such field in the object which enforces you to create one Loss_Reason__c​ field with picklist values accordingly.

Please follow the below steps and give a try which should probably resolve the issue.
  • Create a custom field Loss_Reason__c(this is API name) on opportunity object.
  • Provide some picklist values for the respective field.
  • While writing the validation rule on the opportunity object refer the Loss_Reason__c field with any one of the picklist values you have created at the time of field creation.
  • Now check the syntax.
Please let us know if this helps.

Regards,
Nagendra.
This was selected as the best answer
DeveloperDeveloper
Hi Nagendra,
Sorry for late reply, it's working fine.
Thank you.