• Cezu
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies

Hi 

I have task :

 

Imagine that our company operates in many markets, and serves customers in a variety of languages (eg Poland and the UK). In the system, so keep emailing templates in two languages - Polish and English. For example template:
     Recipient: {! Contact.salutation} {!} {Contact.lastName contact.firstName}
result: we should get:
     Recipient: Mr. John Doe

But then for the English version:
     Addressee: {! Contact.salutation} {!} {Contact.lastName contact.firstName}
we obtain
     Addressee: Mr. John Doe
instead
     Addressee: Mr. John Doe

 

How translate this picklists ? Using any class or use translator workbench ?? Or maybe other solution ?? Can somebody help ??

  • April 15, 2013
  • Like
  • 0

Hi Everyone,

 

I created a VF form which will i save  field in my custom object   I'm using this page in the site here while i'm clicking the Save! button it is showing me the Authorization required page.I checked all the permissions to object ,fields,Apex class, VF all are correct.Here is my code

 

Controler :

 

public class CreateNewCandidateToVerify{
private final ApexPages.standardController controller;
private final Candidate_to_Verify__c obj;
public Attachment attachment {get; set;}

public CreateNewCandidateToVerify(ApexPages.StandardController stdController) {
this.controller = stdController;
this.obj = (Candidate_to_Verify__c)stdController.getRecord();
attachment = new Attachment();
}

public PageReference zapis(){
String val = ApexPages.currentPage().getParameters().get('recruitment');
Recruitment__c rec = [
SELECT id
FROM Recruitment__c
WHERE id = :val
LIMIT 1];
obj.Recruitment__c = rec.id;
insert obj;
Candidate_to_Verify__c added = [
SELECT id
FROM Candidate_to_Verify__c
WHERE Name__c = :obj.Name__c
AND Surname__c = :obj.Surname__c
AND Phone__c = :obj.Phone__c
AND E_mail__c = :obj.E_mail__c
LIMIT 1];
attachment.ParentId = added.id;
try{
insert attachment;
}
catch (DMLException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment. You can send your CV by e-mail: e-mail adress'));
return null;
}
//obj = new Candidate_to_Verify__c();
//attachment = new Attachment();
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Thanks for Application'));
return null;
}

}

 

VF Page 

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Candidate_to_verify__c" extensions="CreateNewCandidateToVerify">

 

<h1>Welcome in HR App</h1>
</center>
<h2></h2>
<br></br>
<apex:form >
<center>
<apex:pageBlock id="tst2">
<apex:pageMessages />
<apex:pageBlockSection columns="1">

<h3>Personal Data</h3>

<apex:inputField value="{!Candidate_to_verify__c.Name__c}"/>
<apex:inputField value="{!Candidate_to_verify__c.Surname__c}"/>
<h3>Contact Data</h3>
<apex:inputField value="{!Candidate_to_verify__c.Phone__c}"/>
<apex:inputField value="{!Candidate_to_verify__c.E_mail__c}"/>


</apex:pageBlockSection>
<h1>Attach your CV</h1>
<apex:pageBlockSection showHeader="false" columns="2" id="block1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="File Name" for="fileName"/>
<apex:inputText value="{!attachment.name}" id="fileName"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="File" for="file"/>
<apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Description" for="description"/>
<apex:inputTextarea value="{!attachment.description}" id="description"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>

<apex:pageBlockSection >
<apex:commandButton action="{!zapis}" value="Save!">
<apex:param value="{!$CurrentPage.parameters.recruitment}" assignTo="{!Candidate_to_Verify__c.Recruitment__c}"/>
</apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel!"/>

</apex:pageBlockSection>

</apex:pageBlock>
</center>
</apex:form>
</apex:page>

 

  • April 04, 2013
  • Like
  • 0

Hi i must wrote test class to this class but i dont know how 

 

Can somebody help ?? 

 

