8

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

4 Answers 4

8

**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.

2
  • But this is not a text field. It is a picklist field. It does not show formula editor.
    – Ashok
    Commented Aug 20, 2012 at 17:24
  • If it is a picklist field then unfortunately you cant do what you need with a workflow, you will need to use an Apex Trigger
    – Jon Hazan
    Commented Aug 20, 2012 at 17:26
7

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?

2
  • 1
    It is a different scenario. Picklist to Picklist. It seems that formula option is not available in this scenario. I need to go to Apex triggers.
    – Ashok
    Commented Aug 20, 2012 at 17:43
  • That's right, Picklist to Picklist requires apex Commented Aug 20, 2012 at 17:50
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.

1
  • But this is not a text field. It is a picklist field. It does not show formula editor.
    – Ashok
    Commented Aug 20, 2012 at 17:23
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .