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
netTrekker_ADnetTrekker_AD 

Task VR: If Task Type is one of three, then WhoId is required

 I am attempting to create a Task Validation Rule where if the Task Type picklist field contains one of three task types, then the WhoId field cannot be left blank.

 

This is what I have so far, but I keep getting the syntax error: Error: Syntax error. Found 'Task'

 

ISPICKVAL( Task Type, "Implementation Call"
|| Task Type, "PR 1 Call"
|| Task Type, "Renewal Call")
&& WhoId=""

 

The text name of the field is "Task Type" - is there some rule in SFDC that a field name cannot contain Task? Is that my problem or is it something else?

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

Okay, then try something like this

 

***  you're gonna have to change the field names to match your SFDC.Org, custom fields always end in "__c" 

 

 And again, I would STRONGLY recommend that when you are builing a formula from scratch you should always use the [Insert Field], [Insert Function], and [Insert Operator] buttons to eliminate typos.

AND(OR(ISPICKVAL(Picklist_Field_Name, "Implementation Call"),

(ISPICKVAL(Picklist_Field_Name, "PR 1 Call"),

(ISPICKVAL(Picklist_Field_Name, "Renewal Call")),

LEN(WhoId) < 1))

 

 

 

Message Edited by Stevemo on 02-02-2010 10:26 PM
Message Edited by Stevemo on 02-02-2010 10:27 PM

All Answers

netTrekker_ADnetTrekker_AD

I am guessing Stevemo has the day off?

 

Anyone else know the missing link here?

 

Thanks in advance!

Steve :-/Steve :-/

Hi there, 

 

sorry I'm late ;-)  

 

The first thing I see is that you're referring to Task Type, there is no "Task Type" field, it's just called Type.  When you'ew builing a formula from scratch you should always use the [Insert Field], [Insert Function], and [Insert Operator] buttons to eliminate typos.

netTrekker_ADnetTrekker_AD

Hi Stevemo,

 

Thanks for the response. We actually have a custom field called "Task Type" that is different from the standard Type field. Is Salesforce not recognizing this? We also have a custom field called "Activity Type" which does not throw any errors when used in VR's.

Steve :-/Steve :-/

Okay, then try something like this

 

***  you're gonna have to change the field names to match your SFDC.Org, custom fields always end in "__c" 

 

 And again, I would STRONGLY recommend that when you are builing a formula from scratch you should always use the [Insert Field], [Insert Function], and [Insert Operator] buttons to eliminate typos.

AND(OR(ISPICKVAL(Picklist_Field_Name, "Implementation Call"),

(ISPICKVAL(Picklist_Field_Name, "PR 1 Call"),

(ISPICKVAL(Picklist_Field_Name, "Renewal Call")),

LEN(WhoId) < 1))

 

 

 

Message Edited by Stevemo on 02-02-2010 10:26 PM
Message Edited by Stevemo on 02-02-2010 10:27 PM
This was selected as the best answer
netTrekker_ADnetTrekker_AD

Thanks again Stevemo, other than missing one end parenthesis this worked perfectly. Im glad I was on the right path though, Im still just curious why the text name of the field didnt work because it contained "Task" in it, but the SFDC name for the field works fine.

 

I have no programming background so Im sure there is some logic to it I dont know, but why is LEN(WhoId) <1 better to use than just WhoId="" ? Don't they essentially both look for a blank?

 

Thanks!

Steve :-/Steve :-/

I'm gonna have to start raising my rates!  :smileywink:

 

I'm not sure what the deal is with the whole Text = "" vs. LEN < 1 thing.  On the surface you'd think that they would return the same result.  

 

Like you I'm not much of a programmer (some folks would probably say I'm not much of an Salesforce Admin either  :smileywink:)

TBoneJCSITBoneJCSI

Stevemo-

I've run into it a couple of times already, having only started with SF a bit over a month ago.  I think it's due to SF handling nulls and intentional blanks in a kinda wonky way.