global class Emailservice implements Messaging.InboundEmailHandler { 
  global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,
    Messaging.InboundEnvelope envelope) {
    
    Messaging.InboundEmailResult result = new Messaging.InboundEmailresult(); 
    
    Contacts_History__c emaill = new Contacts_History__c ();
    List<Candidate__c> CandiList = [SELECT ID FROM Candidate__c 
                                   WHERE E_mail__c =: email.fromAddress LIMIT 1];                             

    emaill.Subject__c = email.subject;
    emaill.Body__c = email.htmlBody;
    emaill.Candidate__c = CandiList[0].id;
    emaill.Date_of_contact__c = datetime.now();
    emaill.Way_of_contact__c = 'E-mail';
       
    
    String subToCompare = 'REC-';               
    Integer startNum = email.subject.IndexOf(subToCompare);                                                              
    String phrase = email.subject.mid(startNum, 10);
                        
   /* List<Recruitment__c> recruitmentList = [SELECT ID FROM Recruitment__c 
                                   WHERE name = :phrase LIMIT 1];
        if (!recruitmentList.isEmpty()) {
            emaill.Recruitment__c = recruitmentList[0].id;  
            }*/
             
        insert emaill;
        
     if (email.textAttachments != null) {                                                      
            for (Messaging.Inboundemail.TextAttachment tAttachment : email.textAttachments) {
                Attachment attachment = new Attachment();
     
                attachment.Name = tAttachment.fileName;
                attachment.Body = Blob.valueOf(tAttachment.body);
                attachment.ParentId = emaill.Id;
                insert attachment;
            }
        }
        //obsluga zalacznikow binarnych
        if (email.binaryAttachments != null){                                                       
            for (Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments) {
                Attachment attachment = new Attachment();
     
                attachment.Name = bAttachment.fileName;
                attachment.Body = bAttachment.body;
                attachment.ParentId = emaill.Id;
                insert attachment;
            }
        }
    
    return result;
    }
}
  • April 04, 2013
  • Like
  • 0

Hi im newbiee

 

I have problem i write : 

 

trigger createReservation on Rezerwacja__c (before insert, before update) {

Set<id> rezSet = new Set<id>();

for (Rezerwacja__c rez : trigger.new){
rezSet.add(rez.Item__c);
}


List<Rezerwacja__c> rezList = [SELECT Rental_Date__c, Date_of_return__c, Status__c
FROM Rezerwacja__c
where id in :trigger.new];
List <Item__c> itList = [SELECT id, name FROM Item__c WHERE Item__c.Rezerwacja__c IN : rezList];

Map<Id, List<Rezerwacja__c>> rezMap = new Map<Id, List<Rezerwacja__c>>()

 

 

 

i wants the item was not available in a given period of time

Can somebody help me ?? 

  • March 20, 2013
  • Like
  • 1

I have problem :

I want send one mail to one person using this code (for each user mail others mailadresses must be invisible , not bcc ):

 

global class mailSendBatchJob implements Database.Batchable<sObject>,Schedulable {
public List<String> usr{get;set;} //
public List<sObject> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}

global mailSendBatchJob(){
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id,E_mail__c from invoice_statement__c where Status__c = 'Negocjowana']);
}

global void execute(Database.BatchableContext BC,List<sObject> scope){
usr = new List<String>();
usr_email = new List<sObject>();
usr.clear();
usr_email.clear();
usr_email=[select id,E_mail__c from invoice_statement__c where Status__c = 'Negocjowana'];

Map_usr=new Map<string,string>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {};

for(sobject s : scope) {
toAddresses.add(string.valueof( s.get('E_mail__c')));
}

mail.setToAddresses(toAddresses);
mail.setSubject('Twoja faktura jest otwarta');
mail.setPlainTextBody('Twoja faktura jest otwarta');

Messaging.sendEmail(new Messaging.Singleemailmessage[] { mail });
}

global void execute (SchedulableContext sc){
MailSendBatchJob b = new MailSendBatchJob();
Database.executeBatch(b,10);
}

global void finish(Database.BatchableContext BC){
}
}

 

 

Can somebody help 

  • February 12, 2013
  • Like
  • 0

I wrote this code : 

 

global class mailSendBatchJob implements Database.Batchable<sObject> {
public List<String> usr{get;set;} //
public List<sObject> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}

global mailSendBatchJob(){
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id,E_mail__c from invoice_statement__c where Status__c = 'Otwarta']);
}

global void execute(Database.BatchableContext BC,List<sObject> scope){
usr=new List<String>();
usr_email=new List<sObject>();
usr.clear();
usr_email.clear();
usr_email=[select id,E_mail__c from invoice_statement__c where Status__c = 'Otwarta'];
Map_usr=new Map<string,string>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {};
for(sobject s : scope){
toAddresses.add(string.valueof(usr_email));
}

mail.setToAddresses(toAddresses);
mail.setSubject('Twoja faktura jest otwarta');
mail.setPlainTextBody('Twoja faktura jest otwarta');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}

