You need to sign in to do that
Don't have an account?
Event VR: Require Related To unless user has certain profile and record type
I posted about a basic version of this rule about a month ago and it was solved. (Thanks again Stevemo)
Now I need to build some exceptions into this rule.
Specifically the goal of this rule is
"The Related To (WhatId) field of an Event is required if the Name (WhoId) is not a Lead, UNLESS the Name (WhoId) is blank AND the User's profile is one of those listed AND the Event Record Type equals the one below.
AND(NOT(LEFT(WhoId,3) = "00Q" || WhoId = "" && $Profile.Id <> "00e80000000wY2R" && $Profile.Id <> "00e80000001K2s9" && $Profile.Id <> "00e80000000xKQi" && $Profile.Id <> "00e80000000xJTh" && $RecordType.Id <> "012Q000000009ZN" ), LEN(WhatId) < 1)
What do I have wrong??
Thanks!
Okay, I think I've got it
AND(NOT(LEFT(WhoId,3) = "00Q"),
NOT($Profile.Name = "System Administrator"),
NOT($Profile.Name = "Standard User"),
NOT($Profile.Name = "Solution Manager"),
NOT($Profile.Name = "Marketing User"),
NOT($RecordType.Name = "Test Task" ),
OR(LEN(WhoId) < 1,
LEN(WhatId) < 1))
All Answers
Here you go
AND(NOT(LEFT(WhoId,3) = "00Q"),
LEN(WhatId) < 1,
LEN(WhoId) < 1,
NOT($Profile.Name = "ExemptProfile_1"),
NOT($Profile.Name = "ExemptProfile_2"),
NOT($Profile.Name = "ExemptProfile_3"),
NOT($Profile.Name = "ExemptProfile_4"),
NOT($RecordType.Name = "ExemptRecordType_1" ))
oh yeah, you owe me one of these...
http://www.russianriverbrewing.com/web/brews/plinytheelder.htm
actually, make it TWO!!!
Thanks again!
Unfortunately neither you nor I can get Pliny the Elder. Now if you can find a beer you like that Ohio can get that MA cannot, let me know and I might be inclined to ship one or two out. At the company's expense of course haha. We basically just have Christian Moerlein, Great Lakes, Hoppin Frog, Fat Heads, BarrelHouse Brewing, Mt. Carmel Brewery, etc. Christian Moerlein, BarrelHouse, and Mt. Carmel Brewing are all local...
If they brew an Imperial or Double I.P.A. I'm in!!!
Cheers!
Uhhh Ohhh, no beers yet....
So I put this rule in place, logged in as a user who has one of the exempt profiles, and was able to log an event using a different record type than the exempt one, and it allowed me to do so without anything in the WhoID or WhatID fields. I need the rule to work for those users with those four profiles if they use a different record type from the exempt one.
Basically, The users in those profiles will have two Event Record Types to choose from. When they use the one built into the rule, I want it to be OK for them to Save the Event without any WhoId or WhatId. If they use the other record type, not mentioned in the rule, I still want the rule to mandate that if there is a Contact in WhoId, then WhatId cannot be blank.
Thanks again.
Okay, try this one (you'll have to change the Profile and RecType references to match your SFDC.Org)
AND(NOT(LEFT(WhoId,3) = "00Q"),
LEN(WhoId) > 1,
NOT($Profile.Name = "System Administrator"),
NOT($Profile.Name = "Standard User"),
NOT($Profile.Name = "Solution Manager"),
NOT($Profile.Name = "Marketing User"),
NOT($RecordType.Name = "Test Task" ),
LEN(WhatId) < 1)
To your point about the profiles, can I just use the rule above and remove the four profiles since they will be the only ones to see that record type anyways?
That way the rule will just work to enforce unless the record type is that specific one?
I put in the rule exactly as you have it in the most recent code box and replaced the generics with our specifc profiles and record type. Logged in as a user with one of the profiles, logging an event with the record type not excluded, I was able to still save without the required Name and Related To field.
I apologize, I just wish I understood this stuff better.
no problem, we're really close, just have to get the Include and Omit stuff sorted.
My VR is coded to say IF the activity is NOT related to a Lead (WhoId) and it IS related to a Contact (WhoId),
and the User is NOT exempted by Profile ($Profile.Name),
and the activity is NOT exempted by Record Type($RecordType.Name),
then the Activity MUST be related to another type of record (WhatId)
is that what you're after?
To add to it,
The rule works correctly if there is a Contact in the WhoId field. In this case, if I log an Event with the excluded record type, I can save it successfully either with or without anything in the WhoId.
The issue is if I log an event with the other record type that should get flagged, I can save it successfully without the WhoId and WhatId. If I attempt to save it with only the WhoId being a Contact, it throws the error. I need it to throw the error when this record type is used and both are blank.
Okay, I think I've got it
AND(NOT(LEFT(WhoId,3) = "00Q"),
NOT($Profile.Name = "System Administrator"),
NOT($Profile.Name = "Standard User"),
NOT($Profile.Name = "Solution Manager"),
NOT($Profile.Name = "Marketing User"),
NOT($RecordType.Name = "Test Task" ),
OR(LEN(WhoId) < 1,
LEN(WhatId) < 1))
Got it!
That deserves a beer for sure!