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
Nishant Dubey 7Nishant Dubey 7 

How can assign value to text field

Suppose two custom field Country(PickList) and State(Text). If in Picklist select U.S.A then state(text) field automatically assign value with "New York". But selecting any other country than U.S.A it should be blank
ssssssssssssss
Hi,


You will need to build custom code for this. There would be a select list, and on change of it, you would populate the value in the text box.

~S
Ganesh Hegde 9Ganesh Hegde 9
Hi,

Write a logic in your controller and assign value to State(text), display the same field in your page.

 
ssssssssssssss
Hi,


I believe setting the value through javascript would be much quicker and lighter than setting it in the controller.

~S
Chandra Sekhar CH N VChandra Sekhar CH N V
Create a simple workflow with entry criteria as  "Country(picklist)" <> null, and add an field update, populating value with below formula - IF( 
ISPICKVAL(BillingCountryCode, 'US') 
, 'New York', '')