global void finish(Database.BatchableContext BC){

}
}

 

when i launch this batch apex give me error like this : 

 

Apex script unhandled exception by user/organization: 005i0000000Hm7C/00Di0000000HTKm

Failed to process batch for class 'mailSendBatchJob' for job id '707i00000008eVb'

caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: LIMIT_EXCEEDED, Too many to addresses.: []

Class.mailSendBatchJob.execute: line 29, column 1

 

 

 

 

somebody show me what i'm doing wrong 

 

 

  • February 11, 2013
  • Like
  • 0

Hi im newbiee

 

I have problem i write : 

 

trigger createReservation on Rezerwacja__c (before insert, before update) {

Set<id> rezSet = new Set<id>();

for (Rezerwacja__c rez : trigger.new){
rezSet.add(rez.Item__c);
}


List<Rezerwacja__c> rezList = [SELECT Rental_Date__c, Date_of_return__c, Status__c
FROM Rezerwacja__c
where id in :trigger.new];
List <Item__c> itList = [SELECT id, name FROM Item__c WHERE Item__c.Rezerwacja__c IN : rezList];

Map<Id, List<Rezerwacja__c>> rezMap = new Map<Id, List<Rezerwacja__c>>()

 

 

 

i wants the item was not available in a given period of time

Can somebody help me ?? 

  • March 20, 2013
  • Like
  • 1

I have problem :

I want send one mail to one person using this code (for each user mail others mailadresses must be invisible , not bcc ):

 

global class mailSendBatchJob implements Database.Batchable<sObject>,Schedulable {
public List<String> usr{get;set;} //
public List<sObject> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}

global mailSendBatchJob(){
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id,E_mail__c from invoice_statement__c where Status__c = 'Negocjowana']);
}

global void execute(Database.BatchableContext BC,List<sObject> scope){
usr = new List<String>();
usr_email = new List<sObject>();
usr.clear();
usr_email.clear();
usr_email=[select id,E_mail__c from invoice_statement__c where Status__c = 'Negocjowana'];

Map_usr=new Map<string,string>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {};

for(sobject s : scope) {
toAddresses.add(string.valueof( s.get('E_mail__c')));
}

mail.setToAddresses(toAddresses);
mail.setSubject('Twoja faktura jest otwarta');
mail.setPlainTextBody('Twoja faktura jest otwarta');

Messaging.sendEmail(new Messaging.Singleemailmessage[] { mail });
}

global void execute (SchedulableContext sc){
MailSendBatchJob b = new MailSendBatchJob();
Database.executeBatch(b,10);
}

global void finish(Database.BatchableContext BC){
}
}

 

 

Can somebody help 

  • February 12, 2013
  • Like
  • 0

I wrote this code : 

 

global class mailSendBatchJob implements Database.Batchable<sObject> {
public List<String> usr{get;set;} //
public List<sObject> usr_email{get;set;}
public Map<string,string> Map_usr{get;set;}

global mailSendBatchJob(){
}

global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([select id,E_mail__c from invoice_statement__c where Status__c = 'Otwarta']);
}

global void execute(Database.BatchableContext BC,List<sObject> scope){
usr=new List<String>();
usr_email=new List<sObject>();
usr.clear();
usr_email.clear();
usr_email=[select id,E_mail__c from invoice_statement__c where Status__c = 'Otwarta'];
Map_usr=new Map<string,string>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {};
for(sobject s : scope){
toAddresses.add(string.valueof(usr_email));
}

mail.setToAddresses(toAddresses);
mail.setSubject('Twoja faktura jest otwarta');
mail.setPlainTextBody('Twoja faktura jest otwarta');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}

global void finish(Database.BatchableContext BC){

}
}

 

when i launch this batch apex give me error like this : 

 

Apex script unhandled exception by user/organization: 005i0000000Hm7C/00Di0000000HTKm

Failed to process batch for class 'mailSendBatchJob' for job id '707i00000008eVb'

caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: LIMIT_EXCEEDED, Too many to addresses.: []

Class.mailSendBatchJob.execute: line 29, column 1

 

 

 

 

somebody show me what i'm doing wrong 

 

 

  • February 11, 2013
  • Like
  • 0