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
jeba mjeba m 

Required field to be updated while saving a record.....

I have two fields "X" and "y" both are text fields.And i want these two fields to be concatenated in a required  text field called "name" in an object.Please help me..... 
gautam_singhgautam_singh
There are 2 process do it with customization.

1. Using Formulas

Let teh field in which you want the concatenated value to be stored as Formula Field & just put a formula to concatenate say i want to concatenate Name and Number of Account into Billing city formula field then I would write the formula as  "Name  &  AccountNumber".

This will be a read only field & you cannot edit it.

2. Using Workflows


1. Go to workflows. Click New Rule. Select the Object say Account.
2. In Step 2, Give the Rule a proper name.Put criteia as Account Name is not equal to null which means for all accounts this workflow will run.Keep the evaluation criteria as Created and Edited.Click Next.
3. Add a workflow action, New Field Update.Give it a name and select the field in which you want the concatenation to be updated.
4. Select Use Formula to set the new value.
5. In the Formula editior, select the 2 fields which you want to concatenate in a single field. Say I want to concatenate the Account Name & Account Number in the Billing city. I will write in the formula "Name  &  AccountNumber" & click Save.
6. Done & Activate.
7. Once you Save a record the Account Name and Number will be concatenated and put in the Billing City.


Important :

If this is what you where looking for then please mark it as a solution for others benefits.

Thank You
Grazitti TeamGrazitti Team
Hi jeba,

Simply create a formula field of type text to concatenate two fields x and y.
formula field --> type text
Name = x& ", " & y


Now this will automatically populate the concatenated result of x and y, whenever you will create or update the record 
Please Mark this as Answer if it helps you
--
Regards,
Grazitti Team
Web: www.grazitti.com
Email: sfdc@grazitti.com
JeffreyStevensJeffreyStevens
If it's a required text field called Name - I assume it can NOT be a formula field.  
Ranjeet Singh (SFDC Developer)Ranjeet Singh (SFDC Developer)
Hi jeba m,

You can write the trigger on the Object:
In trigger you have to concatenate the both field value and assign to the name field.

Example:
trigger updateRequiredField on Account(before insert, before update){

   for(Account acct : Trigger.New){
      acct.Name = acct.XField_APIName +'-'+ acct.YField_APIName;
   }

}

in above code, I took examples of Account Sobject.
Based on the object API name & Field API name, you have to update.

Please let me know if you find any issue.

Thanks & Regards,
Ranjeet Singh.
Grazitti TeamGrazitti Team
JeffreyStevens, I agree if you are creating formula field there is no such option as "Required" , so alternate for that is to create workflow
and use the same formula to do the field update-->
                                       Name = x& " " & y



Regards,
Grazitti Team
Web: www.grazitti.com
Email: sfdc@grazitti.com
jeba mjeba m
I want the required field to be updated by concatenating two other fields into the required text field....Please suggest me guys...
JeffreyStevensJeffreyStevens
I think Grazitti Team has the right answer - use a Field Update Workflow.
yvk431yvk431
Can you let us know how the field was made required, is it through page layout or is it through a validation rule?


--yvk