• AUCTUS Administrator
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hi eversyone, 

short description of what I am aiming to achieve: 
I have a Flow which has a variable (or more if I get it to work). This flow is rendered in a Visualforce Page controlled by a controller I wrote.
I want the Users to run the Flow over a Link, select multiple multipicklist values and then to click on finish. Then they should be redirected to a report with an URL Hack. The Variable of the Flow whould then be one of the criterias of the report filter.

If they select: BnB Manager and Specialist 
The output of the field looks like: BnB Manager, Specialist 
In the Controller I want to get: BnB%20Manager%2C%20Specialist. 

This is the VFP:
<apex:page controller="ExpertflowController" showHeader="true" standardStylesheets="true" language="de"> 
                             <flow:interview name="ExpertQueue" interview="{!ExpertInterview}" finishLocation="{!prFinishLocation}" />                                                                               
 </apex:page>
And the controller:
 
public class ExpertflowController{
public Flow.Interview.ExpertQueue ExpertInterview {get;set;}
public PageReference prFinishLocation {
 get {
PageReference prRef = new PageReference('/00O240000048JoX?pv0=' + strOutputVariable); prRef.setRedirect(true);
 return prRef;
 }
 set { prFinishLocation = value; }
 }
public String strOutputVariable {
 get {
 String strTemp = '';
 if(ExpertInterview != null) {
 strTemp = string.valueOf(ExpertInterview.Input);
 }
 return strTemp;
 }
 set { strOutputVariable = value; }
 }
}


Whenever I use the strTemp = strTemp.replaceAll('\\s+', '%20');

I can safe the controller, but I get this error while running the VFP:

Attempt to de-reference a null object 
Ein unerwarteter Fehler ist aufgetreten. Ihre Entwicklungsorganisation wurde benachrichtigt.

 
Many thanks in advance :) and wishing you all a merry christmas time. 

Best

Sam

 
Hallo, 

since I am new to Apex and specially this forum please dont be so hard on me. 

I am trying to get this to work: 

(Short explenation of the porpuse: When sending out a Mail with a specific Subject, the contact field "Recruiting_Status__c" should be updated on the contact related to the task (WhoId). 

Note: I tried to do include the contact to my list and update on two different ways as you may notice (last one is different), but code coverage keeps telling me somethings wrong.. 

Trigger: 
trigger RecEmailTrigger on Task (after insert) {
    List<Contact> contactsToUpdate = new List<Contact>();
    
    for(Task t : Trigger.new) {
        if (t.WhoId != null){
        
        List<Contact> Con = [SELECT Id, Name, Recruiting_Status__c 
                             FROM Contact 
                             WHERE Id = :t.WhoID];
        
        if(t.subject.equals('Email: Anfrage auf vollständige Bewerbungsunterlagen')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Requested complete set of documents'));}     
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für ein erstes Vorabgespräch')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for initial conversation'));}
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für die CaseStudy@Home')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for case study'));} 
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && (Con[0].Recruiting_Status__c.contains('preselected') || Con[0].Recruiting_Status__c.contains('Requested complete') )) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after preselection'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('initial conversation')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after initial conversation'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('case study')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after case study'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('IM-interview')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after IM-interview'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('partner/MD interview')) {
        Con[0].Recruiting_Status__c = 'Declined after partner interview';
        contactsToUpdate.addAll(Con);}
        
    } 
    }
     update contactsToUpdate;
}
Test Class:
@IsTest
public class TestRecEmailTrigger {

        static testmethod void insertTask() {
        
        User us = new User();
        
        us.FirstName = 'Test';
        us.LastName = 'User';
        us.Alias = 'UserTest';
        us.Email = 'samuel.schoessel@gmx.de';
        us.Username = 'samuel.schoessel@gmx.de';
        us.CommunityNickname = 'Sammy';
        us.TimeZoneSidKey = 'Europe/Berlin';
        us.LocaleSidKey = 'de_DE';
        us.EmailEncodingKey = 'UTF-8';
        us.LanguageLocaleKey = 'en_US';
        us.ProfileId = '00e24000000Mca5';
        
        insert us; 
         
        Account acc = new Account(); 
        
        acc.Name = 'Test Account';
        acc.RecordTypeId = '012240000004qdf';
        acc.OwnerId = us.Id;
        
        insert acc;
        
        Contact con = new Contact();
        
        con.LastName = 'The Sam';
        con.FirstName = 'Sammy';
        con.OwnerId = us.Id;
        con.RecordTypeId = '012240000006HOl'; 
        con.Recruiting_Status__C = 'Scheduled for initial conversation';  
        
        insert con;  
         
        Task t = New Task();
        
        t.Subject = 'vollständige Bewerbungsunterlagen';
        t.Priority = 'Normal';
        t.Status = 'Geschlossen';
        t.OwnerId = us.Id;
        t.WhoId = con.Id;
                
        insert t;
        }
    }

Back to the Issue:
Apex Test Execution tells me that the Test passes the test but I only have 50% code coverage because it wont take all the lines with the contactsToUpdate List. 
As you can see in:
User-added image

Many many thanks in advance!! I really hope someone can help me with that!

Best

Sam
Hallo, 

since I am new to Apex and specially this forum please dont be so hard on me. 

I am trying to get this to work: 

(Short explenation of the porpuse: When sending out a Mail with a specific Subject, the contact field "Recruiting_Status__c" should be updated on the contact related to the task (WhoId). 

Note: I tried to do include the contact to my list and update on two different ways as you may notice (last one is different), but code coverage keeps telling me somethings wrong.. 

Trigger: 
trigger RecEmailTrigger on Task (after insert) {
    List<Contact> contactsToUpdate = new List<Contact>();
    
    for(Task t : Trigger.new) {
        if (t.WhoId != null){
        
        List<Contact> Con = [SELECT Id, Name, Recruiting_Status__c 
                             FROM Contact 
                             WHERE Id = :t.WhoID];
        
        if(t.subject.equals('Email: Anfrage auf vollständige Bewerbungsunterlagen')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Requested complete set of documents'));}     
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für ein erstes Vorabgespräch')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for initial conversation'));}
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für die CaseStudy@Home')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for case study'));} 
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && (Con[0].Recruiting_Status__c.contains('preselected') || Con[0].Recruiting_Status__c.contains('Requested complete') )) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after preselection'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('initial conversation')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after initial conversation'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('case study')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after case study'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('IM-interview')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after IM-interview'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('partner/MD interview')) {
        Con[0].Recruiting_Status__c = 'Declined after partner interview';
        contactsToUpdate.addAll(Con);}
        
    } 
    }
     update contactsToUpdate;
}
Test Class:
@IsTest
public class TestRecEmailTrigger {

        static testmethod void insertTask() {
        
        User us = new User();
        
        us.FirstName = 'Test';
        us.LastName = 'User';
        us.Alias = 'UserTest';
        us.Email = 'samuel.schoessel@gmx.de';
        us.Username = 'samuel.schoessel@gmx.de';
        us.CommunityNickname = 'Sammy';
        us.TimeZoneSidKey = 'Europe/Berlin';
        us.LocaleSidKey = 'de_DE';
        us.EmailEncodingKey = 'UTF-8';
        us.LanguageLocaleKey = 'en_US';
        us.ProfileId = '00e24000000Mca5';
        
        insert us; 
         
        Account acc = new Account(); 
        
        acc.Name = 'Test Account';
        acc.RecordTypeId = '012240000004qdf';
        acc.OwnerId = us.Id;
        
        insert acc;
        
        Contact con = new Contact();
        
        con.LastName = 'The Sam';
        con.FirstName = 'Sammy';
        con.OwnerId = us.Id;
        con.RecordTypeId = '012240000006HOl'; 
        con.Recruiting_Status__C = 'Scheduled for initial conversation';  
        
        insert con;  
         
        Task t = New Task();
        
        t.Subject = 'vollständige Bewerbungsunterlagen';
        t.Priority = 'Normal';
        t.Status = 'Geschlossen';
        t.OwnerId = us.Id;
        t.WhoId = con.Id;
                
        insert t;
        }
    }

Back to the Issue:
Apex Test Execution tells me that the Test passes the test but I only have 50% code coverage because it wont take all the lines with the contactsToUpdate List. 
As you can see in:
User-added image

Many many thanks in advance!! I really hope someone can help me with that!

Best

Sam
Hi eversyone, 

short description of what I am aiming to achieve: 
I have a Flow which has a variable (or more if I get it to work). This flow is rendered in a Visualforce Page controlled by a controller I wrote.
I want the Users to run the Flow over a Link, select multiple multipicklist values and then to click on finish. Then they should be redirected to a report with an URL Hack. The Variable of the Flow whould then be one of the criterias of the report filter.

If they select: BnB Manager and Specialist 
The output of the field looks like: BnB Manager, Specialist 
In the Controller I want to get: BnB%20Manager%2C%20Specialist. 

This is the VFP:
<apex:page controller="ExpertflowController" showHeader="true" standardStylesheets="true" language="de"> 
                             <flow:interview name="ExpertQueue" interview="{!ExpertInterview}" finishLocation="{!prFinishLocation}" />                                                                               
 </apex:page>
And the controller:
 
public class ExpertflowController{
public Flow.Interview.ExpertQueue ExpertInterview {get;set;}
public PageReference prFinishLocation {
 get {
PageReference prRef = new PageReference('/00O240000048JoX?pv0=' + strOutputVariable); prRef.setRedirect(true);
 return prRef;
 }
 set { prFinishLocation = value; }
 }
public String strOutputVariable {
 get {
 String strTemp = '';
 if(ExpertInterview != null) {
 strTemp = string.valueOf(ExpertInterview.Input);
 }
 return strTemp;
 }
 set { strOutputVariable = value; }
 }
}


Whenever I use the strTemp = strTemp.replaceAll('\\s+', '%20');

I can safe the controller, but I get this error while running the VFP:

Attempt to de-reference a null object 
Ein unerwarteter Fehler ist aufgetreten. Ihre Entwicklungsorganisation wurde benachrichtigt.

 
Many thanks in advance :) and wishing you all a merry christmas time. 

Best

Sam

 
Hallo, 

since I am new to Apex and specially this forum please dont be so hard on me. 

I am trying to get this to work: 

(Short explenation of the porpuse: When sending out a Mail with a specific Subject, the contact field "Recruiting_Status__c" should be updated on the contact related to the task (WhoId). 

Note: I tried to do include the contact to my list and update on two different ways as you may notice (last one is different), but code coverage keeps telling me somethings wrong.. 

Trigger: 
trigger RecEmailTrigger on Task (after insert) {
    List<Contact> contactsToUpdate = new List<Contact>();
    
    for(Task t : Trigger.new) {
        if (t.WhoId != null){
        
        List<Contact> Con = [SELECT Id, Name, Recruiting_Status__c 
                             FROM Contact 
                             WHERE Id = :t.WhoID];
        
        if(t.subject.equals('Email: Anfrage auf vollständige Bewerbungsunterlagen')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Requested complete set of documents'));}     
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für ein erstes Vorabgespräch')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for initial conversation'));}
        
        else if(t.subject.equals('Email: Das AUCTUS Recruiting Erlebnis: selbständige Terminkoordination für die CaseStudy@Home')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'In scheduling process for case study'));} 
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && (Con[0].Recruiting_Status__c.contains('preselected') || Con[0].Recruiting_Status__c.contains('Requested complete') )) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after preselection'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('initial conversation')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after initial conversation'));}  
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('case study')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after case study'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('IM-interview')) {
        contactsToUpdate.add(new Contact(Id = t.WhoId, Recruiting_Status__c = 'Declined after IM-interview'));}
        
        else if((t.subject.equals('Email: Vielen Dank für Ihre Bewerbung') || t.subject.equals('Email: Vielen Dank für Ihre Kontaktaufnahme'))
        && Con[0].Recruiting_Status__c.contains('partner/MD interview')) {
        Con[0].Recruiting_Status__c = 'Declined after partner interview';
        contactsToUpdate.addAll(Con);}
        
    } 
    }
     update contactsToUpdate;
}
Test Class:
@IsTest
public class TestRecEmailTrigger {

