You need to sign in to do that
Don't have an account?
StephenCrane
Validation Rule For Visual Force Page Button
Hey there, I got some help for this issue here (https://success.salesforce.com/answers?id=9063A000000tCRxQAM)- but still, don't fully understand how to do this. But I have the below code for a button that grabs parts of the Onboarding record to create another Onboarding record (of a specific record type).
And then triggers a flow. We want a validation rule that if some of the parts are bull then they get a message/pop up whatever to say it needs to be filled - like a Validation Rule.
I tried adding this piece of code to it and various tinkerings but no such luck.
There are about 6 fields that we need to have to be required for clicking this button. Thanks!
<apex:page standardController="Onboarding__c" > <flow:interview name="Create_Billing_Onboarding" finishLocation="/{!Onboarding__c.Id}"> <apex:param name="AccountID" value="{!Onboarding__c.Account__c}" /> <apex:param name="AccountName" value="{!Onboarding__c.Account__r.Name}" /> <apex:param name="PricingTier" value="{!Onboarding__c.Opportunity__r.Pricing_Tier__c}" /> <apex:param name="OpportunityID" value="{!Onboarding__c.Opportunity__c}" /> <apex:param name="DateOfSale" value="{!Onboarding__c.Opportunity__r.CloseDate}" /> <apex:param name="ChildrenOnSubsidy" value="{!Onboarding__c.Children_on_subsidy__c}" /> <apex:param name="HowDoTheyCurrentlyBill" value="{!Onboarding__c.How_Do_They_Currently_Bill_Parents__c}" /> <apex:param name="HowAreTuitionFeesCalculated" value="{!Onboarding__c.How_are_tuition_fees_calculated__c}" /> <apex:param name="HowFrequentlyAreParentsBilled" value="{!Onboarding__c.How_frequently_are_parents_billed__c}" /> <apex:param name="HowManyChildrenOnSubsidy" value="{!Onboarding__c.How_many_children_on_subsidy__c}" /> <apex:param name="IfNoWhy" value="{!Onboarding__c.If_No_Why__c}" /> <apex:param name="InterestedInInvoicing" value="{!Onboarding__c.Interested_in_invoicing_through_Himama__c}" /> <apex:param name="WillRecordSubsidyOutsideHiMama" value="{!Onboarding__c.Will_they_record_subsidy_outside_Himama__c}" /> <apex:param name="BillingNotes" value="{!Onboarding__c.Billing_Notes__c}" /> </flow:interview> </apex:page>
And then triggers a flow. We want a validation rule that if some of the parts are bull then they get a message/pop up whatever to say it needs to be filled - like a Validation Rule.
I tried adding this piece of code to it and various tinkerings but no such luck.
<apex:pagemessages> if ( Onboarding__c.Interested_in_invoicing_through_Himama__c == False) { Onboarding__c.Interested_in_invoicing_through_Himama__c.addError( 'You must enter a value'); } </apex:pagemessages>
There are about 6 fields that we need to have to be required for clicking this button. Thanks!
Try with this one ,
You can change the error icon size with 1-3 , 3 being the highest.
for checking all the fields , you can use AND() function
it will look like this AND(boolean field 1 , boolean field 2 , and so on)
Hope this helps!
Please replace
to
<apex:page standardController="Onboarding__c" lightningstylesheets= "true">
it means that the field is not boolean but actually is of text type
if it is text then you have to enclosed in single quotes
Hope this helps!