Posts

Showing posts from December, 2013

Check Duplicate EmailId when user Insert the Contact

Check Duplicate EmailId when user Insert the Contact trigger OnContactChekDuplicateEmail on Contact (before insert) { Set<String> emails = new Set<String>(); List<Contact>lstCon = new List<Contact>(); set<String> setEmail = new set<String>(); for(Contact Con:trigger.new){ emails.add(con.Email); } lstCon=[Select name,id, email from Contact where Email in:emails]; for(Contact con :lstCon){  setEmail.add(con.email); } for(Contact c :trigger.new){  if(setEmail.contains(c.email)){   c.adderror('Email duplicate'); }    } }

Show Custom And Standard Object

Image
ShowCustomAndStandardObject Requirement:   Create two custom pick list field . first picklist contains the the three values" All, Custom, Standard" when user select "All" then in the second picklist show all custom and standard object, and when user select "custom" the custom object filter and same for  "standard". And After that click on "show filed" button  then all field of selected object appear in table. and User can select the fields and click on "query button" the generate query in string form. <!--ShowCustomAndStandardObject--> Create Visualforce page <apex:page controller="clsCustStandObj"> <meta name="google-translate-customization" content="afb3859aeab26f11-8390680e6d2f19bf-g71f10bf08db6379c-15"></meta> <div id="google_translate_element"></div><script type="text/javascript"> function googleTranslateElementInit()

Send Email using Wrapper Classes in Salesforce.

Image
Send Email using Wrapper Classes in  Salesforce. Requirement :  Create a table in which there are list of contact name , email . when user select check box against any row of contact list and after that click on button then send the email to  that particular email id  <!--WrapperDemoTestOnContact-->  Create Visual force page <apex:page standardController="Contact" extensions="WrapperClsOnContact">     <apex:form >     <apex:pageMessages >     </apex:pageMessages>         <apex:pageBlock >             <apex:pageBlockTable value="{!wrapperObj}" var="x">                 <apex:column value="{!x.conobj.name}"/>                 <apex:column value="{!x.conobj.email}"/>                 <apex:column >                   <apex:inputcheckbox value="{!x.checkBox }"/>                 </apex:column>             </apex:pageBlockTable>