NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

public class liveYourPotentialEmailer2 {

public String termsString {get;set;}

/*Variables used in rendering*/
public String paramValue {get; set;} /*Param value used for rendering forms*/
public String hideShow {get;set;} /*to render hide and show */
public Boolean hideShowResult {get;set;} /*to render hide and show */

/* Variables used for Contact Form*/
public List<selectedRecord> selectedContactValues {get;set;} /*Variable of type wrapper class to store the contacts selected*/
public Boolean addContactForm {get;set;} /* To render the contact form */
public String selectedVal {get; set;} /* To get if selected value is InMobi All or Bangalore */
public SET<SelectOption> distinctCity {get;set;}
public SET<SelectOption> distinctCountry {get;set;}
public SET<SelectOption> distinctDomain {get;set;}

public String contactCity {get;set;}
public String contactCountry {get;set;}
public String contactDomain {get;set;}
public List<ID> selectedContactIDs = new List<ID>();
public List<selectedRecord> returnContact {get;set;}

/*Variables used for Job Form*/
public String searchString {get;set;} /*For search keyword*/
public ts2__Job__c JobData {get;set;} /*To get the values selected on form*/
public Boolean addjobForm {get;set;} /*To show hide Job form */
public List<selectedJobRecord> returnJob {get;set;} /*To return all search Jobs*/
public List<selectedJobRecord> selectedJobValues {get;set;} /*To return all selected Jobs*/
private List<ID> selectedJobIDs = new List<ID>(); /*To add all selected Jobs IDs to the list - variable used for NOT IN query */

/*Variables used for Review Email form */
public Boolean reviewMailContent {get;set;} /*to render email template review page */

/*Constructor*/
public liveYourPotentialEmailer2(){

/*defining Contact variable*/
selectedContactValues = new List<selectedRecord>();
distinctCity = new Set<SelectOption>();
distinctCountry = new Set<SelectOption>();
distinctDomain = new Set<SelectOption>();
addContactForm = TRUE;
getDistinctPicklistValues();

/*defining Job variables*/
JobData = new ts2__Job__c();
returnJob = new List<selectedJobRecord>();
selectedJobValues = new List<selectedJobRecord>();
addjobForm = FALSE;
hideShowResult = TRUE;

/*defining Review email variables*/
reviewMailContent = FALSE;

/*defining email tenplate variable - same used in VF page*/
termsString = 'The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. InMobi is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.';
}

/*To get the distinct values for the picklist for contact - Domain, City, Country*/
public Set<SelectOption> getDistinctPicklistValues(){

for(Contact a : [select id,MailingCity, MailingCountry, Domain__c from Contact]){
distinctDomain.add(new SelectOption(a.Domain__c.trim(),a.Domain__c.trim()));
}
return distinctDomain;
}

public void fetchContacts(){
/*system.debug('...................................................................');
List<Contact> displayContacts = new List<Contact>();
returnContact.Clear();
String displayContactStr='';
displayContactStr = 'SELECT ID, FirstName, LastName, Email, MilingCity, MailingCountry, Domain__c from Contact WHERE Email <> NULL';
if(contactDomain != '' && contactDomain != NULL) {
displayContactStr += ' AND Domain__c = '' + contactDomain + ''';
}
if(contactCity != '' && contactCity != NULL) {
displayContactStr += ' AND MilingCity = '' + contactCity + ''';
}
if(contactCountry != '' && contactCountry != NULL) {
displayContactStr += ' AND MailingCountry = '' + contactCountry + ''';
}
if(searchString!=NULL && searchString!=''){
displayContactStr += ' AND ( MilingCity = '' + searchString + '' OR MailingCountry = '' + searchString + '' OR Domain__c = '' + searchString + '')';
}
if(contactDomain != NULL || contactCity != NULL || contactCountry != NULL || (searchString!= NULL && searchString!='')){
displayContactStr += ' and ID NOT IN : selectedContactIDs ';
displayContacts = Database.query(displayContactStr);
system.debug('....................................'+displayContactStr);
for(Contact conRecord : displayContacts){

//Create a new wrapper record and add it to list
returnContact.add(new selectedRecord(conRecord,FALSE));
}
}



*/
}

/*To hide and show the List*/
public void HideAllShowAll(){

hideShow = ApexPages.currentPage().getParameters().get('HideShow');
if(hideShow == 'HideAll'){
hideShowResult = FALSE;
}
else if(hideShow == 'ShowAll'){
hideShowResult = TRUE;
}
}

/*This function is handling the rerender between four forms - Contact from - Job Form - Review email Form - Review template form*/
public void renderForms(){
if(addContactForm){
if(selectedVal == 'bangalore'){
Contact con = new Contact();
con.Email = Label.bangaloreAllEmail;
selectedContactValues.add(new selectedRecord(con,FALSE));
}else if(selectedVal == 'all'){
Contact con = new Contact();
con.Email = Label.InMobiAll;
selectedContactValues.add(new selectedRecord(con,FALSE));
}
}
paramValue = ApexPages.currentPage().getParameters().get('renderFormValue');
if(paramValue == 'SearchJobs'){
if((selectedContactValues.size() == 0)){
/*Validation check if no Contact is added*/
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select at least one recipient for sending the mail'));
}else{
/*rendering the add jobs form*/
addContactForm = FALSE;
addjobForm = TRUE;
reviewMailContent = FALSE;
}
}
else if(paramValue == 'reviewTemplate'){
if((selectedJobValues.size() == 0) || (selectedJobValues.size() == NULL)){
/*Validation check if no Job is added before review email*/
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select at least one job before verifying the email.'));
}
else{
/*rendering the review email form*/
addContactForm = FALSE;
addjobForm = FALSE;
reviewMailContent = TRUE;
}
}
else if(paramValue == 'SearchContacts'){
/*rendering the add contact form*/
addContactForm = TRUE;
addjobForm = FALSE;
reviewMailContent = FALSE;
}
}

/*Method to query account and populate data for Job Form*/
public void fetchJobs(){

List<ts2__Job__c> displayJobs = new List<ts2__Job__c>();
returnJob.Clear();
String displayJobsStr='';
displayJobsStr = 'SELECT ID, Name, Write_Up__c, ts2__Department__c, ts2__Job_Function__c, ts2__Location__c, ts2__Recruiter__c from ts2__Job__c WHERE Name <> NULL';
if(JobData.ts2__Job_Function__c != '' && JobData.ts2__Job_Function__c != NULL) {
displayJobsStr += ' AND ts2__Job_Function__c = '' + JobData.ts2__Job_Function__c + ''';
}
if(JobData.ts2__Department__c != '' && JobData.ts2__Department__c != NULL) {
displayJobsStr += ' AND ts2__Department__c = '' + JobData.ts2__Department__c + ''';
}
if(JobData.ts2__Location__c != '' && JobData.ts2__Location__c != NULL) {
displayJobsStr += ' AND ts2__Location__c = '' + JobData.ts2__Location__c + ''';
}
if(searchString!=NULL && searchString!=''){
displayJobsStr += ' AND ( ts2__Job_Function__c = '' + searchString + '' OR ts2__Department__c = '' + searchString + '' OR ts2__Location__c = '' + searchString + '')';
}
if(JobData.ts2__Job_Function__c != NULL || JobData.ts2__Department__c != NULL || JobData.ts2__Location__c != NULL || (searchString!= NULL && searchString!='')){
displayJobsStr += ' and ID NOT IN : selectedJobIDs';
displayJobs = Database.query(displayJobsStr);

for(ts2__Job__c jobRecord : displayJobs){

/*Create a new wrapper record and add it to list*/
returnJob.add(new selectedJobRecord(jobRecord,FALSE));
}
}
}

/*method to populate selected data to the Selected Contacts Block*/
public void selectedJobs(){

/*Iterate through all jobs*/
for(selectedJobRecord record : returnJob){

if(record.isSelected){ /*Only the selected values are added to the selectedJobValues List*/
selectedJobValues.add(record);
selectedJobIDs.add(record.thisJob.ID);
}
}
if((selectedJobValues.size() == 0) || (selectedJobValues.size() == NULL)){
/*Validation check if no Job is added before Add Jobs*/
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select at least one job for sending the mail'));
}
fetchJobs();
}

/*Method to remove contacts*/
public void removeJobs(){

Integer rowToRemove = Integer.ValueOf(ApexPages.currentPage().getParameters().get('rowToRemove'));
selectedJobValues.remove(rowToRemove);
selectedJobIDs.remove(rowToRemove);
fetchJobs();
}

/*Send email function*/
public void sendMail(){

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setReplyTo(Label.replyToEmail);
mail.setSenderDisplayName('HR Recruiting');

for(selectedRecord contactVal : selectedContactValues){

mail.setToAddresses(new String[]{contactVal.thisContact.email});
mail.setSubject('Live Your Potential');

/*String str store the HTML template to be sent in email*/

//LOGO
String email_body = '<div style="background-color:#EEEEEE; width:700px; font-family: Arial; line-height: 18pt; font-size: 15px;"><img src="'+Label.Base_URL+'servlet/servlet.ImageServer?id='+Label.LogoID+'&oid='+Label.OrganizationID+'" alt="Company Logo" style="margin-left:10%; margin-top:5%;" height="35" width="180"/><br/><br/>';
//Live your potential para
email_body+='<div style="margin-left:4%; margin-right:4%; margin-bottom:10%;"><div style="background-color:white; margin-left:5%; margin-right:5%;"><br/><br/><br/><div style="margin-left:7%; margin-right:7%;"><p><b>LIVE YOUR POTENTIAL</b></p><p style="color: Gray;">In line with our articulated Talent philosophy of creating and providing opportunities to InMobians first, here are the latest opportunities that we are looking to fill this month.</p><p style="color: #427fed;"><b>IF YOU'RE INTERESTED...</b></p><p style="color: Gray;">If you're interested in any of the listed opportunities, drop an email to <span>[email protected]</span> with the subject line "Interested - Role Name", example, "Interested - Account Manager, Bangalore."</p><p style="color: Gray;">An opportunity consultant from the Talent Acquisition Team will guide you through your application process.</p><p style="color:gray;"><hr height="2px;" width="100%"/></p>';

/*Iterate through the selectedJobValues and add thier values to the HTML template */
for(selectedJobRecord addJob : selectedJobValues){
//Job Title
email_body+= '<a style="text-decoration: none;" href="'+Label.liveyourpotential+''+addjob.thisjob.ID+'"><b><p style="color: #427fed; text-align: left;">'+addjob.thisjob.Name+'</p></b></a>';
//Job description
email_body+= '<p style="color: Gray; text-align: left;">'+addjob.thisjob.Write_Up__c+'</p>';
}
//See opportunities
email_body+='<p style="color:gray;"><hr height="2px;" width="100%"/></p><p style="color: #427fed; font-size: 10pt;"><b>SEE MORE OPPORTUNITIES</b></p>';
//Job Openings URL
email_body+='<b><p style="color: Gray; text-align: left; font-size: 10pt; font-family: Arial,sans-serif;">Click <a style="color: #427fed; text-decoration: none;" href="'+Label.JobOpenings+'" target="_blank">here</a> to view more opportunities</p>';
//Referral Guidelines
email_body+='<p style="color: Gray; text-align: left; font-size: 10pt; font-family: Arial,sans-serif;">PS: You can also refer someone for this role and win exciting rewards. Please see the <a style="color: #427fed; text-decoration: none;" target="_blank" href="'+Label.Referral_Guidelines+'">Referral Guidelines</a> for more details.</b></p><br/>';
//Privacy Policy | Terms of services
email_body+='<p style="color: Gray; text-align: left; font-size: 13px;"><a style="color: #427fed; text-decoration: none; font-size: 13px;" target="_blank" href="'+Label.PrivacyPolicy+'">Privacy Policy</a> | <a style="color: #427fed; text-decoration: none;" target="_blank" href="'+Label.TermsOfService+'">Terms of Services</a> | <span>© 2015 InMobi</span></p>';
//Terms paragraph
email_body+='<p color: #EEEEEE; style="color: #EEEEEE; text-align: left; font-size: 11px; line-height: 18px; margin-bottom:2px;">'+termsString+'</p></div></div></div><br/><p style="height:5px;"></p></div><p></p>';

mail.setHtmlBody(email_body);
}
try{ //Send email
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
}catch(Exception ex){
ApexPages.addMessages(ex);
}
}

/*Wrapper class written to bind the checkbox which the list records Contact Form*/
public class selectedRecord{

public boolean isSelected {get;set;} /*Used for checkbox */
public Contact thisContact {get;set;} /*Identifies this Contact*/

/*Wrapper class constructor binding Contact which select checkbox*/
public selectedRecord(Contact thisContact,Boolean isSelected){
this.thisContact= thisContact;
this.isSelected = isSelected;
}
}

/*Wrapper class written to bind the checkbox which the list records Job Form*/
public class selectedJobRecord{

public boolean isSelected {get;set;} /*Used for checkbox */
public ts2__Job__c thisJob {get;set;} /*Identifies this Job*/

/*Wrapper class constructor binding Job which select checkbox*/
public selectedJobRecord(ts2__Job__c thisJob,Boolean isSelected){
this.thisJob = thisJob;
this.isSelected = isSelected;
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.