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
Alex ShAlex Sh 

validation rule to check already existed item

Hi All,
I have a visualforce page with list of orders. And there is a link "Request" for every order. When I click "Request" link, then order gets a status "Requested".
I need to create a validation rule: If there is already order with the status “Requested”, then the user got a message that there is another pending order. Could someone help with this? Thanks!
Best Answer chosen by Alex Sh
GauravGargGauravGarg
Hi Alex,

There would be multiple workaround for this task. I would prefer two best approach:
1. Show Orders with status:
  • While displaying list of orders. The button which says "Request" can be used as toggle i.e. if the Order is available then button named as "Request" else "Already Requested / Pending".
2. Show VF page message: Hope this helps!!!

Thanks,
Gaurav
​Skype: gaurav62990
Takes Freelance Job

All Answers

GauravGargGauravGarg
Hi Alex,

There would be multiple workaround for this task. I would prefer two best approach:
1. Show Orders with status:
  • While displaying list of orders. The button which says "Request" can be used as toggle i.e. if the Order is available then button named as "Request" else "Already Requested / Pending".
2. Show VF page message: Hope this helps!!!

Thanks,
Gaurav
​Skype: gaurav62990
Takes Freelance Job
This was selected as the best answer
Alex ShAlex Sh
Thank you, Gaurav!
The second way is the most suitable for me. I' ve solved this problem as you described.
GauravGargGauravGarg
Alex,

Love to help you. 

Thanks,