You need to sign in to do that
Don't have an account?
Tom Farrington
OR Validation to force pick list but avoid Email to salesforce fail
Hi All,
Wouldn't consider myself a developer but this seemingly simple bit of code I can't get working.
What i'm trying to do: I want to enforce picklist values for the task 'subject' field. That I can do. However, that also stops email to salesforce working as that inputs in the subject.... "Email: [subject line from email]". This doesn't work if my validation rule to enforce picklist is active.
Therefore I thought simple OR rule to say picklist or begins with 'Email: ' so it would still work but also enforce the rule. Heres what I've tried with no success:
Or(
Begins(Subject,”Email: “),
and(
Subject <> 'Email',
Subject <> 'Call',
Subject <> 'Letter',
Subject <> 'Fax',
Subject <> 'Other',
Subject <> 'In Person',
)
)
Any help would be appreciated.
Thanks
Wouldn't consider myself a developer but this seemingly simple bit of code I can't get working.
What i'm trying to do: I want to enforce picklist values for the task 'subject' field. That I can do. However, that also stops email to salesforce working as that inputs in the subject.... "Email: [subject line from email]". This doesn't work if my validation rule to enforce picklist is active.
Therefore I thought simple OR rule to say picklist or begins with 'Email: ' so it would still work but also enforce the rule. Heres what I've tried with no success:
Or(
Begins(Subject,”Email: “),
and(
Subject <> 'Email',
Subject <> 'Call',
Subject <> 'Letter',
Subject <> 'Fax',
Subject <> 'Other',
Subject <> 'In Person',
)
)
Any help would be appreciated.
Thanks
Sorry for late reply, I think i have faced some similar scenario. Can you have a look at the ISNEW() function in the validation rule formulas. using this we can check if the record is getting created or updated.
I am assuming here that while conversion the status value would not be completed. You can add NOT(ISNEW()) in your validation rule
AND((NOT(ISNEW()),Status,"Completed"),(ISBLANK(outcome__c))
this should help you to solve it.
Regards
RD
All Answers
By enforcing means you want the picklist to hold only these value right?
in this case you can delete the unwanted values from the task picklist definition itself
Does this solve your problem?
Regards,
RD
My problem with this code has actually changed slightly (sorry), as now we are happy users entering free text into the subject box, (which also solves my email to salesforce problem), but want to force them to enter a text field 'outcome' before being able to save it as completed.
That seems simple enough, validation something like this:
and(
(Status,"Completed"),
(isblank(outcome__c)
)
I've got that working no problem but this creates a new issue. Now, whenever a user converts a lead, or complets any action where there is an empty task section at the bottom, the validation kicks in and stops them converting the lead.
I therefore tried the following which I couldn't get working:
if(
and(
(isblank(Subject)),
(isblank(ActivityDate)),
),
Null,
and(
(Status,"Completed"),
(isblank(outcome__c)
)
)
So above basically says if the subject and activity date are blank, do nothing (i.e. false don't trigger rule), if not, and the status is marked as completed, and the outcome field is blank then show validation.
If the task is empty I don't want to validate anything, but if it is actually a task, and is actually completed, I want to force entry in the outcome field.
Hope that all makes sense. I'm now trying to sort out a roll up field work around, salesforce joys!
Thank you in advance for any help you can offer,
Tom
Sorry for late reply, I think i have faced some similar scenario. Can you have a look at the ISNEW() function in the validation rule formulas. using this we can check if the record is getting created or updated.
I am assuming here that while conversion the status value would not be completed. You can add NOT(ISNEW()) in your validation rule
AND((NOT(ISNEW()),Status,"Completed"),(ISBLANK(outcome__c))
this should help you to solve it.
Regards
RD