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
GeriGeri 

Custom Object Formula field

Hi All

 

Wonder if anyone can help

 

I have several custom objects and record types.

 

One record type is a Field Survey.  I want to build a formula that stats if the custom object record type is field survey and that the action field is updated to "complete" that three other custom fields are required.  But I am lost, new to Salesforce so any help greatly appreciated

 

AND (
  OR (
     ISPICKVAL($ObjectType.Work_Order__c.Fields.RecordTypeId , "Field_Survey"),
     ISPICKVAL( Action__c , "Complete"),
     ISBLANK( Cabling_Cost__c )))

 

The error message "Error: Incorrect parameter for function ISPICKVAL(). Expected Picklist, received Object"

 

Thanks for the help

Geri

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

Okay, you're missing the OR function from my Formula, either of these should work for you 

 

Cheers!

 

 

AND(
ISPICKVAL( Action__c , "Complete"),
$RecordType.Name = "Field Survey",
OR( 
ISBLANK( Cabling_Cost__c ),
ISBLANK( Civils_Costs__c ),
ISBLANK( Splicing_Cost__c ))) 

 

AND(
ISPICKVAL( Action__c , "Complete"),
$RecordType.Name = "Field Survey",
OR( 
ISNULL( Cabling_Cost__c ),
ISNULL( Civils_Costs__c ),
ISNULL( Splicing_Cost__c ))) 

 

 PS.  You owe me a beer!

 

 

 

 

All Answers

Steve :-/Steve :-/

First off, Record Type is not a Picklist Value.

 

What are the datatypes and values of the fields that you want to make required?

Steve :-/Steve :-/

Here's a VR Formula that I wrote that checks the Record Type and a Picklist Field.  If the Record Type = "Test 1" and Picklist_1 = Completed, then the following 3 fields are required.  If the Record Type is not "Test 1" OR Picklist_1 is not = Completed, then none of the fields is required.  

 

AND(
$RecordType.Name = "Test 1",
ISPICKVAL(Picklist_Field1__c, "Completed"),
OR( 
ISPICKVAL(Picklist_Field2__c, ""),
LEN(Text_Field__c) < 1,
ISBLANK(Amount_Field__c)))

 

 

GeriGeri

Hi Stevemo

 

thanks so much for your reply,, honestly formulas in Salesforce confuse me.

 

I have used the following formula, which works in part

 

AND(
$RecordType.Name = "Field Survey",
ISPICKVAL( Action__c , "Complete"),
ISBLANK( Cabling_Cost__c ),
ISBLANK( Civils_Costs__c ),
ISBLANK( Splicing_Cost__c ))

 

If I select complete and enter no values, it gives me the error, however once I fill in a value in the civils cost field, it will allow me to save the record.  However I want it to only allow me to save once all fields have a value even if that value is zero for the three.  I'm guessing the "LEN" part of your formula is what I need to use, but I dont understand it, so if you could help, I'd be very grateful, thanks

Geri

Steve :-/Steve :-/

Hi Geri,

 

What is the Datatype of each of the fields in your VR Formula?

GeriGeri

Hi Stevemo

 

The three fields are currency fields

 

Thanks

Geri

Steve :-/Steve :-/

Do they need to be > $0.00 or do they just have to not be empty?

GeriGeri

just not empty.

 

Each are formatted to 2 decimal places, but if I enter "0" then it saves it as €0.00

Steve :-/Steve :-/

Okay, you're missing the OR function from my Formula, either of these should work for you 

 

Cheers!

 

 

AND(
ISPICKVAL( Action__c , "Complete"),
$RecordType.Name = "Field Survey",
OR( 
ISBLANK( Cabling_Cost__c ),
ISBLANK( Civils_Costs__c ),
ISBLANK( Splicing_Cost__c ))) 

 

AND(
ISPICKVAL( Action__c , "Complete"),
$RecordType.Name = "Field Survey",
OR( 
ISNULL( Cabling_Cost__c ),
ISNULL( Civils_Costs__c ),
ISNULL( Splicing_Cost__c ))) 

 

 PS.  You owe me a beer!

 

 

 

 

This was selected as the best answer
GeriGeri

Stevemo

 

Thank you so much, works perfectly....

I'd buy you a bar full of beers,,,, never mind a beer

 

Thanks again

Geri

Steve :-/Steve :-/

Fair enough, I like to drink these>

http://beeradvocate.com/beer/profile/863/7971/

 

 

Cheers!