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
knightknight 

copy from one field to another

Hello ... I need to copy data from one field to another on the same object ..

 

Here is the requirement..I have 2 custom fields on an object. I need to create a 3rd formula field where it has to copy data from field1 if field 2 is empty.Also copy data from field 2 if field 1 is empty ..return a null if nothing is populated... Is there a way that I can do this....I tried ISNULL and BLANKVALUE but couldnt figure it out

 

Any help is appreciated

Best Answer chosen by Admin (Salesforce Developers) 
netTrekker_ADnetTrekker_AD

 

IF(ISBLANK( Field_1), Field_2 ,
  IF(ISBLANK(Field_2), Field_1,null
  )
)

 

There you go. Make sure that you "Treat blank fields as blanks".

 

This worked for me.

 

All Answers

netTrekker_ADnetTrekker_AD

Try this as the Field_3's formula:

 

 

IF(ISNULL(Field_1), Field_2,
IF(ISNULL(Field_2), Field_1,
null))

 

Let me know if it works and then mark it solved if so.

 

knightknight

sorry ..that did not work

netTrekker_ADnetTrekker_AD

Did you get a syntax error or did the field just not populate with what you wanted it to populate with?

knightknight

It did not populate anything...The source fields are percentage fields

netTrekker_ADnetTrekker_AD

Is it ever possible that the two source fields would both be populated?

 

Not that it will fix the formula, but make sure that the  Formula Return Type is Percent for your third field instead of Text.

knightknight

no both the fields will not be populated and yes the return type is percent

netTrekker_ADnetTrekker_AD

 

IF(ISBLANK( Field_1), Field_2 ,
  IF(ISBLANK(Field_2), Field_1,null
  )
)

 

There you go. Make sure that you "Treat blank fields as blanks".

 

This worked for me.

 

This was selected as the best answer
knightknight

thanks so much ..that worked