• 2844 Points
  • Member since 

  • Chatter
  • 83
    Best Answers
  • 0
    Likes Received
  • 5
    Likes Given
  • 0
  • 1793
Code here
<apex:page > <apex:form >
<html> <head>
<apex:stylesheet value="{!URLFOR($Resource.jqueryMenu, 'styles.css')}"/>
<body >
<h1>CSS3 Minimalistic Navigation Menu</h1>
<div id="main"> <ul id="navigationMenu"> <li> <a class="home" href="#"> <span>Home</span> </a> </li> <li> <a class="about" href="#"> <span>About</span> </a> </li> <li> <a class="services" href="#"> <span>Services</span> </a> </li> <li> <a class="portfolio" href="#"> <span>Portfolio</span> </a> </li> <li> <a class="contact" href="#"> <span>Contact us</span> </a> </li> </ul> </div> </body> </html> </apex:form> </apex:page>

I am trying to use a nested repeat in an apex:map, but as soon as I try I get an error "<apex:repeat> cannot be used inside <apex:map> in the markup.

Here is the page:
<apex:page Controller="TestMapController" >
    <apex:map id="visitsMap" width="100%" height="800px" mapType="roadmap" center="Dublin, Ireland">  
         <apex:repeat value="{!Addresses}" var="address">
            <apex:repeat value="{!Addresses}" var="subaddress">
                <apex:mapMarker title="{!address}" position="{!address}">

and the controller is:
public class TestMapController
    public String[] getAddresses()
        return new String[]{'120 Drumcondra Road, Dublin 9','3 Corbawn Court, Dublin 18','35 Cremore Cresent, Dublin 11'};

can anyone see what I am doing wrong?
Could anyone help in customizing serach layout in salesforce1
I have a MAC with java 1.8 installed.  I can successfully install eclipse (I've tried Juno and Keepler), but everytime I try to install the force.com plugin, - it acts like it installs, but I can never find a force.com perspective. 

Any suggestions?  Do I have to goto Java 1.7?

Hi, I'm trying to Enable Filter-Based Opportunity Territory Assignment for Enterprise Territory Management.Part of the setup is:
'If your organization is using the Apex code Salesforce provides, first create the class and then return to this Settings page and enter the class name: OppTerrAssignDefaultLogicFilter. If you opt to use your own code for the Apex class, you’ll come back and enter the name of the class that you create.

However I can't find any other information related to the 'OppTerrAssignDefaultLogicFilter' class anywhere. Has anyone come across this apex class and if so can they share it?
We want to develop a customer app using communities, but this app needs to access features from de device, like gps, camera, etc. I recently discover that I need to use the mobile sdk to access the communities, right now I can´t understand the licenses model and the features access, can anyone help me?
Hi all,

I need to redirect some users (all with the same profile) to a Force.com Site that I already developed.
I create a login flow with the variable "LoginFlow_FinishLocation" set to the Site URL.
This works all fine.

My trouble is that I want redirect directly, without oblige users click on the "Finish" button.

Can someone please help me?

Thanks in advance.
Has anyone been able to get Batch Apex to work to merge Duplicate contacts? If so, It would great if you could share how.



I am newbie on salesforce. My project entails, 
1) Build a salesforce app, that forms the data base to store customer data.
2) Build an IOS App that can write on to the salesforce database and read data from it.

I have the following questions and it would be of great help to get started.
1) How do I create a customer log-in? Should I create a community for the customer and then assign a Salesforce App to them? Is this the correct way?
2) What is the difference between a connected salesforce app and a regular app.

Thanks in advance
  • April 12, 2015
  • Like
  • 0
Hello Helper

I  created a simple webservice which  edits  account records  
I want  to give access tu user  to this webservice in non autentificate mode throught Site

I read some article  and I sew that this is possible.
I created a site
I  added my webservice class  to the site user  profile

Hovewer when i opened the Public access settings  I noticed that is NOT  possible to give EDIT  permission for the account object

Ca anybody  comment on this?
Would itr be possible  to  edit an account  with a webservice exposed in Site?

Thanks in advance

  • April 12, 2015
  • Like
  • 0
Hi there,
I'm not a developer but I'm trying to track down our API Key for a webmaster who needs it to integrate our SF instance into their current web to lead form system.  Can someone tell me where to find this?
Thanks in advance,
Struggling, Aud
The example test case in Making an Asynchronous Callout from an Imported WSDL (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_continuation_callout_soap.htm) doesn't work in practice.

Attempting to run tests using the pattern defined under Testing WSDL-Based Asynchronous Callouts gives the error:

<span unselectable="on" "="" style="display: block; padding: 3px 4px; overflow: hidden; margin-left: 0px; color: rgb(34, 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal; white-space: nowrap; background-color: rgb(218, 240, 249);">
Methods defined as TestMethod do not support Web service callouts, test skipped

Attempting to use Test.setMock(WebServiceMock.class, xyz); doesn't work as the respose Map<String, Object> parameter is null. Without populating the mock response you get a GACK:
Internal Salesforce Error: 104340792-768952 (-1841369010) (-1841369010)

There is a complete example using a basic WSDL in Asynchronous Callout from an Imported WSDL (http://salesforce.stackexchange.com/q/70259/102)
I created a Visualforce page that includes a dashbaord I'd like dispayed on our homepage. I think I'm running to an problem with the HTML code but I'm not sure.  Everything looks like it's set up properly.

The Visualforce Page I created is named "Homepage_Dashboard".  I selected HTML when settng up the new dashboard component and used the code:

<iframe src="/apex/Homepage_Dashboard" frameborder="0" height="1000px" width="100%"></iframe>

When I assign the page, the only thing that's displayed is the code.  No dashboard.

I switched the component to a Visualforce Area and it worked.  I'd rather use HTML area though because it shows only the dashboard and no title, plus using HTML allows me to add more than one dashboard to the homepage if I choose to do so.  Any ideas why it's not working in HTML?
Starting this morning, a number of our web service callouts started failing with an "Unexpected end of file from server" error.  I would say about 1 in 3 web service callouts fail with this error, while the others complete successfully.  We have not made any recent changes to our code, nor to the web services being called.

In running wireshark traces, we found the below error messages.  Has anyone experienced this before or have any thoughts on the cause/solution?

TLS alert error messages
Alert message 21 – decryption failed Reserved (21).
Hi All, 

I am wondeirng if it is possible to have the Live Agent chat window be in div on a web page rather than a pop-up. I would like to be able to keep my users on the site if they are on a mobile device.


Hi All,

We are trying to integrate Salesforce to Sendinblue and the error we are getting in HTTP call out is

17:16:54.045 (45234499)|USER_DEBUG|[23]|DEBUG|System.HttpRequest[Endpoint=https://api.sendinblue.com/v2.0/campaign/1, Method=GET]
17:16:54.045 (45241415)|SYSTEM_METHOD_EXIT|[23]|System.debug(ANY)
17:16:54.045 (45245388)|STATEMENT_EXECUTE|[24]
17:16:54.045 (45263829)|VARIABLE_SCOPE_BEGIN|[24]|http|System.Http|true|false
17:16:54.045 (45474869)|VARIABLE_ASSIGNMENT|[24]|http|"System.Http[]"|0x1b19bfb3
17:16:54.045 (45482896)|STATEMENT_EXECUTE|[25]
17:16:54.045 (45502186)|SYSTEM_METHOD_ENTRY|[25]|System.Http.send(ANY)
17:16:54.045 (45567511)|CALLOUT_REQUEST|[25]|System.HttpRequest[Endpoint=https://api.sendinblue.com/v2.0/campaign/1, Method=GET]
17:16:54.313 (313305474)|EXCEPTION_THROWN|[25]|System.CalloutException: java.lang.RuntimeException: Could not generate DH keypair

Sendinblue support team asked us for JAVA version that APEX uses as this issue is accouring with JAVA version 7 and above.


Is it be possible to check the Java version used by APEX and Eclipse. As per our technical team's understanding the issue is with Java version 7 onwards.

Please check the links below for further informations.


Sendinblue Team"

Can some one please help me with the information ASAP . Or is it something that we are doing wrong from coding end ?

Following is the code.

Thanks a lot.

public with sharing class MySforceHttpCallOut {

String endPoint = 'https://api.sendinblue.com/v2.0/campaign/1' ;

public void fetchDataFromRemote(){
public void performAction(String method){

             HttpRequest req = new HttpRequest();
             req.setHeader('api-key', 'GAVE MY API KEY HERE');
             req.setHeader('Content-Type', 'application/json');

             Http http = new Http();
             HTTPResponse res = http.send(req);   -> Failing HERE
            System.debug( res.getBody());
             Map<String,String> responseMap =   (Map<String,String>)JSON.deSerialize(res.getBody(),Map<String,String>.class);

After setting up Duplicate Management, did a test from a standard edit page which worked perfectly displaying error message as well as duplicate records but when tested from Visualforce page only error message "You're creating a duplicate record. We recommend you use an existing record instead." was displayed but no duplicate records. Did anyone face the same issue or is it a limitation ?
Hey ,
I am SFDC developer i want to mapp a Account object field with the SAP XYZ Object which act same as Account object in SF ??
SF has Account , so what SAP have for the same ????

I'm trying to query the Validation Status of a Knowledge Article Version, but even though it is documented here as a field, and my query seems correct, the error returning is that the ValidationStatus field does not exist in the sObject.

Select Id, Title, PublishStatus, OwnerId From FSBs__kav Where PublishStatus = 'Draft' AND ValidationStatus = 'WIP'
Where PublishStatus = 'Draft' AND ValidationStatus = 'WIP'
ERROR at Row:1:Column:91
No such column 'ValidationStatus' on entity 'FSBs__kav'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

The documentation for the KnowledgeArticleVersion says I'm using this right, but for some reason it's not working. Any ideas? I am testing my query with Force.com explorer 0.58A.
Hello Everyone, 
                       I am currently facing issues with boot strapping in Microsoft edge browser, the visualforce pages developed is perfectly working on all the browsers except with Edge. The styling and words are overlapping and looks weird. We are currently stuck on this part. I also added Meta tags as per posts and suggestions made on Salesforce stack exchange in the code as
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

But still no luck favoured.The error is stated as above

Looking forward for some suggestions.

<!-- This is the code for reference. -->
<apex:page showHeader="false" sidebar="false" controller="CarolinasLoginController">
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Login to AAA.com</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="{!URLFOR($Resource.NewPageResources,'NewPageResources/patterns.css')}"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="{!URLFOR($Resource.NewPageResources,'NewPageResources/components.min.js')}"></script>
    <script src="{!URLFOR($Resource.NewPageResources,'NewPageResources/zxcvbn.js')}"></script>

            background-position: 4px 10px;
            list-style-type: none;
            background-size: 20px;
            padding: 10px;
            border:1px solid #cf7a7f;
            line-height: normal;
.legend {
    display: block;
    width: 110%;
    padding: 20px 0;
    margin-bottom: 20px;
    margin-left: -5%;
    font-size: 18px;
    border-bottom: 1px solid #BBB;
    text-align: center;
    color: #00338D;
.header {
    width: 100%;
    background: #fff;
    position: relative;
    padding: 10px;

.header-ph {
    position: absolute;
    right: 5%;
    top: 20%;
    text-decoration: none;
    color: #00338d;
    max-width: 70px;
    margin: 10px auto 10px 5%;
.btn.loginBtn, .btn.loginBtn:hover {
            border: 1px solid #D52b1E;
            border-radius: 5px;
            margin-bottom: 10px;
            padding: 10px;
            width: 100%; 
            min-width: 145px;
            transition: all 0.3s;
            text-decoration: none;
            line-height: 1;
        background: none repeat scroll 0 0 #000;
        height: 100%;
        left: 0;
        opacity: 0.5;
        position: absolute;
        top: 0;
        width: 100%;
.block-button { width: 100%; }
a { color: #00338d; line-height: 1.4em; text-decoration: none;}
.floatright { float: right; }
.create { margin: 10px 0;}

#passtoggle {
display: block;
font-size: 12px;
line-height: 1.4em;
position: absolute;
bottom: 10px;
right: 10px;
font-weight: bold;
color: #00338d;
cursor: pointer;

.message.errorM3 {
            background-position: 10px 10px;
            background-repeat: no-repeat;
            border:1px solid #cf7a7f;
            background-position: 4px 10px;
            list-style-type: none;
            background-size: 20px;
            padding: 10px;
            border:1px solid #cf7a7f;
.errorMsg li{
            font-size: 14px;
            margin-bottom: 5px;
            background-size: 20px;
            padding: 10px;
            line-height: 15px;
.message .messageTable .msgIcon, .message .messageTable h4{
        .message .messageTable li{
        .message .messageTable ul{
            margin: -25px 0 0 !important;
        .message .messageText {
            margin-left: 24px;
            margin-top: 10px;
            border: 1px solid #E6E7E8;
            border-radius: 5px;
            margin-bottom: 10px;
            padding: 10px;
            width: 100%;



<div class="page">
<div class="header">    
<a href="tel:+18774866796" class="header-ph">1-877-486-6796</a>
<h1 class="logoContainer">
           <apex:outputLink value="http://test.carolinas.aaa.com/"> <apex:image url="{!URLFOR($Resource.NewPageResources,'NewPageResources/logo.png')}"/></apex:outputLink>

<div class="form-wrapper">



    <div class="legend">Login to AAA Carolinas</div>
    <div class="loader-img">
            <apex:actionStatus id="loadingProgress">  
                     <apex:facet name="start"> 
                         <div class="loadingblock"></div>
  <apex:form >
  <div class="field">
              <apex:inputText styleClass="inputBox"  id="email" value="{!customerEmailAddress}" html-placeholder="Email "/>

   <div class="field">
                <apex:inputSecret styleClass="inputBox" id="password" value="{!customerPassword}" html-placeholder="Password"/>

       <span id="passtoggle">SHOW</span>
    <apex:commandButton value="Log In" styleClass="loginBtn" id="submit" status="loadingProgress" action="{!loginAAACommunityUser}"/>
    <apex:messages id="error" styleClass="errorMsg"/>
    <apex:outputPanel id="errorM" rendered="{!isValid}"  >
      <p style="color:#ce3827" >We’re sorry, we couldnt find an account for this email address. Would you like to <a href="https://digital01-aaa-digital01.cs50.force.com/MyAAA/CreateAnAccount"> Create an account</a> for free!</p>
     <apex:outputPanel id="doCounter1" rendered="{!doCounter1}"  >
      <p style="color:#ce3827" >The password you entered is incorrect. Need to <a href="https://digital01-aaa-digital01.cs50.force.com/MyAAA/ResetCommunityPasswordAAA"> recover your password?</a></p>
     <apex:outputPanel id="doCounter2" rendered="{!doCounter2}"  >
      <p style="color:#ce3827" >The password you entered is incorrect. This account will be locked after 3 more failed attempts.Need to <a href="https://digital01-aaa-digital01.cs50.force.com/MyAAA/ResetCommunityPasswordAAA"> recover your password?</a></p>
     <apex:outputPanel id="doCounter3" rendered="{!doCounter3}"  >
      <p style="color:#ce3827" >The password you entered is incorrect. This account will be locked after 2 more failed attempts.Need to  <a href="https://digital01-aaa-digital01.cs50.force.com/MyAAA/ResetCommunityPasswordAAA"> recover your password?</a></p>
     <apex:outputPanel id="doCounter4" rendered="{!doCounter4}"  >
      <p style="color:#ce3827" >The password you entered is incorrect. This account will be locked after 1 more failed attempts.Need to <a href="https://digital01-aaa-digital01.cs50.force.com/MyAAA/ResetCommunityPasswordAAA"> recover your password?</a></p>



    <div class="create">
        <apex:outputLink value="{!$Page.CreateAnAccount}" id="createAccount">Create an Account</apex:outputLink>
        <apex:outputLink styleClass="floatright"  value="{!$Page.ResetCommunityPasswordAAA}" id="forgotPassword">Forgot your Password?</apex:outputLink>
    <div class="legend"> </div>
    <apex:outputLink value="{!$Page.LoginRenew}" id="LoginRenew">I'm a AAA member but i don't know my login information</apex:outputLink>



      $(document).ready(function() {

        var show = 1;
        $("#passtoggle").click( function() {
          $this = $(this);

          if (show == 1 ){
          $("[id$='password']").attr("type", "text");
          show = 0;
          } else {
            $("[id$='password']").attr("type", "password");
            show = 1;

I am in the process of developing a lightning component but I have been running into issues when using the lighting app builder.

When navigating to People Tab > My User > Edit Page, I receive this error:

User-added image

As you can see, an error has happened during load. Notice that the error is behind the loading <div> rendering it unclickable.

I thought that this was an error in my own code. I deleted all lightning code from my org and tried again:

User-added image

I received this error in the console:
User-added image

In the first picture of this post, I was able to remove the loading box by deleting <div class="auraMsgBox auraLoadingBox" id="auraLoadingBox"></div> from the dom. Behind it was this error:

Uncaught error in umps|NA16$00Dj0000000KmGP_005j0000000S88z_02_7bc8b1ef-5370-411e-8ba8-673ec79653ca|0| : Converting circular structure to JSON

Has anyone seen this before or know of a fix/workaround?
i have created custom emp create page and emp list page. my criteria is  whenever i m creating new record and then save, it will go to custom list page.how to write the code to navigate from create page to list page.
Can we create the test class of the Lead controller that uses the REST api for Request url like this:


global with sharing class REST_ChargeNT_Controller {
    global static String processPayment(String orderId){
I need to update regularly a field value. 
How to run this action daily ? 
I do not find any scheduler.

Many thanks
Hello All.

In Sf id connect. I am trying to map 2 fields together. In active directory. I want the "Email" field to point to two different fields in SF which are "username" and "Email field" so whenever I rename the email field in active directory. I want it to update both the email and username field in SF.

This seems to work in every other field apart from the username one.
Yesterday I refreshed the Sandbox and since then the Developer Console no longer works properly:
- The "Problems" tab is always empty, even if I make a deliberate syntax error.
- Ctrl-S changes the current editing tab name to "Saving: ..." but it stay like that forever. If I close and reopen the Developer Console, the changes are often saved. I guess they are only saved if there were no syntax erros, but I can't tell because the Problems tab won't show any information.
- When I run a unit test, the new test is not added to the Tests tab. If I restart the Developer Console, I can see that a new Test run was added. However, the status of the test is not updated. I have to close and reopen Dev Console to see if the test completed. I shouldn't have to restart the Console after every step.

If I log in with another administrator's credentials, the problem persists.
If I open the Dev Console from another PC, the problem persists.

In Production I cannot make changes to classes or triggers of course, but if I run a unit test, the test appears immediately like it should. So there is a serious refresh issue in my Sanbox Developer Console. I figured it's a sandbox fluke that would disappear after I re-refresh the sandbox. but that was wishful thinking :(
This morning I refreshed the Sandbox again, and the same problem persists. It's close to impossible to continue any development!

Has anyone encountered this problem before?
Any ideas what I might try next?

p.s. I already raised it with Salesforce Support, but they said it's a development isuue, and asked me to sumbit it in this forum.
Hi All,

While calling webservice I am setting following xml request as body
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soap:Body><GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/"><listName>FPInventoryTest</listName></GetList></soap:Body></soap:Envelope>

In response, I am getting following error messege 

Response**:<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---&gt; Root element is missing.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>

Please help me sort this out.

Thank You!
Hi all, i have a requirement..
I have created two records types "Small" and "big" on opportunity object. now the requirement is :
Big opportunity should have a button ‘Close’ which when clicked should update the stage to closed won and make the opportunity read only(None of the fields should be editable)

I am looking for global overview of how can i implement SSO with Salesforce.

I want some inetration between Open AM, SSO, Active directory.

Hi, i am new to salesforce. I am trying to create page in Site.com. in which there is one block which is for entering username and password. I want that to be used as community login. So when user enters username and password he can be authinticated and directly redirected to community(bypassing standard salesfroce community login page). How can we do that?? any help?

Hi All,

What would be the process of creating a SSO like connection using Salesforce credentials to access a secure webpage? What would I need to set something like this up? Do I need a SAML server for this? How could I use Delegated Authentication?

Thanks in advance.
The documentation for deleting custom objects implies that no field name can be specified for the key. I understand that the key field must be unique but I've defined a unique, no duplicates, index field and would like to use that. 

Someone else has mentioned that its necessary to query on my key, get tha object back, extract its system defined key and issue a delete on that key's value.

This strikes me as wasteful and cumbersome so can anyone confirm or shed more light on this please?

Is it possible to get metrics to track how many hits a link has gotten or is getting?  Every 2 weeks we replace a communication piece under the Custom Link section for workers to access, it would be great to know how many times the document has been opened.

Note, there is the idea on the Salesforce site for this (posted 6 years ago): https://success.salesforce.com/ideaView?id=08730000000Brd7AAC
Hi SD,

I am not able access a desktop icon Salesforce files. Intially I am able to access the Salesforce files at first time and able to enter credentials sucessfully. Now I want to chage the credentials and logon with the different credentials, but it is not opening to sign with different credentials

When I double click on that icon, it is coming in system tray (show hidden icons) and then become invisible immediately in the system tray.
Hi All,

I am getting this error on call out to the external database. Im sending data to external databse, Please help getting below error in debug log.
System.HttpResponse[Status=Bad Request, StatusCode=400]

Attached portion of code below:-
public class WebServiceCallout {

    @future (callout=true)
    public static void sendNotification(string Id,string Email,string First_Name,string Last_Name,string phone,string Title,string Account_name,string con_status) {
conweb cont=new conweb(Id,Email,First_Name,Last_Name,Phone,Title,Account_name,con_status);
list<conweb> conwebs=new list<conweb>();
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
req.setTimeout(2000); // timeout in milliseconds
   try {
                res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);

Please help. 


Hi all,

I have a question.
I am using enhanced list for my custom object. Now i want to insert look-up filter for my cutom object. Beside of "create new view" Is it possible?

User-added image
Hi All,

I have been asked to customize the login screen of our community portal. As a part of this I need to implement the checkbox feature "Remember Username" as well. Any one knew about this ? could you please explain the work around or the possibilities.

  • September 02, 2015
  • Like
  • 0

Can I add a javascript button to an enhanced list view to process multiple selections? Ideally, I'd like for those selections to transferred to another object. 

I tried creating a wrapper class, but I am not experieced enough. 

Many thanks. 

Hello everyone, I'm just reporting that I failed the challenge for the above mentioned section even though I set up the compact layout differently, though appropriately per the instructions. 

The compact layout is one of the things you can set up as you run through "Salesforce1 Setup" from the top of the navigation in the setup page. 
This automatically sets the API reference to 'PhoneandEmail' instead of 'Phone_and_Email', which will cause you to fail the challenge even if you meet the criteria.

The current instructions don't mention the API name, but it seems like that's what the system checks for. Just letting you know!


public class yourClassForHistories
    public Id caseId {get; set;}
    public List<HistoryDetailClass> histories;
    // Variables
    public Static final Map<String, Schema.SObjectField> CaseFieldmap = Schema.SObjectType.Request__c.fields.getMap();
    public Static final List<Schema.PicklistEntry> fieldPicklistValues = Request__History.Field.getDescribe().getPicklistValues();

    public List<HistoryDetailClass> getHistories()
        histories = new List<HistoryDetailClass>();
        List<Request__c> // Your Query
        list<Request__History>  // Your Query

        for(Request__History nowHistory : your List){
            GenericHistoryClass cHistory = new GenericHistoryClass();
            cHistory.createdById = nowHistory.CreatedBy.Id;
            cHistory.createdByName = nowHistory.CreatedBy.Name;
            cHistory.createdDate = nowHistory.CreatedDate;
            cHistory.field = nowHistory.Field;
            cHistory.id = nowHistory.Id;
            cHistory.newValue = String.valueOf(nowHistory.newValue);
            cHistory.oldValue = String.valueOf(nowHistory.oldValue);
            cHistory.parentId = nowHistory.ParentID;

            HistoryDetailClass tempHistory = new HistoryDetailClass();
            tempHistory = createHistoryEntry(cHistory);

            // Add to the list
            if(tempHistory != null){

        return histories;

    //Function to populate a temporary history record
    public HistoryDetailClass createHistoryEntry(GenericHistoryClass cHistory){
        HistoryDetailClass tempHistory = new HistoryDetailClass();
        String prevDate = '';

        if((cHistory.newValue == null && cHistory.oldValue == null)
                || (cHistory.newValue != null && !(string.valueOf(cHistory.newValue).startsWith('a0t') || string.valueOf(cHistory.newValue).startsWith('00G') ||
                    string.valueOf(cHistory.newValue).startsWith('005f') || string.valueOf(cHistory.newValue).startsWith('005e') ||
                || (cHistory.oldValue != null && !(string.valueOf(cHistory.oldValue).startsWith('a0t') || string.valueOf(cHistory.oldValue).startsWith('00G') ||
                    string.valueOf(cHistory.oldValue).startsWith('005f') || string.valueOf(cHistory.oldValue).startsWith('005e') ||
                // Set the Date and who performed the action
                if(String.valueOf(cHistory.createdDate) != prevDate)
                    tempHistory.theDate = String.valueOf(cHistory.createdDate);
                    tempHistory.who = cHistory.createdByName;
                    tempHistory.userId = cHistory.createdById;
                    tempHistory.theDate = '';
                    tempHistory.who = '';
                    tempHistory.userId = cHistory.createdById;
                prevDate = String.valueOf(cHistory.createdDate);

                // Get the field label
                String fieldLabel = YouClassForHistories.returnFieldLabel(cHistory.field);

                // Set the Action value
                if (String.valueOf(cHistory.field) == 'created')
                    // on Creation
                    tempHistory.action = 'Created.';
                else if(cHistory.oldValue != null && cHistory.newValue == null)
                    // when deleting a value from a field
                    // Format the Date and if there's an error, catch it and re
                    try {
                        tempHistory.action = 'Deleted ' + Date.valueOf(cHistory.oldValue).format() + ' in <b>' + fieldLabel + '</b>.';
                    catch (Exception e)
                        tempHistory.action = 'Deleted ' + String.valueOf(cHistory.oldValue) + ' in <b>' + fieldLabel + '</b>.';
                    // all other scenarios
                    String fromText = '';
                    if (cHistory.oldValue != null)
                        try {
                            fromText = ' from ' + Date.valueOf(cHistory.oldValue).format();
                        catch (Exception e)
                            fromText = ' from ' + String.valueOf(cHistory.oldValue);

                    String toText = '';
                    if (cHistory.NewValue != null)
                        try {
                            toText = Date.valueOf(cHistory.newValue).format();
                        catch (Exception e)
                            toText = String.valueOf(cHistory.newValue);

                    if(toText != '')
                        tempHistory.action = 'Changed <b>' + fieldLabel + '</b>' + fromText + ' to <b>' + toText + '</b>.';
                        tempHistory.action = 'Changed <b>' + fieldLabel;


                String fieldValue=cHistory.field.replaceAll('__c','');
                fieldValue=fieldValue.replaceAll('_',' ');


            return tempHistory;


    // Function to return Field Label of a Case field given a Field API name
    public Static String returnFieldLabel(String fieldName)
        return yourClassForHistories.CaseFieldmap.get(fieldName).getDescribe().getLabel();
            for(Schema.PicklistEntry pickList : fieldPicklistValues)
                if(pickList.getValue() == fieldName)
                    if(pickList.getLabel() != null){
                        return pickList.getLabel();
                        return pickList.getValue();
        return '';

    // Inner Class to store the detail of the case history
    public class HistoryDetailClass implements Comparable{
        public String theDate {get; set;}
        public String who {get; set;}
        public Id userId {get; set;}
        public String action {get; set;}
        public String field{get; set;}
        public String OfferName{get; set;}

        public Integer compareTo(Object compareTo) {
            HistoryDetailClass compareToHistory = (HistoryDetailClass)compareTo;
            if (theDate == compareToHistory.theDate){
                return 0;
            if (theDate > compareToHistory.theDate){
                return -1;
            return 1;        

    //Generic Inner Class that replecates the History Object
    public class GenericHistoryClass{
        public Id createdById {get;set;}
        public String createdByName {get;set;}
        public Datetime createdDate {get;set;}
        public String field {get;set;}
        public Id id {get;set;}
        public boolean isDeleted {get;set;}
        public String newValue {get;set;}
        public String oldValue {get;set;}
        public Id parentId {get;set;}
        public String offerName {get;set;}

Rohit Alladi.

Please choose as best answer if you liked it !
  • July 20, 2015
  • Like
  • 2
In the 'Getting Started with APEX Triggers' (http://goo.gl/5YJ01q) module, an error message appears when attempting the first example/exercise. 
 The instructions read: 
  • 1. In the Developer Console, click File | New | Trigger. (The menu path is actually File | New | APEX Trigger).
  • 2. Enter helloWorldTrigger for the trigger name, and then select Account for the sObject. ClickSubmit. (stet)
When clicking submit in step 2, an error message appears: "The Trigger "HelloWorldTrigger " is not a legal name." The parenthesis around HelloWorldTrigger are not entered in step 2. 

Work Around:  
In Setup go Develop | Apex Triggers
Launch the Dev Console (DC) from setup UI. 
Removed previous text from within the Query Editor tab which contained an invalid query, and was promtping an error message itself.
Continued with set 2, above. 

I was able to save the new trigger in the Dev Console. I then deleted it, closed the DC, and repeated the steps from the Trailhead exercise (where the DC was launched from Name | Dev Console, not Setup | Develop). I was then able to save the trigger without error. 

Take Away: it may have been the erronous text in the query editor, when the DC was launched from Name | DC. Subsequently adding erronous text back into the query editor, and repeating set 2 above did not throw a naming error the second time.  
Hey everyone, 

the enterprise WSDL in the soap API exposes a well-known bug in the XmlSerializer in .NET.  Apparently MS has known about the bug since 2009 and has decided not to fix this.  You can read about it here on this link:  https://connect.microsoft.com/VisualStudio/feedback/details/471297

To work around this, I tweaked the WSDL with a dummy attribute.  Everyone that uses .NET with the Enterprise WSDL is going to hit this problem.  Hoping this helps.

<complexType name="ListViewRecord">
   <element name="columns" type="tns:ListViewRecordColumn" maxOccurs="unbounded"/>
  <xsd:attribute name="tmp" type="xsd:string" /> <!--Added by Chris Berg per bug found in XML Serializer-->
For anyone who may have faced the same task, here is a sample code for displaying filtered tasks and events to display in Account details.
As you may see, I've filtered the results via SOQL, you may extend the code to improve or anything else :)
I used a workaround for reading the events, because they are not readable via the 15 digits AccountId but with the 18 digit once. Crazy, but it works. All of you may correct me, if this may not be usable in future.

1) Add a apex class:
public with sharing class RelatedActivitesTest {
public List<Task> tasksLimited {get;set;}
public List<Event> eventsLimited {get;set;}
public List<Contact> conts {get;set;}
public RelatedActivitesTest(ApexPages.StandardController con){
conts = [SELECT id FROM Contact WHERE AccountId =:ApexPages.currentPage().getParameters().get('id')];
tasksLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid from task
where (
accountid=: ApexPages.currentPage().getParameters().get('id') or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
// Used convertID to get the external url repesantation of Account Id, which helps me getting all events. Internal Ids won't work somehow.
eventsLimited= [select id,activitydate,createdbyid,description,subject,whoid,type,ownerid,whatid FROM Event
WhatId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
AccountId =:convertID(ApexPages.currentPage().getParameters().get('id')) or
WhoId in :conts
) and
subject not in ('Rechnung per E-Mail','Rechnung erstellt','Box-Austausch erstellt','Support angelegt','Gutschrift erstellt','Lizenzdatei per E-Mail','Webroot-Lizenzzertifikat per E-Mail','Teilgutschrift erstellt','PreSales angelegt','Angebot per E-Mail')
order by activitydate desc limit 1000];
public static String convertID(String id){
if(id.length() == 18) return id;
String suffix = '';
for(Integer i=0;i<3;i++){
Integer flags = 0;
for(Integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);
if(c.compareTo('A') >= 0 && c.compareTo('Z') <= 0){
flags += 1 << j;
if (flags <= 25) {
suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);
}else suffix += '012345'.substring(flags-26,flags-26+1);
return id+suffix;

Create a visual force page:
<apex:page standardController="Account" extensions="RelatedActivitesTest" tabStyle="Account">
<apex:pageBlock title="Filtered Events">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!eventsLimited}" var="eventLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(eventLimited['id'])}">{!eventLimited.subject}</apex:outputLink>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(eventLimited.description, 150)}" />
<apex:column value="{!eventLimited.whoid}" headerValue="Member" />
<apex:column value="{!eventLimited.type}" headerValue="Type" />
<apex:column value="{!eventLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!eventLimited.ownerid}" headerValue="Assigned To" />
<apex:pageBlock title="Filtered Tasks">
<apex:outputPanel layout="block" style="overflow:auto;width:100%;height:200px">
<apex:dataTable value="{!tasksLimited}" var="taskLimited" cellpadding="4" bgcolor="white" rowClasses="even,odd">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!URLFOR(taskLimited['id'])}">{!taskLimited.subject}</apex:outputLink>
<apex:column headerValue="Description">
<apex:outputtext value="{!LEFT(taskLimited.description, 150)}" />
<apex:column value="{!taskLimited.whoid}" headerValue="Member" />
<apex:column value="{!taskLimited.type}" headerValue="Type" />
<apex:column value="{!taskLimited.activitydate}" headerValue="Activity Date" />
<apex:column value="{!taskLimited.ownerid}" headerValue="Assigned To" />

The visualforce page is connected to Account so you can add it to the Account view in your pagelayout.
If you want to change the filter, just change them to fit your needs.

Anyway, if you like my first post, give me a "like".

  • November 26, 2014
  • Like
  • 6
You can use this function to retrieve list view data from Salesforce via SOAP API.

Since this function is new, I couldn't find any useful resources on the internet. And PHP Toolkit 20.0 does not work with this new function.
Hence here goes my attempt and it works.

Sample code:
$ListViewOrderBy = new stdclass();	
$ListViewOrderBy->fieldNameOrPath = "Id";
$ListViewOrderBy->nullsPosition = "first";
$ListViewOrderBy->sortDirection = "ascending";		

$ExecuteListViewRequest = new stdclass();
$ExecuteListViewRequest->request = new stdclass();
$ExecuteListViewRequest->request->developerNameOrId = "Your ListViewID";	
$ExecuteListViewRequest->request->limit = 5000;	
//$ExecuteListViewRequest->request->offset = 0;		
$ExecuteListViewRequest->request->orderBy = $ListViewOrderBy;				
$ExecuteListViewRequest->request->sobjectType = "Lead";	
$response = $sfConnection->executeListView($ExecuteListViewRequest);
And access data using following:
foreach($response->result->records as $record) { }

This is how I manage to run this API call without uisng PHP Toolkit 20.0
$sfConnection = new SoapClient($wsdl_path);

$loginResult = $sfConnection->login(array (
	'username' => $USERNAME,
	'password' => $PASSWORD
$sessionHeader = new SoapHeader("urn:enterprise.soap.sforce.com", "SessionHeader", array('sessionId' => $loginResult->result->sessionId));
$sfConnection->sessionId = $loginResult->result->sessionId;		
$serverURL = $loginResult->result->serverUrl;		
$sfConnection->location = $serverURL;

Hope this helps someone.

  • November 12, 2014
  • Like
  • 1