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
Dilyan DimitrovDilyan Dimitrov 

Hide standard field and copy data in the new recreated custom field

Hello,

I have a standard field called currency but I need to change its data type from picklist to multi-select picklist.

The problem is that it is not possible to change the data type of standard fields in Salesforce.

Therefore I'm trying to recreate the standard currency field but instead of removing the standard currency field is it possible to hide it in the layout?

What I would like to achieve is to hide the standard currency field and copy its data into the new field.

Could you please advise how this can be achieved?

Could you please advise how to copy the data from the standard currency field into the new recreated field.

Regards,

Dilyan
Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello Dilyan Dimitrov, 

You can achieve this by - 
1)  Data Laoder - Extract Id and old picklist using dataLaoder. Now, map the "new mutipicklist" field with the "old picklist" column in the CSV and update it. You will have to map ID with ID too. 
2) One-Time Script -  You can write one -time script to copy one field into another. 

Note : In above both the cases, last modified date of the record will be changed. 

Thanks, 
Sumit Kumar Singh.
Dilyan DimitrovDilyan Dimitrov
Hi,

I'd rather go for the second approach but could you please include some example code of such one -time script which can copy the entire data from one field to another?

Regards,

Dilyan
 
Sumit Kumar Singh 9Sumit Kumar Singh 9
Hello, 
I am supposing that fields are on Account object.
List<Account> accountListToUpdate = new List<Account>();
for(Account accRec : [select id, mulitsectctPicklist__c, picklist from Account]){
      accRec.multipicklist__c = accRec.picklist;
      accountListToUpdate.add(accRec);
}
if(accountListToUpdate !=null && accountListToUpdate.size()>0 ){
   update accountListToUpdate ;
}
The above will work fine for 10000 rec. If records are more than that, then you will have to modify the logic. 

Thanks,
Sumit Kumar Singh
 
Dilyan DimitrovDilyan Dimitrov
Hi Sumit,

Thank you for your comment and suggested code.

Could you plese close this ticket because I don't have an option to close it from my side.

Thanks,
Dilyan