I have a custom field called Email_address and I want to set-up a validation that sends an error message if the email isn't a gmail address. How would I set this up?
Also, is there a way to send an error message if the email address isn't unique?
Thanks so much!
I don't know what you mean by 'send an error.'
If you want to prevent incorrect entry, use a validation rule. I'd generally use a regular expression to evaluate something like an email address, but if you're uncomfortable with them you can also use something like RIGHT(my_field__c, 9) <> "gmail.com". If, for some reason, you want to be notified of incorrect email addresses but still allow them to be entered, you can use a workflow that behaves mostly the same way.
Preventing duplicate email addresses is a bit more difficult unless you want to venture into trigger-land, which is massive overkill for something like this IMHO. You can make the field a unique ID in the custom field creation wizard (although I believe you only get a finite number of these), but other than that I don't know of a way that doesn't involve a trigger and a SOQL query.
Related
I have this situation: I have a filling form, there I enter the details of sealing the object, I want to add an interesting function to the form, I want to send an e-mail in order to support the sealing permissions.
For example, I want to seal the doors, in the form I enter the email and press the send button, I receive a normer, which I must enter in the next field in the form, if the number is correct, I see the "create" button, if not, then the "Create" button does not visible
Has anyone already encountered this?
To show (or not) certain items or buttons you can use
conditions
dynamic actions (Show)
In your case, dynamic action might be a better choice.
The part which is related to "if the number is correct" is handled by validation.
If you want to send an email, simplest way is to use APEX_MAIL. https://docs.oracle.com/en/database/oracle/application-express/19.1/aeapi/APEX_MAIL.html#GUID-14F51C6D-CB82-4B38-AB6E-61C46E75596F
For some other options, have a look here: https://jeffkemponoracle.com/2016/04/email-made-easier/
If you want to send an SMS, there is no built-in support for this. You would need to send requests via an SMS gateway. By way of example, an API for integrating with one gateway (ClickSend) which might help you is: https://jeffkemponoracle.com/2016/08/send-sms-mms-and-voice-messages-from-oracle-plsql/
We've got a few emails that get sent out by our ASP.NET MVC 3 application.
In one of the emails, we want to add "Did you find this helpful?" to the footer of the email.
If they click "Yes", some action needs to be taken in the database.
What approach should i take for these links?
I don't really like the idea of doing a GET (e.g when they click the link), which then adds something to the database. GET's should never update state. Is there a way i can make it do a POST instead?
I'm using ActionMailer to perform emails, if that matters.
EDIT:
To be clear, i'm how asking "how" to implement the MVC side of things. I know i can create an action which takes the id, etc and saves to the DB, but i'm asking about what is the correct approach from a REST-style point of view.
You can create a form and do a POST in an email but it wont work with certain mail clients. Here is a reference from 2007 that shows where it works and where it doesn't:
http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/
ETA: A POST would of course fit the REST pattern but probably not a good option in your case. Since you are presumably just incrementing a counter for helpfulness, having this URL exposed shouldn't cause much of a problem.
Okey, this might seem a bit strange question so I will explain.
Do I really need to create a postback that explains what is wrong with form if it's not validated if I also use JS for it?
I am of course validating user input and I use somewhat "general" approach. For instance if something is not validated it will just show "Some error occurred, check your input bla bla..". I am not creating postback for every input so that it will shot "Your username is suppose to be at least 3 characters long etc.." and I don't do this because JS is doing that on the fly.
My server-side validation only is like a guard against stupid/wrong entries where name is empty or something along that, rest is up to jQuery. Form will always be valid if client is running JS. I am doing it to save my time.
My question is - is it a bad idea? I just don't see why because everyone is running JS anyway and my server is not allowing bad/invalid entries to be put in DB even with JS off.
I don't think that's a bad idea, data validation can be client side. If something goes wrong, i just throw a generic error.
I only validate server side the business rules
I am trying to create a Model of a pretty special kind.
I just call it Emails. Containing fields like:
address
send_count
blocked
It is a registry of email addresses. Every record in other models that contain an email address should have a reference to a record in this model. That way I can block/ban and email address globally in my app and flag it in other ways.
If it was not generally frowned upon, I'd say the address should work much like the primary key. I can only be set on create and then never updated and it must be unique.
My problems implementing this (with a normal primary key) is how to handle cased where Emails is updated/created as an associated model via nested attributes. This is the most common situation since the email addressed look just like any other field to the users of the application.
They might be editing their account form and happen to change their email address. Phone should notice this and "find_or_create" an instance of itself instead of updating the address. Updating the blocked property on the other hand should be allowed.
Am I getting the gist of it across? Can anyone give me some advice on how to make the Model behave like this?
I have tried some variations of using validations and callbacks but I can seem to "replace self" with another existing record. Just setting all attributes (incl. id) to those of the existing record does not really make things work fully.
Any ideas would be helpful.
I was wondering if anyone knew whether there is a unique identifier attached to an email that I can use to verify whether emails are the same? I know about the EntryID and PR_SEARCH_KEY, but i need something abit more specific if it exists.
Supposed I forward an email to 3 people. I want to make sure that at most 1 copy of those forwarded emails is added to a database. Is there an identifier that will be shared between those three emails that i can record and use to disallow entry of the other two? Or will I have to add a manual tag somewhere on the email?
thanks
The obvious answer is the Message-ID, which all good emailers use. However, not everyone in the world uses it.