You need to sign in to do that
Don't have an account?

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!
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!
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:- When user click on "Request" button
- call the apex controller with method.
- In Method check if Order is already requested, if yes then show vf page error with custom message.
- Check this link for adding VF page: http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/ (http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/)
Hope this helps!!!Thanks,
Gaurav
Skype: gaurav62990
Takes Freelance Job
All Answers
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:- When user click on "Request" button
- call the apex controller with method.
- In Method check if Order is already requested, if yes then show vf page error with custom message.
- Check this link for adding VF page: http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/ (http://www.sfdcpoint.com/salesforce/show-error-message-visualforce-page/)
Hope this helps!!!Thanks,
Gaurav
Skype: gaurav62990
Takes Freelance Job
The second way is the most suitable for me. I' ve solved this problem as you described.
Love to help you.
Thanks,