• Robert Bange*
  • NEWBIE
  • 10 Points
  • Member since 2014
  • BaIT

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
I created a flow that creates a knowledge article. To activate this flow from a listview, I created a lightning action with a visual force page.
This looks likes this:
<apex:page standardController="KnowledgeArticle">
    <flow:interview name="Create_Category_Knowledge"/>
</apex:page>

Using "knowledge__kav" as standardcontroller did not work.
How can I go to the article, created by the flow?
I tried to use finishLocation=, but I cannot find a parameter that works.
e.g. using "/{!KnowledgeArticle.ID" leads to:
"Invalid Page Redirection
The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button."
Suggestions are very welcome!
Hi,
We are requested to use typeahead for a search in an external database, using webservices. We are expecting that this wont work due to the response time. Has anybody any experience with this?












?
I have created the following following controler extention and even after searching internet and forums, I do not succees in writing a test for it...
Can anyone help me?

public class passengerExtention
{
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller)
    {
        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions()
    {                
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
     
        list<selectoption> Areas= new list<selectoption>();
        Set<String> distinctAreas = new Set<String>();
        list<Ships_location__c> selectedArea= [SELECT Area__c
                                               FROM Ships_location__c
                                               ORDER BY Area__c ];
        for(Ships_location__c sl:selectedArea)
        {
            distinctAreas.add(sl.Area__c);
        }                                   
        //Vul picklist                                      
        Areas.add(firstOption);    
        for(String s : distinctAreas)
        {
            Areas.add(new selectoption(s,s));
        }
        return Areas;    
    }    
    //Picklist Berth
    public List<SelectOption> getBerthList() 
    {        
        List<SelectOption> passBerth = new List<SelectOption>();
        
        //Verzamel waarden voor picklist
        
        List<Ships_location__c> pBs = [SELECT id, Name
                                       FROM Ships_location__c
                                       WHERE Id NOT IN(select Berth__c from Opvarende__c o where o.Reis_Charter__c =: boeking.Reis__c)
                                       AND Area__c =: selectedArea
                                       ORDER BY name];
        
        SelectOption firstOption = new SelectOption('', '- Choose Free Berth -');

        //Vul picklist
        passBerth.add(firstOption);
        for (Ships_location__c pB: pBs) 
        {
            passBerth.add(new SelectOption(pB.id, pB.Name ));
        }
        return passBerth;
    }   
}
I have controler extention in which I use a query to populate a picklist:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<Ships_location__c> selectedArea= [SELECT Area__c
                                               FROM Ships_location__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(Ships_location__c sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }

This works nicely, but it gives a lot of double values in the picklist...
So I tried to transform it with a GROUP BY query but I cannot get it work:

the result sofar is:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<AggregateResult> selectedArea = [SELECT Area__c, COUNT(id)
                                               FROM Ships_location__c
                                               GROUP BY Area__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(AggregateResult sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }
   
The error is invalid field Area__c for sObject AggregateResult...

I would appreciat any suggestion.

Thanks,

Robert
I have created a test class for testing a trigger on Event. 

I get the the error: 

Class.testTriggerOnEvent.insertEvent: line 19, column 1

Line 19 is the insert -

I would welcome suggestions to make this work...

Regards, Robert

This is the class:

@istest
 public class testTriggerOnEvent {
     static testmethod void insertEvent() {
         Event e = new Event();
         
         e.Subject='Test for trigger';
         e.WhatId='001g000000Msxb7AAB';
         e.WhoId='003g000000JkXolAAF';
         e.OwnerId='00520000003bZVYAA2';
         e.recordtypeid='012g00000000VSrAAM';
         e.Type='Visit';
         e.IsAllDayEvent=false;
         e.DurationInMinutes=60;
         e.activitydatetime=system.now();
         e.ShowAs = 'Busy';
         e.IsReminderSet = false;

        
         insert e;
                      
     }
 }
I have created the following following controler extention and even after searching internet and forums, I do not succees in writing a test for it...
Can anyone help me?

public class passengerExtention
{
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller)
    {
        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions()
    {                
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
     
        list<selectoption> Areas= new list<selectoption>();
        Set<String> distinctAreas = new Set<String>();
        list<Ships_location__c> selectedArea= [SELECT Area__c
                                               FROM Ships_location__c
                                               ORDER BY Area__c ];
        for(Ships_location__c sl:selectedArea)
        {
            distinctAreas.add(sl.Area__c);
        }                                   
        //Vul picklist                                      
        Areas.add(firstOption);    
        for(String s : distinctAreas)
        {
            Areas.add(new selectoption(s,s));
        }
        return Areas;    
    }    
    //Picklist Berth
    public List<SelectOption> getBerthList() 
    {        
        List<SelectOption> passBerth = new List<SelectOption>();
        
        //Verzamel waarden voor picklist
        
        List<Ships_location__c> pBs = [SELECT id, Name
                                       FROM Ships_location__c
                                       WHERE Id NOT IN(select Berth__c from Opvarende__c o where o.Reis_Charter__c =: boeking.Reis__c)
                                       AND Area__c =: selectedArea
                                       ORDER BY name];
        
        SelectOption firstOption = new SelectOption('', '- Choose Free Berth -');

        //Vul picklist
        passBerth.add(firstOption);
        for (Ships_location__c pB: pBs) 
        {
            passBerth.add(new SelectOption(pB.id, pB.Name ));
        }
        return passBerth;
    }   
}
I have controler extention in which I use a query to populate a picklist:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<Ships_location__c> selectedArea= [SELECT Area__c
                                               FROM Ships_location__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(Ships_location__c sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }

This works nicely, but it gives a lot of double values in the picklist...
So I tried to transform it with a GROUP BY query but I cannot get it work:

the result sofar is:

public class passengerExtention {

    
    private final Individuele_Boeking__c boeking;
    public string selectedArea {get; set;}

    public passengerExtention(ApexPages.StandardController controller) {

        this.boeking = (Individuele_Boeking__c) controller.getRecord();
    }
    
    //Picklist Area
    public list<selectoption> getAreaOptions(){
        
        
        //Verzamel waarden voor picklist
        SelectOption firstOption = new SelectOption('', ' - Choose Area - ');
        
        list<selectoption> Areas= new list<selectoption>();        
        list<AggregateResult> selectedArea = [SELECT Area__c, COUNT(id)
                                               FROM Ships_location__c
                                               GROUP BY Area__c
                                               ORDER BY Area__c ];
                                               
        //Vul picklist                                       
        Areas.add(firstOption);
        
        for(AggregateResult sl:selectedArea){
            Areas.add(new selectoption(sl.Area__c,sl.Area__c));
        }
        return Areas;     
    }
   
The error is invalid field Area__c for sObject AggregateResult...

I would appreciat any suggestion.

Thanks,

Robert
I have created a test class for testing a trigger on Event. 

I get the the error: 

Class.testTriggerOnEvent.insertEvent: line 19, column 1

Line 19 is the insert -

I would welcome suggestions to make this work...

Regards, Robert

This is the class:

@istest
 public class testTriggerOnEvent {
     static testmethod void insertEvent() {
         Event e = new Event();
         
         e.Subject='Test for trigger';
         e.WhatId='001g000000Msxb7AAB';
         e.WhoId='003g000000JkXolAAF';
         e.OwnerId='00520000003bZVYAA2';
         e.recordtypeid='012g00000000VSrAAM';
         e.Type='Visit';
         e.IsAllDayEvent=false;
         e.DurationInMinutes=60;
         e.activitydatetime=system.now();
         e.ShowAs = 'Busy';
         e.IsReminderSet = false;

        
         insert e;
                      
     }
 }