You need to sign in to do that
Don't have an account?
Siddardha Nalluri 1
Validation Rule for Create a Check Box
Hi,
In the custom candidate object i created two fields to mailing address and a billing address.I created a checked datatype field that should Copy Mailing address to Billing address. When you check it should copy all the fields in Mailing address to Billing Address.
In the custom candidate object i created two fields to mailing address and a billing address.I created a checked datatype field that should Copy Mailing address to Billing address. When you check it should copy all the fields in Mailing address to Billing Address.
Your title and the requriement description do not match.
Assuming your requirement description is what you need to build, you can use a Workflow Rule or a Process Builder with a Field Update action to copy over the values from the Mailing Address fields to the Billing Address fields.
Assuming the API Name of the checkbox to copy over the address value is CopyMailingAddress__c, you can use the following formula as the criteria to trigger the Workflow Rule.
Validation Rules are used to enforce restrictions for data inputs so that they comply with the expected data norms and cannot be used to update fields.
You can use the workflow rule instead of Validation, because according to your requirement this is not possible with validation.
First do the Trailhead if you are not aware with Workflow Rule.
Please try the below using Apex Class And Trigger:
Apex class coding:
public class SampleApexClass {
public static void SampleMethod1(List<Candidate__c> c1)
{
Candidate__c c=new Candidate__c();
if(c.Copy_Mailing_address_to_Billing_address__c==true)
{
c.Mailing_address__c=c.Billing_address__c;
}
}
}
Apex Trigger coding:
trigger Hello on Candidate__c (before insert, before update) {
if(Trigger.isInsert && Trigger.isBefore)
{
Candidate__c[] c1 = Trigger.new;
SampleApexClass.SampleMethod1(c1);
}
Let me know if its works as you excepted.
Thanks,
Jenefa
Sweet Potato Tec
Please try the below using below one:
Two fields to mailing address and a billing address
CheckBox datatype field that should Copy Mailing address to Billing address
Billing Address to Mailing Address
Workflow:
Rule Criteria:Copy_Mailing_address_to_Billing_address__c =true
Formula:Billing_Address__c
Result:
Let me know if its works as you excepted.
Thanks,
Jenefa
Sweet Potato Tec