• Francesco Sciuto
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 1
    Likes Given
  • 9
    Questions
  • 8
    Replies
We display inside a tab in the Sales Console a custom object page layout with a custom Javascript button. Once the user clicks on that button, the custom code performs some operations on a Salesforce custom web service APEX class (by using the script connection.js) and based on the response, eventually opens a new tab in the console (by using the script integration.js). This functionality works fine.

When the system is busy working, not to let the user press the button twice or getting confused about the state of his request, we want to disable the button and display the waiting cursor. So we created the following code inside the button:

 
var btnService = document.getElementsByName("check_lead_contact");

btnService[0].value='Checking, please wait...';
btnService[0].disabled=true;
document.body.style.cursor = 'wait';

//JavaScript code calling APEX Webservice by using connection.js
//Javascript code opening new Sales Consoel tab using integration.js

document.body.style.cursor = 'default';
btnService[0].value='Check Lead/Contact';
btnService[0].disabled=false;

However this code does not work, the button does not get disabled and the cursor does not change to "wait". However, if I inspect the code with developer tools, I see that in the console the state of the JS variables linked to both the button and the cursor change but such changes are not reflected in the UI. All the changes in the UI are made once the function ends and not the state variable change, as it is supposed to be, most likely because the call to the webservice somehow make the function hangs.  
 
We asked help to SF support that replied to us that they do not offer support for buttons containing references to either connection.js or integration.js, although they are included in official SF documentation. Does anybody know a way to solve this issue?
Accordign to Salesforce documentation the GetTime() function "Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this DateTime object.". Take into account that I am in GMT+1 if I use:

DateTime.newInstance(1970, 1, 1).GetTime();

I get a value of -3600000 milliseconds, meaning -1 hour. I was actually expecting +1 hour since I am in GMT +1, can anybody explain that? The only logic I can find about -1 hour is that when in GMT+1 was January 1, 1970, 00:00:00 in GMT it was still January 1, 1969, 23:00:00 GMT.

This function is really important for a token generation function I am building so I want to be sure I following a correct reasoning. Thanks
I have an object layout displayed as a tab inside Sales Console. I have some Javascript attached to the onClick event of a button on the layout. In the Javascript I would like to retrieve the Base URL displayed in the browser. So if I have 'https://[instancenumber].salesforce.com/console' I would like to get 'https://[instancenumber].salesforce.com'. I use within Javascript:

console.log({!$Site.BaseUrl});

but I always get NaN. I know that I might use Javascript directly but I would like to know why this Salesforce approach does not work and I can make it work. Thanks
I have a Visualforce page correctly displayed in Sales Console as sub tab of Live Agent session and among other things I need to open a new sub tab when the user clicks a button of the VF page. So according to the documentation I created a button on my Visualforce page, I tight the Javascript funciton openNewSubTab to the onClick event and I placed the code to open an additional sub tab. The Javascript looks like this:
 
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript"> 

function openNewSubTab(){

console.log('Inside the main function');
sforce.console.getEnclosingPrimaryTabId(function(result) {
     console.log('Inside the new tab function');
     var primaryTabId = result.id;
     sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false, 'salesforce', null, null, null);
});

</script>

This code does not work. In the console I just see the output 'Inside the main function' but not the text placed inside the callback function of sforce.console.getEnclosingPrimaryTabId(). I also tried to declare the callback separately as indicated in the documentation (see below) but I cannot make it work. Am I missing something?
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript"> 

var openSubTab = function(result){
    console.log('Inside the new tab function');
     var primaryTabId = result.id;
     sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false, 'salesforce', null, null, null);
}

