You need to sign in to do that
Don't have an account?
Synthia B.
Restrict Validation Rule from firing through Controller Class
When a new task is created on the Create Task VF page, Yes and No checkboxs does not exist but should remain blank upon new task creation.
How can I stop the Yes and No validation rule from firing on the Controller Class so that it does not affect the VF page?
The Yes and No checkboxes should remain blank until the task is revisited for editing.
With the code below No is automatically checked when the task is created which allows the user to no complete the section properly.
Thanks in advance!
How can I stop the Yes and No validation rule from firing on the Controller Class so that it does not affect the VF page?
The Yes and No checkboxes should remain blank until the task is revisited for editing.
With the code below No is automatically checked when the task is created which allows the user to no complete the section properly.
public pagereference insertSTC2(){ try{ scp_Of_srvc_tsk.No__c = True; scp_Of_srvc_tsk.Created_from_VF_page__c = true; upsert scp_Of_srvc_tsk;
Thanks in advance!
As i can clearly see that you are setting up a field Created_from_VF_page__c in your method and by the name of this field it will be only true when record is created from VF page.
So just edit your Validation Rule and Exclude it when Created_from_VF_page__c equal to true.
If you are unable to edit and modify your validation rule than please paste your Validation rule logic, I will do the rest
Please let me know if you need more help on this.
Thanks,
Abhishek
This is my VR
Please change your validation rule as follows :
If(Created_from_VF_page__c = true,false,If(OR(Yes__c=true,No__c=true)),true,false)
The vaidation rule will work as folows :
- If Created_from_VF_page__c = true than this rule will not be fired.
- If Created_from_VF_page__c is false and any value from Yes or No is true than it will be fired.
I think this is what you are expecting.Please let me know if i have misunderstood your requirement.
Thanks,
Abhishek.
I am getting an errors.
If(Created_from_VF_page__c) = true,false,If(OR(Yes__c=true,No__c=true)),true,false)
Error: Syntax error. Extra ','
Please update as follows :
If(Created_from_VF_page__c = true, false, If(OR(Yes__c=true,No__c=true),true,false))
The VR had no errors but still checked No when the task was created from the VF. I will look at this at a different angle. Thank you for all your help.
Thanks,
Synthia
Maybe the error is coming form some of your trigger or Apex class.
If you dont mind than can you please share the error which you are facing.
There are no errors. I will have to modify the VF page to replicate Checks and Balances in the screenshot in the first post. The VR alone will not work.
Thanks,
Synthia