Find your content:

Search form

You are here

Workflow > Field update action > update field value with another field value?

 
Share

I would like to update a picklist field value with another picklist field value in the workflow action 'Fieldupdate'. Is it possible?


Attribution to: Ashok

Possible Suggestion/Solution #1

Yes, it is. When you are creating the Field Update, select "Use a formula to set the new value." You can then choose any value to assign to your field.


Attribution to: Mike Chale

Possible Suggestion/Solution #2

**The Question has been refined and the original is no longer a correct solution.

The original answer is for setting the value of a Text Field.

Setting the value of a Picklist via an Apex Trigger:

Unfortunately it is not possible to set the value of a Picklist using a Field Update. Instead you can use an Apex Trigger. This guide from Salesforce should start you sown the right path: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_trigger.htm

This is a quick example:

Field1__c - This is used to represent any criteria you might use to set when the field update should happen

Field2__c - This is your picklist

Field3__c - This is the field that contains the value you want to use to set the picklist value

trigger MyTrigger on Case (before insert, before update) {
        for(Case cs : Trigger.new){

            if(cs.Field1__c == true){ //Put your criteria here to set when this happens
                cs.Field2__c = cs.Field3__c;
            }

        }
}

(Original Answer) Setting the value of a Text Field:

It is possible to set the Field to the value of another Field in the Record by using the Formula Editor.

In the 'Specify New Field Value' section when adding a new Field Update you can select 'Use a formula to set the new value'

This will show a text box beneath that you can enter a formula in such as: TODAY() + 3 or {!Case.Id}

If you need help you can click on 'Show Formula Editor'. Above the large text box is an 'Insert Field' button. This will allow you to select the field that you wish to take the value from.


Attribution to: Jon Hazan

Possible Suggestion/Solution #3

It depends on which way you're going...

From Picklist to Text --- Yes (formula text(PicklistField__c) ) From Text to Picklist --- No From Picklist to Picklist -- No

Whenever the field being updated is a picklist you can only select a specific value in that picklist, or a relative value (Above or below current selection).

To go from Text -> Picklist or Picklist -> Picklist you need to use a trigger.

What are you trying to do? What's your use case for having two fields on the same record with the same value? Instead of using a field update can you use a formula field that displays the value of the picklist?


Attribution to: Salesforce Wizard

Possible Suggestion/Solution #4

Not sure what your requirements are, but could this be done using field dependencies instead of workflow rules? Set up your 'parent' picklist to only allow a certain 'child' picklist value to be selected. Might not work if you arent using standard page layouts or dont have both fields visible on the same page layout, but worth a shot otherwise.


Attribution to: James Loghry
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/669

My Block Status

My Block Content