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
MichaelABMichaelAB 

Trying to kick off 'true' if a field contains ....

I have this rule:

 

AND (OR ($RecordType.Name = "GTB Merchant"),
 CONTAINS( "pa", Rep_or_ISO_number_login__c )
)

 

It's not working. I mean it works but it kicks off no matter if there is a 'pa' entered in the Rep_or_ISO_number_login__c field or not. I want it to kick off if there is NO 'pa' entered.

 

 

What is wrong with this formula?

 

thanks 

 

Michael

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

I've GOT IT!!!  you have to change it to:

 

 

AND( $RecordType.Name = "GTB Merchant", BEGINS( Signing_ISO__r.Rep_or_ISO_number_login__c, "pa")

 When you're referencing a Lookup Field in a Formula it ends in double underscore lowercase "r" __r instead of double underscore lowercase "c" __c

 

 

All Answers

Steve :-/Steve :-/

Try something like 

 

 

AND($RecordType.Name = "GTB Merchant", NOT(CONTAINS(Rep_or_ISO_number_login__c, "pa"))

 

 

 

 

 

MichaelABMichaelAB

Nope. Sorry, that didn't work. It did nothing whether the Rep_or_ISO_number_login__c

field had a 'pa' in it or not. 

Steve :-/Steve :-/

Are you trying to create a Field Validation formula or a Workflow Rule?

 

My formula is written to evaluate the Record Type and  ISO Number and return a TRUE if:

 

The RecordType = GTB Merchant

AND

The ISO Number DOES NOT contain "pa"

 

Are you looking for a different result? 

 

 

MichaelABMichaelAB

It is a Validation Rule. Here is how it's entered in the rule:

 

 

AND($RecordType.Name = "GTB Merchant", NOT(CONTAINS( Rep_or_ISO_number_login__c , "pa")))

 

 

 

 

GTB merchant recordtypes cannot have an ISO ID (in the field, Rep_or_ISO_number_login__c) beginning with 'pa'

 However, when a GTB Merchant recordtype accepts a Rep_or_ISO_number_login__c field

with 'pa' in it or not, it doesn't do anything. ???

Maybe something to note is that the Rep_or_ISO_number_login__c field is in a different recordtype

but I wouldn't think that matters. They are both in the account object. Just under different recordtypes.

 

Michael

Steve :-/Steve :-/

Is this one field called "Rep_or_ISO_number_login__c"?

Or are there two separate fields "Rep_number_login__c" and "ISO_number_login__c"?

 

Is the field required?  If the field is required then this formula should work.   

AND( $RecordType.Name = "GTB Merchant", NOT(BEGINS( Rep_or_ISO_number_login__c , "pa")))

 otherwise you will need to amend the formula to also evaluate if the field begins with the Text "pa" or is blank.  

Also, does the field need to BEGIN with the text "pa" or does it just have to CONTAIN the text "pa?"

 

 

Message Edited by Stevemo on 01-28-2010 12:30 PM
MichaelABMichaelAB

Good catch. The best would be for the rule to state that any text entered in the Rep_or_ISO_number_login__c 

field has to start with a 'pa'. - and yes, it is one field, wierdly named. The field is required and I tested it again and it doesn't work, yet.

 

Let me try to be clearer. It is kind of complicated.

 

We are dealing with two record types (rt): GTB Merchant and Payment Access Resellers.

 

For the GTB Merchant rt there is a field: Signing_ISO__c, it is a lookup field. Through it we look up and select

the appropriate Reseller however, we have two types of Resellers: GTB and Payment Access. We do NOT

want a Payment Access Reseller rt to be selected for a GTB Merchant rt.

 

Payment Access Resellers rt have a  Rep_or_ISO_number_login__c number with a 'pa' in front of the number entered.

 

So... our goal is to NOT allow a Payment Access Reseller (who has a Rep_or_ISO_number_login__c with a 'pa' in the field)

to be associated (picked from the  Signing_ISO__c Lookup field) with the GTB Merchant rt.

 

The rule needs to state that if a GTB Merchant rt selected a Payment Access Reseller rt it wouldn't allow it

because the Payment Access Reseller rt has a 'pa' in the  Rep_or_ISO_number_login__c field.

 

I hope that makes sense and maybe it will help.

 

Michael

 

 

 


 

Steve :-/Steve :-/

Sorry, I'm a little confused now...

 

Is this a Text Field that you are trying to evaluate?  or is a Lookup field that you are trying to filter which records can be selected?

MichaelABMichaelAB

It is a text field. The field we are trying to evaluate: Rep_or_ISO_number_login__c field,

is a text field and we need to evaluate if it has a 'pa' in front of it or not.

 

However, it is associated (tied) to the GTB Merchant rt by looking up the reseller through the Signing_ISO__c lookup field.

 

So, if while in a GTB Merchant rt we select a reseller that has a 'pa' in the Rep_or_ISO_number_login__c field it should kick off the error saying, 'you cannot select a Reseller that has a 'pa' in front of its Rep_or_ISO_number_login__c field number'.

 

Does that help? Sorry it's so confusing.

Steve :-/Steve :-/

Okay, let me see if I have my head around this right...

 

 

The text field that you want to evaluate is NOT on the Account record that you are initiating the Lookup FROM, it is on the Account record that you performing the Lookup TO?  

 

So in other words if you're in a "GTB Account" and you click the "Signing ISO" lookup field, you want to prevent them from selecting a "Reseller Account" which has the text "pa" in the Rep_or_ISO_number_login__c field.

 

Am I at least getting warmer??? 

MichaelABMichaelAB

"The text field that you want to evaluate is NOT on the Account record that you are initiating the Lookup FROM, it is on the Account record that you performing the Lookup TO? "  ---- CORRECT

 

"So in other words if you're in a "GTB Account" and you click the "Signing ISO" lookup field, you want to prevent them from selecting a "Reseller Account" which has the text "pa" in the Rep_or_ISO_number_login__c field.---EXACTLY

 

You got it!

Steve :-/Steve :-/

If I nail this f*cker you owe me a beer...

 

 

Try a formula that looks something like this:

 

 

AND($RecordType.Name = "GTB Merchant",BEGINS(Signing_ISO__c.Rep_or_ISO_number_login__c, "pa"))

 What it's basically saying is:  "If you are in a GTB Account, the Account that you select in the Signing ISO lookup field can not have the letters "pa" in the beginning of the Rep/ISO Login field.

 

Of course, if that's what you're after you could just slap a Lookup Filter on your Signing ISO lookup field too.  

 

 

MichaelABMichaelAB

Well it didn't like that:

 

Error: Field Signing_ISO__c does not exist. Check spelling.

 

However, it is there. When I select the Insert field button it shows up.

 

So... maybe we have to go the Lookup filter route. Didn't know about that option. 

Can I get to that function easily?

Steve :-/Steve :-/

Are you entering it manually?  or are you using the Insert Field button?   If you are entering the fields in the formula manually, I would try using the Field Insert button instead, just to make sure that the formula has all of the handles it needs.

 

I'm getting thirsty... 

MichaelABMichaelAB

I inserted with the button.

 

When I use this rule (and I'm just using it as an example to test that field) the syntax works:

 

AND($RecordType.Name = "GTB Merchant",
BEGINS( Signing_ISO__c, "pa"))

 

So, it's not the field name. It must be the  Signing_ISO__c.Rep_or_ISO_number_login__c 

where you have the two fields tied together?

 

 

Steve :-/Steve :-/

Just to rule out any mistakes, try building it entirely using the Formula Wizard buttons.

 

It should basically be something like

 

AND(

$RecordType.Name = "record_type_name",

BEGINS(name_of_lookupfield.name_of_field_you_want_to_check, "value you want to exclude" ))  

  

MichaelABMichaelAB

I did that:

 

AND( $RecordType.Name  = "GTB Merchant",
 BEGINS( Signing_ISO__c.Rep_or_ISO_number_login__c, "pa"))

 

result:

 Error: Field Signing_ISO__c does not exist. Check spelling.

 

However, as stated before, the  Signing_ISO__c  by itself, passes the syntax test.

 

Going to lunch - got a headache!!

 

Don't serve beer. How 'bout some nice hot tea!   :)

 

Steve :-/Steve :-/

Can you post a screen print?  I think you might be building your validation formula in the wrong place.  It should look something like this:

 

http://www.screencast.com/users/SteveMo/folders/Default/media/3788416a-3258-48c6-91ab-0f3e94a983de 

 

replace Lookup Account> with Signing_ISO

and replace PR Code with Rep_or_ISO_number_login

so instead of Lookup_Account__r.PR_Code__c it should be something like Signing_ISO__r.Rep_or_ISO_number_login   

 

Message Edited by Stevemo on 01-28-2010 04:39 PM
Steve :-/Steve :-/

I've GOT IT!!!  you have to change it to:

 

 

AND( $RecordType.Name = "GTB Merchant", BEGINS( Signing_ISO__r.Rep_or_ISO_number_login__c, "pa")

 When you're referencing a Lookup Field in a Formula it ends in double underscore lowercase "r" __r instead of double underscore lowercase "c" __c

 

 

This was selected as the best answer
MichaelABMichaelAB

VICTORY!!!

 

It worked!!!

 

Congratulations!

 

How did you find that out?

 

 

Now for that beer: 

Steve :-/Steve :-/

 

 

Not to be picky, but actually I'd prefer one of these  http://russianriverbrewing.com/web/brews/plinytheelder.htm

 

It's just one of those little things you learn after doing this for a while.  That's why whenever possible I use the Formula Wizard, and the Insert Field, and Insert Function buttons.

 

Now if you'll excuse me I must be going... http://www.youtube.com/watch?v=VtVFcJiqHSQ