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
Sourav PSourav P 

Issue in Creating a process builder as per a Task Due Date

Dear All, Need your help urgently.  i tried several methods but failed.
I have to create two fields under the object " Lead". ( for insurance industry)
1.Renewal month (January, February… December etc)
2. To call at renewal (yes, no, blank)

In term of workflow, if 2 above is Yes to create a task “renewal follow-up” with a due date which falls on the 1st day of the month before expiry i.e. if the renewal month is December, the task due date should be 1st November . The year should be dependent on current month, if current month is > than expiry month, to set the year as current year + 1. So, if Renewal month is say, January, and now its September, then the due date year should be 2017- January.

Now I created two fields , both as picklist " Renewal month " i created as picklist with the month values ( but seems it shouldnt be picklist , as further in my rules its not taking as months ).
Then I created a process builder, criteria as if " to call at renewal = Yes", then
the below formula field on ths process builder,
User-added image


But then as , its a picklist field its showing the error,
User-added image

If i tryto create this field as Date then i am getting all date/month/year, whereas i need only the month to get choose by the users. Can you plz suggest how to goahead with this, as i need to urgently implement this. Thanks
 
sfdcjoeysfdcjoey
Picklist fields can only be used in these functions:
ISPICKVAL—Compares the value of a picklist to a single value.
CASE—Compares the value of a picklist to multiple values.
TEXT—Converts a picklist value into a text value so that you can work with the value in functions that support text value, such as CONTAINS. (Available in only flow formula resources, formula fields, validation rules, and workflow field updates.)
 
Sourav PSourav P
Hi
I tried to change the formula as below,

IF(CASE(
   TEXT([Lead].Renewal_Month__c ),
   "January",1,
   "February",2,
   "March",3,
   "April",4,
   "May",5,
   "June", 6,
   "July", 7,
   "August", 8,
   "September",9,
   "October", 10,
   "November",  11,
   12
)   < MONTH(TODAY()),YEAR(TODAY()+1) ,  MONTH(TODAY()-1,1))

But its showing the error as ,
The formula expression is invalid: Incorrect number of parameters for function 'MONTH()'. Expected 1, received 2
How to solve this ? Thanks
Amit Chaudhary 8Amit Chaudhary 8
Please below formula
IF(
		CASE(
	   TEXT([Lead].Renewal_Month__c ),
	   "January",1,
	   "February",2,
	   "March",3,
	   "April",4,
	   "May",5,
	   "June", 6,
	   "July", 7,
	   "August", 8,
	   "September",9,
	   "October", 10,
	   "November",  11,
	   12
		)   < MONTH(TODAY()), 
	YEAR(TODAY()+1) ,  
	MONTH(TODAY()-1) 
  )
Let us know if this will help you
 
Sourav PSourav P
Hi Amit, Thanks
But its showing the error as, Result is a number and field is Date ( Thats bcos the field to update is " Due Date" in the Lead field.
As YEAR(TODAY()+1) , 
   MONTH(TODAY()-1)
are giving the result as number,
So i just tried to modify your code a bit ( but its not proper), now its saving correctly but its not triggering any Task.

IF(
  CASE(
    TEXT([Lead].Renewal_Month__c ),
    "January",1,
    "February",2,
    "March",3,
    "April",4,
    "May",5,
    "June", 6,
    "July", 7,
    "August", 8,
    "September",9,
    "October", 10,
    "November",  11,
    12
  )   < MONTH(TODAY()),
 DATE(YEAR(TODAY()+1), MONTH (TODAY()), DAY(TODAY())) , 
 DATE(YEAR(TODAY()),MONTH(TODAY()-1),1)
  )

But, here as highlighted above , The month should be whatever choosen by the customer , and not Today's month, so how to fix it ?
aand aalso, how to make it trigger a task. The criteria i put is, when the field " to be called " is YES and Immdiate action is " create record" with object choosen as Task. Thanks