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
ArEvansArEvans 

How to default "State" on Prospect record with State from the User object

When creating a new Prospect record I cannot use a Workflow rule to default a State picklist field to the State from the User object, so I need to create a vsiualforce page or apex trigger to accomplish this. 

 

I'm new to this area, and appreciate any advice on how to do this!  Thank you!

 

Best regards,

Ar

AmitSahuAmitSahu

You can check the picklist default value for this.

 

You can open the picklist field and select the default value for that field, which will be automatically set by default.

ArEvansArEvans

Thank you for your response.

 

The State needs to default to a different state depending on the User logged in.  It is not just one default for all Users. So I think the default needs to happen likely in a Trigger or Visual force page. Additional thoughts on whether this sounds right, and how to accomplish this would be greatly appreciated!

MarinaMartinMarinaMartin

You can use the user's state variable in the URL to autofill that field, e.g. 

 

https://na12.salesforce.com/00Q/e?lea16state={!User.State}

 

You can either make a link to this and instruct users to create new prospects using that link, or create a Visualforce page override that just redirects to this URL.