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
Anwar Husain 25Anwar Husain 25 

I am new to apex coding and have this piece of code where I need to prepopulate a Sub account with address from parent account, this works for all fields except Country and State Picklists, any help would be greatly appreciated.

this.SBAAcctLst.add(new SBARelation(0, new Account(RecordTypeId = accRtSBAId,Owner_Fulfillment_Account__c=null, Phone_Type__c='Work',
                                            ShippingStreet=NSBAAcctLst[0].NSBA.ShippingStreet, 
                                            ShippingCity=NSBAAcctLst[0].NSBA.ShippingCity,
                                            ShippingState=NSBAAcctLst[0].NSBA.ShippingState,
                                            ShippingCountry=NSBAAcctLst[0].NSBA.ShippingCountry,
                                            ShippingPostalCode=NSBAAcctLst[0].NSBA.ShippingPostalCode), this));
Marcelo CostaMarcelo Costa
Hey Anwar,
By default, ShippingState and ShippingCountry are not picklists,but text fields.
Are you sure you haven't got some custom fields that you should populate?
Give a look at your object Schema (using schemaBuilder or on Setup->Objects) and double check what fields you are actually using on those picklists.
Good Luck!
Anwar Husain 25Anwar Husain 25
Thanks Marcelo. I looked at the schema and couldnt tell as it just shows as an address field. I am trying to resolve through VF page, I will keep you posted.