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
Manogna KoviManogna Kovi 

I have two objects one is a standard object i.e Account and the other one is a custom object and their have a look up relations .I have created 3 text fields as A,B,C in custom object.

I have two objects one is a standard object i.e Account and the other one is a custom object and their have a look up relations .I have  created 3 text fields as A,B,C in  custom object.Now when I concatenate b/w A and B , the result should get displayed in C.when u type the value manually in field C ,it should throw the error.So which type of trigger is used and how wil u write the code?
Shubham4462Shubham4462
Hello Manogna ,

You only need the ConCatinate value of A and B in C Field so why you need to throw error when user manually typing on this field ? ,

1.According to me You can make C field as readonly from pageLayout and populate C Value From trigger like this 
trigger ValidationOnField on Property__c (before insert) {
    
    for(Property__c p : Trigger.New){
        String conResult = p.A__c+' '+p.B__c;
        p.C__c=conResult;

    }

}

 
Nandigam RajeshNandigam Rajesh
Hello Manogna,
Hope this may helps you and better practice:

In formula field , choose "Output type" : Text and then use the formula Like : A__c +  B__c or need a space between them A__c + ' ' + B__c;
But by using this you cannot reused C field to entering manual data


Cheers
Rajesh