You need to sign in to do that
Don't have an account?
Custom Button/Link Related Question
Hello. I am new to SF development and currently at a standstill in attempting to validate an e-mail address.
I have an object called Users which has accepts a name and e-mail address (both text on a standard SF page). I have also created a custom link called "validate e-mail". I plan to call a webservice passing the user-entered e-mail address when the custom link is clicked.I have imported my WSDL into an APEX class and everything works (I tested also)
Currently, I am not able to figure out how to display the user-entered value when the link is clicked.
Upon clicking on my link, I just want to display the user entered value in an alert statement but I have been unsuccessful. If this works I would like to call my webservice class and validate the e-mail address upon clicking on my custom link
.
I have been reading the forums and cookbook, but still not able to figure it out. Any help is appreciated...Thanks.
Use standardcontroller = "Users__c" and get the id from :
Id uid = Apexpages.currentPage().getParameters().get('id');
after that use SOQL Query to get email address and name :
Users__c usr=[select id, name,email from Users__C where id =:uid];
Hope this helps.
Thank you for your reply. I am still struggling to get the user-entered value. Essentially this is what I am trying to do:
In short, my goal is to validate an e-mail id that the user enters via a webservice (I just want to try it for the sake of trying and learning APEX and cloud computing). Perhaps In hindsight, I should have picked something simper to begin with…
I get the following error:
"Apex trigger webserviceTrigger caused an unexpected exception, contact your administrator: webserviceTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.webserviceTrigger: line 10, column 15"
After some research, I noticed that webservice callouts are not allowed via triggers. I tried some alternate approaches:
Option 1 - Let the javascript on the standard SF page call the class which calls the webservice to validate the e-mail ID before saving the record
--------------------------------------------------------------------------------------------------------------------------------------------------
I created a custom link which upon clicking validates my e-mail ID but I am still not able to get the user-entered value from the web page to the javascript. I can't figure out the name or id of the e-mail textbox from the webpage. The API name for the custom e-mail field is e_mail__c, but when I try this it's not working. How can I get the ID of the field?
Option 2 - Creating a new Visual Force Page
--------------------------------------------------------------------------------------------------------------------------------------------------
Some community folks have also suggested the use of a Custom VisualForce page that is pretty much like a form. When submitting the form, call javascript which calls the class containing web service calls....again I'm running into the same issues.
My Form:
My Class :
What is the best way to achieve my goal? How should my Javascript be? I just need to get an idea....
Thanks.