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
Carrlos BoydCarrlos Boyd 

Formula in Process Builder

In Process Builder, I am trying to write a formula to update a picklist field when creating a child record based off of a picklist field in the parent record (they share the same global picklist values). Here's what I'm trying to accomplish:  If the Type field on the parent record is blank, I want the "Type" field on the child record to equal "New". But if there is a value in the Type field of the parent record, I want the child record to have the same value. I am trying to avoid duplicating all the decision diamonds in the flow definition.

Here is what I am using but keep getting an error:
IF(ISPICKVAL([ParentObject__c].Type__c, ""), ISPICKVAL([ParentObject__c].Type__c, "NEW"), ISPICKVAL([ParentObject__c].Type__c) )
Error message:
The formula expression is invalid: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 1
Best Answer chosen by Carrlos Boyd
Carrlos BoydCarrlos Boyd
Solution:
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value1' ), 'Value1',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value2' ), 'Value2',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value3' ), 'Value3',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value4' ), 'Value4',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value5' ), 'Value5',
NULL)))))

 

All Answers

Carrlos BoydCarrlos Boyd
I get this error message now:
The formula expression is invalid: Field ParentObject is a picklist field. Picklist fields are only supported in certain functions.
Carrlos BoydCarrlos Boyd
Solution:
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value1' ), 'Value1',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value2' ), 'Value2',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value3' ), 'Value3',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value4' ), 'Value4',
IF( ISPICKVAL([ParentObject__c].Type__c, 'Value5' ), 'Value5',
NULL)))))

 
This was selected as the best answer