        static testmethod void insertTask() {
        
        User us = new User();
        
        us.FirstName = 'Test';
        us.LastName = 'User';
        us.Alias = 'UserTest';
        us.Email = 'samuel.schoessel@gmx.de';
        us.Username = 'samuel.schoessel@gmx.de';
        us.CommunityNickname = 'Sammy';
        us.TimeZoneSidKey = 'Europe/Berlin';
        us.LocaleSidKey = 'de_DE';
        us.EmailEncodingKey = 'UTF-8';
        us.LanguageLocaleKey = 'en_US';
        us.ProfileId = '00e24000000Mca5';
        
        insert us; 
         
        Account acc = new Account(); 
        
        acc.Name = 'Test Account';
        acc.RecordTypeId = '012240000004qdf';
        acc.OwnerId = us.Id;
        
        insert acc;
        
        Contact con = new Contact();
        
        con.LastName = 'The Sam';
        con.FirstName = 'Sammy';
        con.OwnerId = us.Id;
        con.RecordTypeId = '012240000006HOl'; 
        con.Recruiting_Status__C = 'Scheduled for initial conversation';  
        
        insert con;  
         
        Task t = New Task();
        
        t.Subject = 'vollständige Bewerbungsunterlagen';
        t.Priority = 'Normal';
        t.Status = 'Geschlossen';
        t.OwnerId = us.Id;
        t.WhoId = con.Id;
                
        insert t;
        }
    }

Back to the Issue:
Apex Test Execution tells me that the Test passes the test but I only have 50% code coverage because it wont take all the lines with the contactsToUpdate List. 
As you can see in:
User-added image

Many many thanks in advance!! I really hope someone can help me with that!

Best

Sam
Hi all,

I have created a lead flow where the Finish Location is a pageReference ( for a new lead) contructed from parameters (flow variables) collected throughout the flow. I am experiencing a problem when attempting to constuct the URL where the variables contain spaces, such as "Street". I want to encode the variables gathered from the flow, using the URLEncode Utility class, so that when the URL is constructed in the appropriate format. My code is below...



public class ExistingCustomerLead {

public Flow.Interview.Existing_Customer_Lead_Search myFlow {get; set;}
    public String ExistingCustomer;
    public String getExistingCustomer() {
    if (myFlow==null) return '';
else return myFlow.ExistingCustomer;
    }
    public String City;
    public String getCity() {
        if (myFlow==null) return '';
        else return myFlow.City;
    }
    public String Country;
    public String getCountry() {
        if (myFlow==null) return '';
        else return myFlow.Country;
    }
    public String State;
    public String getState() {
        if (myFlow==null) return '';
        else return myFlow.State;
    }
    public String Street;
    public String getStreet() {
        if (myFlow==null) return '';
        else return myFlow.Street;
    }
  
   
    public String PostalCode;
    public String getPostalCode() {
        if (myFlow==null) return '';
        else return myFlow.PostalCode;
    }

    public PageReference getFinishPage(){

        PageReference p = new PageReference('/00Q/e?CF00N90000001AYrf' + EncodingUtil.urlEncode(getExistingCustomer(), 'UTF-8') + '&RecordType=012900000007FVZ&ent=Lead');
                p.setRedirect(true);
                   
                    return p;
       
    }



}