function openNewSubTab(){

console.log('Inside the main function');
sforce.console.getEnclosingPrimaryTabId(openSubTab);

</script>



 
I am struggling with signing an input with a key generated by using OpenSSL. My code is as follows:

string algorithmName = 'RSA-SHA1' //also tried with 'RSA'

String base64String = 'KBfW9103GQKknExCqOStSmczmNwDNF81yrF04AVvoVI=';
Blob privateKey = EncodingUtil.base64Decode(base64String);
Blob input = Blob.valueOf('12345qwerty');
            
Crypto.sign(algorithmName, input, privateKey);


The base64String is obtained with the command: openssl rand -base64 32

Everytime I run the code I get the following exception in the log:

"common.apex.runtime.impl.ExecutionException: Invalid Crypto Key"|0x4809a271

Does anybody have an idea what am I doing wrong? Thanks

 
I have created a VF to display Knowledge Base articles for anonymous access. In this page I render a login request if the flag IsVisibleInPkb is false, otherwise I display the Knowledge article. The issue is that even for articles where I am sure the flag IsVisibleInPkb is set to true, it returns false when the VF page is rendered. How can it be possible?

Attached the VF page:
 
<apex:page standardController="PCS__kav">
    <apex:outputPanel rendered="{!!PCS__kav.IsVisibleInPkb}">
        <apex:outputText styleClass="communitiesWarningMessage" value="Sorry you cannot view this article, please login" />
    </apex:outputPanel>
    
    <apex:outputPanel rendered="{!PCS__kav.IsVisibleInPkb}">
        <div class="bPageTitle">
            <div class="ptBody">
                <h1 class="pageType noSecondHeader">{!PCS__kav.Title}</h1>
            </div>
        </div>
        <apex:pageblock title="Description">
            <div class="knowledgeTabPanel-body">
                <div>
                    <div class="pbSubsection">
                        <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <th class="labelCol vfLabelColTextWrap  first  last " scope="row">Problem</th>
                                    <td class="data2Col  first  last ">
                                        <apex:outputText value="{!PCS__kav.Problem__c}" escape="false"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                 <div>
                    <div class="pbSubsection">
                        <table class="detailList" border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <th class="labelCol vfLabelColTextWrap  first  last " scope="row">Solution</th>
                                    <td class="data2Col  first  last ">
                                        <apex:outputText value="{!PCS__kav.Solution__c}" escape="false"/>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </apex:pageblock>
   </apex:outputPanel>
</apex:page>


And the Debug Logs for request coming from Guest users:

35.0 APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINEST;VALIDATION,FINEST;VISUALFORCE,FINEST;WORKFLOW,FINEST
13:39:52.058 (58723671)|EXECUTION_STARTED
13:39:52.058 (58775224)|CODE_UNIT_STARTED|[EXTERNAL]|06633000000950o|VF: /apex/CommunitiesPCSArticles
13:39:52.066 (66031866)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.076 (76821166)|VF_EVALUATE_FORMULA_END
13:39:52.082 (82477353)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.082 (82625784)|VF_EVALUATE_FORMULA_END
13:39:52.082 (82656579)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.082 (82791731)|VF_EVALUATE_FORMULA_END
13:39:52.082 (82823593)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.082 (82962752)|VF_EVALUATE_FORMULA_END
13:39:52.083 (83060972)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.083 (83191161)|VF_EVALUATE_FORMULA_END
13:39:52.083 (83266219)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.083 (83404682)|VF_EVALUATE_FORMULA_END
13:39:52.083 (83433809)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.083 (83594070)|VF_EVALUATE_FORMULA_END
13:39:52.086 (86849930)|VF_EVALUATE_FORMULA_BEGIN|06633000000950o|#{!PCS__kav.IsVisibleInPkb}
13:39:52.086 (86976895)|VF_EVALUATE_FORMULA_END
13:39:52.088 (88697567)|CUMULATIVE_LIMIT_USAGE
13:39:52.088 (88697567)|LIMIT_USAGE_FOR_NS|(default)|


 
Hello,

I am trying to make a function on a controller that gives me back  all the latest knowledge articles excluding the 'PCS__kav'. However when I save the controller with the following query (kaIds is a Set of knowledge article's Ids): 

List<KnowledgeArticleVersion> kav = [SELECT Id, KnowledgeArticleId, lastPublishedDate, ArticleType, UrlName, IsVisibleInCsp, IsVisibleInPkb, IsVisibleInPrm
                                       FROM KnowledgeArticleVersion
                                       WHERE PublishStatus = 'Online'
                                       AND Language = 'en_US'
                                       AND ArticleType != 'PCS__kav'
                                       AND IsLatestVersion = true
                                       AND (IsVisibleInCsp = true
                                       OR IsVisibleInPkb = true
                                       OR IsVisibleInPrm = true)
                                       AND KnowledgeArticleId IN :kaIds LIMIT 10000];    


in the row with  AND ArticleType != 'PCS__kav' I  get the following error message:
Error: Compile Error: Implementation restriction: this type of filter is not allowed on the Type field.

I get the same error if I replace that line with:
  • AND (ArticleType = 'FAQ__kav' OR ArticleType = 'How_to__kav') or
  • AND ArticleType NOT IN ('PCS__kav')

but I do NOT get any error if I use:
  • AND ArticleType = 'FAQ__kav' 
  • AND ArticleType IN ('FAQ__kav', 'How_to__kav')
So what's going on here? It is a simple condition on a field, why the filter is restricted for multiple products and not for one?  Is it a bug? 




 
Hello,

I am currently implementing in our SF Community a customized Login flow and the ForgotPassword functionality is part of that. In the ForgotPassword page I use an APEX inputText for the Username, an outputText for the custom Error message and a commandLink to submit the action request:
<div id="loginErrors" class="errors">
    <apex:outputText value="{!$Label.Communities_Login_WrongUsername}" rendered="{!isWrongUsername}"/>
</div>                      
<apex:inputText id="username" value="{!username}" html-placeholder="Username"/>                        
<apex:commandLink id="submit" value="SUBMIT" action="{!forgotPassword}"/>
The VF page is bind to the ForgotPasswordController:
public PageReference forgotPassword() 
{
    PageReference result;
  		
    boolean success = Site.forgotPassword(username);

    PageReference pr = Page.ForgotPasswordConfirm;
    pr.setRedirect(true);
		  		
    if (success) 
    {  			
	    result = pr;
    }
    else
    {
	    isWrongUsername = true;
    }
    return result;
}
My assumption was that in case the username is not found, the Site.ForgotPassword(username) function would return success = false and therefore I give to the user the same page after setting the IsWrongUsername to true, in order to show the error message.

Apparently my reasoning is not correct since Salesforce documentation (here (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm#apex_System_Site_forgotPassword)) states:
The return value (of ForgotPassword) will always be true unless it’s called outside of a Visualforce page. If it's called outside of a Visualforce page, it will be false.

This statement also explains why my Test Methods always fail (not called from a VisualForce page but from a test class, always success = false).
I find this implementation of the Site.ForgotPassword really weird and I would like to know whether I am somehow making a mistake or there is an alternative way to implement this functionality by using the Site.ForgtoPassword site. 











 
Hello,

I am currently in the process of overriding the native Community login flow of SalesForce with our own custom-made. The custom login flow for Community users (external to our organization) works fine but of course our internal users, if they want to access the community, cannot use the same flow since they need to go to login.salesforce.com (or any othe rinstance URL such as https://na2.salesforce.com), enter their credentials to login to the CRM org and then access the community from there.

Therefore in the login screen for the Community, besides the form to enter the credentials for Communtiy external users, I would like to add a link that redirects our internal users to the CRM login page and still keeping track of the Community URL they were browsing when they were prompted to login.

In order to achieve this, I added the folliwing span element to the SiteLogin component:
<span>Our internal Employee? Login <a href="{! EmployeeLoginURL }">here</a></span>
And in the SiteLoginController (that controls SiteLogin):
global PageReference EmployeeLoginURL {
        get
        {
            String startUrl = System.currentPageReference().getParameters().get('startURL');
            String sfBaseUrl = System.URL.getSalesforceBaseUrl().toExternalForm();
            
            return new PageReference(sfBaseUrl + '/login?' + startURL);
        }
    }
This code does not work for the following reasons:
  1. In some cases EmployeeLoginURL is the base URL of our Community instead of our CRM instance
  2. In some cases EmployeeLoginURL is treated as a relative path and added to the root path of the communityand generates a page not found error;
  3. The login parameter is (indeed) not a valid one.
In some other SF Community, I noticed that in the login screen they have the same fucntionality I am looking for and the displayed link is in the format:
https://na2.salesforce.com/servlet/networks/session/create?site=0DM400000003deffa&refURL=[some ref url]

That correctly redirects internal users to the SF CRM login screen. I guess this link is machine-generated since it works without modification in both sandbox and production instances. How can I programmaticaly create such URL? Thanks

 
              



 
Hello,

I am currently in the process of overriding the native Community login flow of SalesForce with our own custom-made. The custom login flow for Community users (external to our organization) works fine but of course our internal users, if they want to access the community, cannot use the same flow since they need to go to login.salesforce.com (or any othe rinstance URL such as https://na2.salesforce.com), enter their credentials to login to the CRM org and then access the community from there.

Therefore in the login screen for the Community, besides the form to enter the credentials for Communtiy external users, I would like to add a link that redirects our internal users to the CRM login page and still keeping track of the Community URL they were browsing when they were prompted to login.

In order to achieve this, I added the folliwing span element to the SiteLogin component:
<span>Our internal Employee? Login <a href="{! EmployeeLoginURL }">here</a></span>
And in the SiteLoginController (that controls SiteLogin):
global PageReference EmployeeLoginURL {
        get
        {
            String startUrl = System.currentPageReference().getParameters().get('startURL');
            String sfBaseUrl = System.URL.getSalesforceBaseUrl().toExternalForm();
            
            return new PageReference(sfBaseUrl + '/login?' + startURL);
        }
    }
This code does not work for the following reasons:
  1. In some cases EmployeeLoginURL is the base URL of our Community instead of our CRM instance
  2. In some cases EmployeeLoginURL is treated as a relative path and added to the root path of the communityand generates a page not found error;
  3. The login parameter is (indeed) not a valid one.
In some other SF Community, I noticed that in the login screen they have the same fucntionality I am looking for and the displayed link is in the format:
https://na2.salesforce.com/servlet/networks/session/create?site=0DM400000003deffa&refURL=[some ref url]

That correctly redirects internal users to the SF CRM login screen. I guess this link is machine-generated since it works without modification in both sandbox and production instances. How can I programmaticaly create such URL? Thanks

 
              



 
We display inside a tab in the Sales Console a custom object page layout with a custom Javascript button. Once the user clicks on that button, the custom code performs some operations on a Salesforce custom web service APEX class (by using the script connection.js) and based on the response, eventually opens a new tab in the console (by using the script integration.js). This functionality works fine.

When the system is busy working, not to let the user press the button twice or getting confused about the state of his request, we want to disable the button and display the waiting cursor. So we created the following code inside the button:

 
var btnService = document.getElementsByName("check_lead_contact");

btnService[0].value='Checking, please wait...';
btnService[0].disabled=true;
document.body.style.cursor = 'wait';

//JavaScript code calling APEX Webservice by using connection.js
//Javascript code opening new Sales Consoel tab using integration.js

document.body.style.cursor = 'default';
btnService[0].value='Check Lead/Contact';
btnService[0].disabled=false;

However this code does not work, the button does not get disabled and the cursor does not change to "wait". However, if I inspect the code with developer tools, I see that in the console the state of the JS variables linked to both the button and the cursor change but such changes are not reflected in the UI. All the changes in the UI are made once the function ends and not the state variable change, as it is supposed to be, most likely because the call to the webservice somehow make the function hangs.  
 
We asked help to SF support that replied to us that they do not offer support for buttons containing references to either connection.js or integration.js, although they are included in official SF documentation. Does anybody know a way to solve this issue?
I have a Visualforce page correctly displayed in Sales Console as sub tab of Live Agent session and among other things I need to open a new sub tab when the user clicks a button of the VF page. So according to the documentation I created a button on my Visualforce page, I tight the Javascript funciton openNewSubTab to the onClick event and I placed the code to open an additional sub tab. The Javascript looks like this:
 
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript"> 

function openNewSubTab(){

console.log('Inside the main function');
sforce.console.getEnclosingPrimaryTabId(function(result) {
     console.log('Inside the new tab function');
     var primaryTabId = result.id;
     sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false, 'salesforce', null, null, null);
});

</script>

This code does not work. In the console I just see the output 'Inside the main function' but not the text placed inside the callback function of sforce.console.getEnclosingPrimaryTabId(). I also tried to declare the callback separately as indicated in the documentation (see below) but I cannot make it work. Am I missing something?
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript"> 

var openSubTab = function(result){
    console.log('Inside the new tab function');
     var primaryTabId = result.id;
     sforce.console.openSubtab(primaryTabId , 'http://www.salesforce.com', false, 'salesforce', null, null, null);
}

function openNewSubTab(){

console.log('Inside the main function');
sforce.console.getEnclosingPrimaryTabId(openSubTab);

</script>



 
I am struggling with signing an input with a key generated by using OpenSSL. My code is as follows:

string algorithmName = 'RSA-SHA1' //also tried with 'RSA'

String base64String = 'KBfW9103GQKknExCqOStSmczmNwDNF81yrF04AVvoVI=';
Blob privateKey = EncodingUtil.base64Decode(base64String);
Blob input = Blob.valueOf('12345qwerty');
            
Crypto.sign(algorithmName, input, privateKey);


The base64String is obtained with the command: openssl rand -base64 32

Everytime I run the code I get the following exception in the log:

"common.apex.runtime.impl.ExecutionException: Invalid Crypto Key"|0x4809a271

Does anybody have an idea what am I doing wrong? Thanks

 
Hello,

I am currently implementing in our SF Community a customized Login flow and the ForgotPassword functionality is part of that. In the ForgotPassword page I use an APEX inputText for the Username, an outputText for the custom Error message and a commandLink to submit the action request:
<div id="loginErrors" class="errors">
    <apex:outputText value="{!$Label.Communities_Login_WrongUsername}" rendered="{!isWrongUsername}"/>
</div>                      
<apex:inputText id="username" value="{!username}" html-placeholder="Username"/>                        
<apex:commandLink id="submit" value="SUBMIT" action="{!forgotPassword}"/>
The VF page is bind to the ForgotPasswordController:
public PageReference forgotPassword() 
{
    PageReference result;
  		
    boolean success = Site.forgotPassword(username);

    PageReference pr = Page.ForgotPasswordConfirm;
    pr.setRedirect(true);
		  		
    if (success) 
    {  			
	    result = pr;
    }
    else
    {
	    isWrongUsername = true;
    }
    return result;
}
My assumption was that in case the username is not found, the Site.ForgotPassword(username) function would return success = false and therefore I give to the user the same page after setting the IsWrongUsername to true, in order to show the error message.

Apparently my reasoning is not correct since Salesforce documentation (here (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm#apex_System_Site_forgotPassword)) states:
The return value (of ForgotPassword) will always be true unless it’s called outside of a Visualforce page. If it's called outside of a Visualforce page, it will be false.

This statement also explains why my Test Methods always fail (not called from a VisualForce page but from a test class, always success = false).
I find this implementation of the Site.ForgotPassword really weird and I would like to know whether I am somehow making a mistake or there is an alternative way to implement this functionality by using the Site.ForgtoPassword site. 











 
I want to build my own custom <knowledge:articleList> container, but I can't seem to get it working.

My Configuration:
The DataCategoryGroup is called: Knowledge_Base
The DataCategory is: testCategory
I have 10 articles in Knowledge_Base:testCategory

My VisualForce Page with the standard <knowledge:articleList> container (see below) will show the list of 10 Articles:
<apex:page>
    <apex:pageBlock title="My Searchresults">
        <knowledge:articleList articleVar="article" categories="Knowledge_Base:testCategory" hasMoreVar="false" pageSize="10">
            <apex:outputLink value="{!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink><br/>
            <small>{!article.lastModifiedDate},{!article.Id}</small>
            <hr/>
        </knowledge:articleList>
    </apex:pageBlock>
</apex:page>

When I try to build it with a custom Apex Class and VisualForce Page (see below) it will not work.

APEX CLASS:
public class cc_debug_search {
    public List<KnowledgeArticleVersion> getSearchResults(){ 
        String qryString = 'SELECT Id, title, UrlName, LastPublishedDate,LastModifiedById, KnowledgeArticleId FROM KnowledgeArticleVersion WHERE (PublishStatus = \'online\' and Language = \'en_US\')';
        List<KnowledgeArticleVersion> articleList= Database.query(qryString);
        return articleList;
    }
}
  

VISUALFORCE PAGE:
<apex:page controller="cc_debug_search">
    <apex:pageBlock title="My Custom Searchresults">
        <apex:repeat value="{!SearchResults}" var="article">
            <apex:outputLink value="{!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink><br/>
            <small>{!article.lastModifiedDate},{!article.Id}</small>
            <hr/>
        </apex:repeat>
    </apex:pageBlock>
    </apex:page>
  

This will return the error message:
Unable to Access Page
The value of a parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.



MY ANALYSIS:

It goos wrong on the {!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])} part. 
It seems the returned Id is wrong. I also tried to replace it with:

 - {!URLFOR($Action.KnowledgeArticle.View, article.KnowledgeArticleId,['popup' = 'true'])}
 - {!URLFOR($Action.KnowledgeArticle.View, LEFT(article.Id,15),['popup' = 'true'])}  to get a 15 char ID
 - {!URLFOR($Action.KnowledgeArticle.View, LEFT(article.KnowledgeArticleId,15),['popup' = 'true'])}  to get a 15 char ID

All without result...

Can anyone help me with this?
Hello,

I am currently in the process of overriding the native Community login flow of SalesForce with our own custom-made. The custom login flow for Community users (external to our organization) works fine but of course our internal users, if they want to access the community, cannot use the same flow since they need to go to login.salesforce.com (or any othe rinstance URL such as https://na2.salesforce.com), enter their credentials to login to the CRM org and then access the community from there.

Therefore in the login screen for the Community, besides the form to enter the credentials for Communtiy external users, I would like to add a link that redirects our internal users to the CRM login page and still keeping track of the Community URL they were browsing when they were prompted to login.

In order to achieve this, I added the folliwing span element to the SiteLogin component:
<span>Our internal Employee? Login <a href="{! EmployeeLoginURL }">here</a></span>
And in the SiteLoginController (that controls SiteLogin):
global PageReference EmployeeLoginURL {
        get
        {
            String startUrl = System.currentPageReference().getParameters().get('startURL');
            String sfBaseUrl = System.URL.getSalesforceBaseUrl().toExternalForm();
            
            return new PageReference(sfBaseUrl + '/login?' + startURL);
        }
    }
This code does not work for the following reasons:
  1. In some cases EmployeeLoginURL is the base URL of our Community instead of our CRM instance
  2. In some cases EmployeeLoginURL is treated as a relative path and added to the root path of the communityand generates a page not found error;
  3. The login parameter is (indeed) not a valid one.
In some other SF Community, I noticed that in the login screen they have the same fucntionality I am looking for and the displayed link is in the format:
https://na2.salesforce.com/servlet/networks/session/create?site=0DM400000003deffa&refURL=[some ref url]

That correctly redirects internal users to the SF CRM login screen. I guess this link is machine-generated since it works without modification in both sandbox and production instances. How can I programmaticaly create such URL? Thanks

 
              



 
I want to build my own custom <knowledge:articleList> container, but I can't seem to get it working.

My Configuration:
The DataCategoryGroup is called: Knowledge_Base
The DataCategory is: testCategory
I have 10 articles in Knowledge_Base:testCategory

My VisualForce Page with the standard <knowledge:articleList> container (see below) will show the list of 10 Articles:
<apex:page>
    <apex:pageBlock title="My Searchresults">
        <knowledge:articleList articleVar="article" categories="Knowledge_Base:testCategory" hasMoreVar="false" pageSize="10">
            <apex:outputLink value="{!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink><br/>
            <small>{!article.lastModifiedDate},{!article.Id}</small>
            <hr/>
        </knowledge:articleList>
    </apex:pageBlock>
</apex:page>

When I try to build it with a custom Apex Class and VisualForce Page (see below) it will not work.

APEX CLASS:
public class cc_debug_search {
    public List<KnowledgeArticleVersion> getSearchResults(){ 
        String qryString = 'SELECT Id, title, UrlName, LastPublishedDate,LastModifiedById, KnowledgeArticleId FROM KnowledgeArticleVersion WHERE (PublishStatus = \'online\' and Language = \'en_US\')';
        List<KnowledgeArticleVersion> articleList= Database.query(qryString);
        return articleList;
    }
}
  

VISUALFORCE PAGE:
<apex:page controller="cc_debug_search">
    <apex:pageBlock title="My Custom Searchresults">
        <apex:repeat value="{!SearchResults}" var="article">
            <apex:outputLink value="{!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink><br/>
            <small>{!article.lastModifiedDate},{!article.Id}</small>
            <hr/>
        </apex:repeat>
    </apex:pageBlock>
    </apex:page>
  

This will return the error message:
Unable to Access Page
The value of a parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.



MY ANALYSIS:

It goos wrong on the {!URLFOR($Action.KnowledgeArticle.View, article.id,['popup' = 'true'])} part. 
It seems the returned Id is wrong. I also tried to replace it with:

 - {!URLFOR($Action.KnowledgeArticle.View, article.KnowledgeArticleId,['popup' = 'true'])}
 - {!URLFOR($Action.KnowledgeArticle.View, LEFT(article.Id,15),['popup' = 'true'])}  to get a 15 char ID
 - {!URLFOR($Action.KnowledgeArticle.View, LEFT(article.KnowledgeArticleId,15),['popup' = 'true'])}  to get a 15 char ID

All without result...

Can anyone help me with this?