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
decentshaildecentshail 

Data Type changed: Picklist to multi select picklist

Hi All,

     I have to changed the data type of field (say Region__c) from picklist to multi picklist. But issue is this field is used in many apex classes and trggers in prod. Is there any way to change the data type without deploying the classes and trigger again.

 

Thanks,

Shail

Shashikant SharmaShashikant Sharma

No issue in it you don't need to deploye any  page which is using this field. Just deploye this updated field. Every thing will remain intact after you change picklist to multi-select picklist. You can confirm it by opening your page, it will show up multi-select picklist. That will confirm you that all pages are in tact.

Ankit AroraAnkit Arora

If your picklist field is used in apex class or trigger, then am afraid you can not change its data type.

 

You first need to comment out the places where you are refering it then change the data type of field > Now remove the comments from classes and triggers > Deploy all classes and pages to production.

 

There is no way out per my knowledge.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Shashikant SharmaShashikant Sharma

One more concern here, are you using any validation rule or workflow rule etc where you are refering this field?

decentshaildecentshail

Hi Shahsi,

      Ankit is right. We can't change the data type of field in prod if this field is already used in some trigger and apex class only solution is comment the lines using this field, change the data type and deploy the apex class, trigger uncommenting.

 

there is some tool used in some orgnization which do this type of stuff not sure about type of application java/apex.

Shashikant SharmaShashikant Sharma

Yes thats correct, You need to comment out the statements, and about the tool, iam not aware but I can suggest the way by which we used to do it.

I hope you are using Eclips,  if not use it. Make a search in all classes and triggers,  use ctrl + H , it will show up all apex class and triggers with this field comment out all the places , change the field type and againg uncomment all.

 

Ankit AroraAnkit Arora

The thing is you need to comment all instances and then change the data type and then again uncomment the classes.

 

Doesn't seems to have another option. So if the reply helped you then please mark it as solution.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page