• Javier CG
  • NEWBIE
  • 25 Points
  • Member since 2018


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 14
    Replies
I have to create a validation rule (VR) comparing with a list of values (IDs in my case).
The list is long so I can´t write all the values in the VR and I think that is better to make the list dynamic through custom metadata types, but I can´t find the way to do this.
Is this solution possible or exist another option that I didn´t think about?
I prefer a declarative solution instead of a coded one for ease maintenance.
I have a VF page with a custom controller that uses a standard set controller to get records of one custom object. The page uses pagination to show the records.
The controller loads the page records in a list that is showed on the VF page.
Now I have to change the page to let the users update one field of some records, but when I try to use the buttons for pagination, always receive an error:

Modified rows exist in the records collection!
External entry point


Even when I haven't changed any record.
The error raises in the .next() method of the standard set controller.
I have tried to call the .save() method of the standard set controller before calling the next() method with the same result.

This is a snippet of the VF page:
<apex:page controller="myCustomController" docType="html-5.0" tabStyle="mycustomObject__c" sidebar="false">
   <apex:sectionHeader title="Prices" subtitle="Prices" />
    <apex:form id="theForm">
        <apex:pageBlock title="Precios" rendered="{!RecordList.size!=0}" id="pbId" >
        <apex:pageBlockTable value="{!RecordList}" var="rec">
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                <apex:outputText value="{!rec.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Ammount</apex:facet>
                <apex:outputText value="{!rec.Ammount__c}"/>
            </apex:column>     
        </apex:pageBlockTable> 
       <apex:outputPanel style="text-align:center;" layout="block">
          <apex:commandButton value="First" reRender="pbId" action="{!first}" disabled="{!NOT(hasPrevious)}" status="paginationStatusBottom"/>
          <apex:commandButton value="Previous" rerender="pbId" action="{!previous}" disabled="{!NOT(hasPrevious)}" status="paginationStatusBottom"/>&nbsp;Page {!pageNumber} of {!totalPages}&nbsp;
          <apex:commandButton value="Next" rerender="pbId" action="{!next}" disabled="{!NOT(hasNext)}" status="paginationStatusBottom"/>
          <apex:commandButton value="Last" rerender="pbId" action="{!last}" disabled="{!NOT(hasNext)}" status="paginationStatusBottom"/>
          <apex:actionStatus id="paginationStatusBottom">
             <apex:facet name="start">
                 Please wait...<img src="/img/loading32.gif" style="width: 18px;"/>
             </apex:facet>
          </apex:actionStatus>
       </apex:outputPanel>
 </apex:pageBlock>
 </apex:form>
</apex:page>
And this is a snippet of the custom controller:
public with sharing class myCustomController
{ 
    Public Integer size{get;set;}
    Public Integer noOfRecords{get; set;}
    public List<SelectOption> paginationSizeOptions{get;set;}
    public static final Integer PAGE_SIZE = 50;

    public List<mycustomObject__c> RecordList {get;set;}

    public myCustomController()
    {
        init();
    }
    
    public void init()
    {
        RecordList = (List<mycustomObject__c>)setCon.getRecords();
    }
    
    public ApexPages.StandardSetController setCon
    {
        get
        {
            if(setCon == null)
            {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator('select Id, name, Ammount from mycustomObject__c'));                
                setCon.setPageSize(PAGE_SIZE);
            }
            return setCon;
        }
        set;
    }
        
    public Boolean hasNext
    {
        get
        {
            return setCon.getHasNext();
        }
        set;
    }
    
    public Boolean hasPrevious
    {
        get
        {
            return setCon.getHasPrevious();
        }
        set;
    }
    
    public Integer pageNumber
    {
        get
        {
            return setCon.getPageNumber();
        }
        set;
    }
    
    Public Integer getTotalPages()
    {
        Decimal totalSize = setCon.getResultSize();
        Decimal pageSize = setCon.getPageSize();
        Decimal pages = totalSize/pageSize;
        return (Integer)pages.round(System.RoundingMode.CEILING);
    }
    
    public void first()
    {
        setCon.save();
        setCon.first();
        init();
    }
    
    public void last()
    {
        setCon.save();
        setCon.last();
        init();
    }
    
    public void previous()
    {
        setCon.save();
        setCon.previous();
        init();
    }
    
    public void next()
    {
        setCon.save();
        setCon.next();
        init();
    }
}

If I change the <apex:inputText on the VF page by an <apex:outputText the page works well (but the user can´t change the field). But with outputText the error is always launched when I push any pagination button, even without any change on the record list.
Some suggestion to fix the problem?

Regards
I have a pageBlockTable that show a list of variables that exist in the controller class.
On each row, I have put an Erase button in the last column to delete that element of the list. The button passes the Id of the element (the list contains the id as one of its data) to delete.
The method works well, but only the first-row button calls the method when the user clicks on it.
If you click on the other rows buttons, no action is taken.
But if you click the first button and that row is deleted, then the new first button (previous second button) runs well, but not the other ones, and so on.
This is the pageblocktable code:
<apex:pageblocktable value="{!ListVariable}" var="Var" id="TableName" rowClasses="odd,even" styleClass="tableClass" border="1" cellspacing="0" cellpadding="5" width="100%">
    <apex:column>
        <apex:facet name="header">NAME</apex:facet>
        <apex:outputText value="{!Var.Name}"/>
    </apex:column>
    <apex:column >
        <apex:commandButton value="Delete" action="{!DeleteItem}" reRender="TableName" immediate="true" oncomplete="alert('Completed');">
            <apex:param name="Id" value="{!Var.Id}" assignto="{!IdToDelete}" />
        </apex:commandButton>
    </apex:column>
</apex:pageblocktable>
And this is the method in the controller:
public void DeleteItem()
    {
        integer i = 0;

        while(i < ListVariable.size())
        {
            if(ListVariable.get(i).Id == IdToDelete)
            {
                ListVariable.remove(i);
                return;
            }
        }
    }
The IdToDelete is initialized in the controller too.
The code is correct in the controller because if you click on the first button, the method does the correct thing, but I don´t know why the other buttons don´t call the method.
All the code that I have seen is the same as mine.

Some idea?
My customer has a custom object with more than 5 millions of records what need to export to an external application monthly. He doesn´t need to export all of them, only the last year records (about one million of records), but the export process doesn´t let filter the records, it export all the records of the linked object.
The idea is to clone the object in another custom object exactly the same, export the correct records monthly, and link the export process to this new object.
But I don´t know how to clone the requested records of the original object to the new object with an Apex class without exceeding the governor limits.
Any ideas of how to do it or another way to getting my objective?

Thank you in advance
I have to show a table with the contents of opportunitylineitems from an opportunity. Moreover, the user can select different items to make a mass action with them.
But when I try to show the items data, the LC don´t show anything.

Component:
<aura:component controller="GPController" implements="force:hasRecordId,flexipage:availableForRecordHome">
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="Products" type="GPController.wrapperGP[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <table>
        <thead>
            <tr>
                <th>
                    Selected
                </th>
                <th>
                    Product
                </th>
                <th>
                    Last modified date
                </th>
                <th>
                    Created by
                </th>
            </tr>
        </thead>
        <tbody>    
            <aura:iteration items="{!v.Products}" var="prod">
                <tr>
                    <td>
                        {!prod.Selected}
                    </td>
                    <td>
                        {!prod.Name}
                    </td>
                    <td>
                        {!prod.LastModifiedDate}
                    </td>
                    <td>
                        {!prod.CreatedBy.Name}
                    </td>
                </tr>                
            </aura:iteration>
        </tbody>
    </table>    
</aura:component>

Controller:
({
    doInit : function(component, event)
    {        
        var action = component.get("c.getProducts");
        action.setParams({
            "IdOpp": component.get("v.recordId")
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS")
            {
                component.set("v.Productos", response.getReturnValue());
               }
            else
            {
                console.log("Failed with state: " + state);
            }
        });
        $A.enqueueAction(action);
    },
})

Apex controller:
public class GPController
{
    @AuraEnabled
    public static List<wrapperGP> getProducts(ID IdOpp)
    {
        wrapperGP[] ListGP = new wrapperGP[]{};
        GP__c[] GPList = [select Id, Name, LastModifiedDate, CreatedBy.Name
                                                    from GP__c where Opp__c = :IdOpp];
        for (GP__c GP: GPList )
        {
            wrapperGP newGP= new wrapperGP(GP);
            ListGP.Add(newGP);
        }
        return ListGP ;
    } 
    public class wrapperGP
    {
        public boolean Selected {get; set;}
        public GP__c GP {get; set;}
        
        public wrapperGP(GP__c  newGP)
        {
            GP = newGP;
            Selected = false;
        }
    }
}

If I write fixed text on each iteration, 2 rows are painted because the opportunity has 2 items and if I show the iteration prod var on each iteration using {!prod}, shows [object Object], but the field content (example: {!prod.Name}) don´t show anything.
I have created the wrapper to insert the checkbox in the record and control later if the item is checked or not, to realize the mass action on it. I don´t know if there is an easier way to do that.
I need to replace a javascript button to use it in LEX.
The original button does some validations and, if everything is correct, then calls a VF page.
I have created a Lightning Component to replace the js button, and my intention was to call the LC with an action. The problem is that OpportunityLineItem doesn´t let me create an action. I only can create buttons or links, but not actions.
There is some way to do this?
I have to connect to an existing control version project on GitHub and connect to a SF sandbox environment related with the repo.

In Eclipse I can use a cloned repo from GitHub (cloned via GitHub Desktop) to create a project and, after this, link the project with a sandbox environment to retrieve objects and maintain the repo updated.

In VS Code I can clone the repo directly but, after it, I can´t connect the project with an org. If I try to do it, I get the error "command sfdx.force.set.default.org" not found.
If I try to Create project with manifest, I lose the GitHub connection.

The result is that I have 2 projects in the same workspace (one connected to GH and the other one connected to SF). When I must make a change, first I retrieve the objects with the SF connected project, I change them, and then copy their code to the GH connected project to maintain the repo updated. And that´s not a good way to work.

It is possible to get both connections in the same project so that you can retrieve objects from SF and use it into the repo?
I am creating a quick action to create record (Event) and I need to assign default values on some fields.
One of the fields is the Assign to. Usually the event is assigned to the current user, but in some cases I need to assign the event to one concrete user.
I try to do it through this formula:

IF( $Profile.Name != "Profile 1" && $Profile.Name != "Profile 2", "XXXXXXXXXXXXXXX",  $User.Id )

Where "XXXXXXXXXXXXXXX" is the id of the concrete user. But this formula raise error:

 Error: Formula result is data type (Text), incompatible with the expected data type (Search(Calendar,User)).

There is any form to cast the text string of the id into id or some other form to achieve that I need to do?
I have to remove javascript buttons to adapt it to lightning experience (LE).
I have created a custom button to create a new record, and like the new record has to receive some values from the related one, I do it with url hack, as the js button did it.
The button run perfect in classic, sending the values to the new record, but in LE the create record page opens, but not shows none of the sended values from the related record.
There exists some form to do it?
I know I would should use a quick action to create the new record in LE, but in some cases I need to change the values passed in function of the values of the related record, and I don´t know if this is possible with quick actions (ex: the record type of the new record depends of the profile of the user who creates it).
I am converting javascript buttons to create records into quick action to get the app in lightning ready.
But some js buttons have previous comprobation. For example: I revise if the sale has previous invoice before create a new one, and if the sale has invoice, a confirmation box ask the user about create a new one or not, and only creates a new invoice if the user say yes.
I don´t know if this kind of functionality can be made it with object-specific quick actions or in any other form.
Can someone help me?
I have a VF page with a custom controller that uses a standard set controller to get records of one custom object. The page uses pagination to show the records.
The controller loads the page records in a list that is showed on the VF page.
Now I have to change the page to let the users update one field of some records, but when I try to use the buttons for pagination, always receive an error:

Modified rows exist in the records collection!
External entry point


Even when I haven't changed any record.
The error raises in the .next() method of the standard set controller.
I have tried to call the .save() method of the standard set controller before calling the next() method with the same result.

This is a snippet of the VF page:
<apex:page controller="myCustomController" docType="html-5.0" tabStyle="mycustomObject__c" sidebar="false">
   <apex:sectionHeader title="Prices" subtitle="Prices" />
    <apex:form id="theForm">
        <apex:pageBlock title="Precios" rendered="{!RecordList.size!=0}" id="pbId" >
        <apex:pageBlockTable value="{!RecordList}" var="rec">
            <apex:column >
                <apex:facet name="header">Name</apex:facet>
                <apex:outputText value="{!rec.Name}"/>
            </apex:column>
            <apex:column >
                <apex:facet name="header">Ammount</apex:facet>
                <apex:outputText value="{!rec.Ammount__c}"/>
            </apex:column>     
        </apex:pageBlockTable> 
       <apex:outputPanel style="text-align:center;" layout="block">
          <apex:commandButton value="First" reRender="pbId" action="{!first}" disabled="{!NOT(hasPrevious)}" status="paginationStatusBottom"/>
          <apex:commandButton value="Previous" rerender="pbId" action="{!previous}" disabled="{!NOT(hasPrevious)}" status="paginationStatusBottom"/>&nbsp;Page {!pageNumber} of {!totalPages}&nbsp;
          <apex:commandButton value="Next" rerender="pbId" action="{!next}" disabled="{!NOT(hasNext)}" status="paginationStatusBottom"/>
          <apex:commandButton value="Last" rerender="pbId" action="{!last}" disabled="{!NOT(hasNext)}" status="paginationStatusBottom"/>
          <apex:actionStatus id="paginationStatusBottom">
             <apex:facet name="start">
                 Please wait...<img src="/img/loading32.gif" style="width: 18px;"/>
             </apex:facet>
          </apex:actionStatus>
       </apex:outputPanel>
 </apex:pageBlock>
 </apex:form>
</apex:page>
And this is a snippet of the custom controller:
public with sharing class myCustomController
{ 
    Public Integer size{get;set;}
    Public Integer noOfRecords{get; set;}
    public List<SelectOption> paginationSizeOptions{get;set;}
    public static final Integer PAGE_SIZE = 50;

    public List<mycustomObject__c> RecordList {get;set;}

    public myCustomController()
    {
        init();
    }
    
    public void init()
    {
        RecordList = (List<mycustomObject__c>)setCon.getRecords();
    }
    
    public ApexPages.StandardSetController setCon
    {
        get
        {
            if(setCon == null)
            {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator('select Id, name, Ammount from mycustomObject__c'));                
                setCon.setPageSize(PAGE_SIZE);
            }
            return setCon;
        }
        set;
    }
        
    public Boolean hasNext
    {
        get
        {
            return setCon.getHasNext();
        }
        set;
    }
    
    public Boolean hasPrevious
    {
        get
        {
            return setCon.getHasPrevious();
        }
        set;
    }
    
    public Integer pageNumber
    {
        get
        {
            return setCon.getPageNumber();
        }
        set;
    }
    
    Public Integer getTotalPages()
    {
        Decimal totalSize = setCon.getResultSize();
        Decimal pageSize = setCon.getPageSize();
        Decimal pages = totalSize/pageSize;
        return (Integer)pages.round(System.RoundingMode.CEILING);
    }
    
    public void first()
    {
        setCon.save();
        setCon.first();
        init();
    }
    
    public void last()
    {
        setCon.save();
        setCon.last();
        init();
    }
    
    public void previous()
    {
        setCon.save();
        setCon.previous();
        init();
    }
    
    public void next()
    {
        setCon.save();
        setCon.next();
        init();
    }
}

If I change the <apex:inputText on the VF page by an <apex:outputText the page works well (but the user can´t change the field). But with outputText the error is always launched when I push any pagination button, even without any change on the record list.
Some suggestion to fix the problem?

Regards
I have a pageBlockTable that show a list of variables that exist in the controller class.
On each row, I have put an Erase button in the last column to delete that element of the list. The button passes the Id of the element (the list contains the id as one of its data) to delete.
The method works well, but only the first-row button calls the method when the user clicks on it.
If you click on the other rows buttons, no action is taken.
But if you click the first button and that row is deleted, then the new first button (previous second button) runs well, but not the other ones, and so on.
This is the pageblocktable code:
<apex:pageblocktable value="{!ListVariable}" var="Var" id="TableName" rowClasses="odd,even" styleClass="tableClass" border="1" cellspacing="0" cellpadding="5" width="100%">
    <apex:column>
        <apex:facet name="header">NAME</apex:facet>
        <apex:outputText value="{!Var.Name}"/>
    </apex:column>
    <apex:column >
        <apex:commandButton value="Delete" action="{!DeleteItem}" reRender="TableName" immediate="true" oncomplete="alert('Completed');">
            <apex:param name="Id" value="{!Var.Id}" assignto="{!IdToDelete}" />
        </apex:commandButton>
    </apex:column>
</apex:pageblocktable>
And this is the method in the controller:
public void DeleteItem()
    {
        integer i = 0;

        while(i < ListVariable.size())
        {
            if(ListVariable.get(i).Id == IdToDelete)
            {
                ListVariable.remove(i);
                return;
            }
        }
    }
The IdToDelete is initialized in the controller too.
The code is correct in the controller because if you click on the first button, the method does the correct thing, but I don´t know why the other buttons don´t call the method.
All the code that I have seen is the same as mine.

Some idea?
My customer has a custom object with more than 5 millions of records what need to export to an external application monthly. He doesn´t need to export all of them, only the last year records (about one million of records), but the export process doesn´t let filter the records, it export all the records of the linked object.
The idea is to clone the object in another custom object exactly the same, export the correct records monthly, and link the export process to this new object.
But I don´t know how to clone the requested records of the original object to the new object with an Apex class without exceeding the governor limits.
Any ideas of how to do it or another way to getting my objective?

Thank you in advance
I have to show a table with the contents of opportunitylineitems from an opportunity. Moreover, the user can select different items to make a mass action with them.
But when I try to show the items data, the LC don´t show anything.

Component:
<aura:component controller="GPController" implements="force:hasRecordId,flexipage:availableForRecordHome">
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="Products" type="GPController.wrapperGP[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <table>
        <thead>
            <tr>
                <th>
                    Selected
                </th>
                <th>
                    Product
                </th>
                <th>
                    Last modified date
                </th>
                <th>
                    Created by
                </th>
            </tr>
        </thead>
        <tbody>    
            <aura:iteration items="{!v.Products}" var="prod">
                <tr>
                    <td>
                        {!prod.Selected}
                    </td>
                    <td>
                        {!prod.Name}
                    </td>
                    <td>
                        {!prod.LastModifiedDate}
                    </td>
                    <td>
                        {!prod.CreatedBy.Name}
                    </td>
                </tr>                
            </aura:iteration>
        </tbody>
    </table>    
</aura:component>

Controller:
({
    doInit : function(component, event)
    {        
        var action = component.get("c.getProducts");
        action.setParams({
            "IdOpp": component.get("v.recordId")
        });
        action.setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS")
            {
                component.set("v.Productos", response.getReturnValue());
               }
            else
            {
                console.log("Failed with state: " + state);
            }
        });
        $A.enqueueAction(action);
    },
})

Apex controller:
public class GPController
{
    @AuraEnabled
    public static List<wrapperGP> getProducts(ID IdOpp)
    {
        wrapperGP[] ListGP = new wrapperGP[]{};
        GP__c[] GPList = [select Id, Name, LastModifiedDate, CreatedBy.Name
                                                    from GP__c where Opp__c = :IdOpp];
        for (GP__c GP: GPList )
        {
            wrapperGP newGP= new wrapperGP(GP);
            ListGP.Add(newGP);
        }
        return ListGP ;
    } 
    public class wrapperGP
    {
        public boolean Selected {get; set;}
        public GP__c GP {get; set;}
        
        public wrapperGP(GP__c  newGP)
        {
            GP = newGP;
            Selected = false;
        }
    }
}

If I write fixed text on each iteration, 2 rows are painted because the opportunity has 2 items and if I show the iteration prod var on each iteration using {!prod}, shows [object Object], but the field content (example: {!prod.Name}) don´t show anything.
I have created the wrapper to insert the checkbox in the record and control later if the item is checked or not, to realize the mass action on it. I don´t know if there is an easier way to do that.
I need to replace a javascript button to use it in LEX.
The original button does some validations and, if everything is correct, then calls a VF page.
I have created a Lightning Component to replace the js button, and my intention was to call the LC with an action. The problem is that OpportunityLineItem doesn´t let me create an action. I only can create buttons or links, but not actions.
There is some way to do this?
I am creating a quick action to create record (Event) and I need to assign default values on some fields.
One of the fields is the Assign to. Usually the event is assigned to the current user, but in some cases I need to assign the event to one concrete user.
I try to do it through this formula:

IF( $Profile.Name != "Profile 1" && $Profile.Name != "Profile 2", "XXXXXXXXXXXXXXX",  $User.Id )

Where "XXXXXXXXXXXXXXX" is the id of the concrete user. But this formula raise error:

 Error: Formula result is data type (Text), incompatible with the expected data type (Search(Calendar,User)).

There is any form to cast the text string of the id into id or some other form to achieve that I need to do?
I have to remove javascript buttons to adapt it to lightning experience (LE).
I have created a custom button to create a new record, and like the new record has to receive some values from the related one, I do it with url hack, as the js button did it.
The button run perfect in classic, sending the values to the new record, but in LE the create record page opens, but not shows none of the sended values from the related record.
There exists some form to do it?
I know I would should use a quick action to create the new record in LE, but in some cases I need to change the values passed in function of the values of the related record, and I don´t know if this is possible with quick actions (ex: the record type of the new record depends of the profile of the user who creates it).
I am converting javascript buttons to create records into quick action to get the app in lightning ready.
But some js buttons have previous comprobation. For example: I revise if the sale has previous invoice before create a new one, and if the sale has invoice, a confirmation box ask the user about create a new one or not, and only creates a new invoice if the user say yes.
I don´t know if this kind of functionality can be made it with object-specific quick actions or in any other form.
Can someone help me?
Hi, I am trying to a field from the active user in a component and use it in an if statement.

 <aura:if isTrue="{!$User.IsActive}">
    <td class="button"><a href="#" target="_blank">
               <lightning:button label="Join"/></a></td>
    <aura:set attribute="else">
        <td class="button"><a href="#" target="_blank">
               <lightning:button label="Renew Membership"/></a></td>
    </aura:set>
</aura:if>


I assume I am using the wrong syntax for {!$User.IsActive} as it always throws up the else and IsActive is definitely TRUE for the current user.

Thanks for any help
Hi All, 
My requirement is show a popup message on the opportunity page(Standard page is overidden with custom vf page using apex detail) when opportunity is closed. Say two persone is wokring on same opportunity then one person closd that opportunity from his side, so other person should see the message that opportunity is being closed without having to refrsh the page.

For this requirement i thought of implmenting Striming API, so I have craeted a pushtopic and craeted to dummy vf page just to check whether the stage chnage is reflected or not, unfortunatley it is not refreshing. Could you please help me to solve my issue.

Here is pushtopic i created.
PushTopic pushTopic = new PushTopic();
pushTopic.Name = 'InvoiceStatementUpdates';
pushTopic.Query = 'SELECT Id,Name,StageName FROM Opportunity';
pushTopic.ApiVersion = 39.0;
pushTopic.NotifyForOperationUpdate = true;
pushTopic.NotifyForOperationDelete = true;
pushTopic.NotifyForFields = 'Referenced';
pushTopic.NotifyForOperations = 'Update';
insert pushTopic;

Here is vf page
<apex:page id="PG" controller="StreamingAPIController">
<apex:form id="FRM">

    <apex:includeScript value="{!$Resource.cometd}"/>
    <apex:includeScript value="{!$Resource.jquery_StrimingApi}"/>
    <apex:includeScript value="{!$Resource.json2}"/>
    <apex:includeScript value="{!$Resource.jquery_cometd}"/>

    <apex:actionFunction name="GetRefreshedOpportunities" reRender="PB,PBT"/>

    <script type="text/javascript">
        (function($)
        {
            $(document).ready(function() {
                
                // Connect to the CometD endpoint
                $.cometd.init({
                    url: window.location.protocol+'//'+window.location.hostname+'/cometd/36.0/',
                    requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
                });
                
                // Subscribe to a topic. JSON-encoded update will be returned in the callback
                // In this example we are using this only to track the generated event
                $.cometd.subscribe('/topic/InvoiceStatementUpdates', function(message)
                {
                    //You can use message as it will return you many attributes
                    //I am just using to track that event is generated
                    GetRefreshedOpportunities();
                });

            });
        })(jQuery)
    </script>

    <apex:pageBlock id="PB">
        <apex:variable var="count" value="{!0}" />
        <apex:pageBlockTable id="PBT" value="{!getRefreshedOpportunity}" var="opp">
            
            <apex:column headerValue="S.No.">
                <apex:variable var="count" value="{!count+1}" />
                {!count}
            </apex:column>
            <apex:column value="{!opp.id}" headerValue="id"/>
            <apex:column value="{!opp.Name}" headerValue="Name"/>
            <apex:column value="{!opp.StageName }" headerValue="StageName "/>
            
        </apex:pageBlockTable>
    </apex:pageBlock>

</apex:form>
</apex:page>

here is controller 
public class StreamingAPIController
{
    //Everytime page is reRendered it will get refreshed values of Opportunity 
    public List<Opportunity> getRefreshedOpportunity
    {
        get
        {
            return [select Id, Name,StageName from Opportunity  LIMIT 10 ] ;
        }
        set;
    }
    
    public StreamingAPIController()
    {
    }
}
But in workbench i can see the notification and stage name, I am confused why it is not reflectying in Vf pages. 
Message received from: /topic/InvoiceStatementUpdates
{
  "channel": "/topic/InvoiceStatementUpdates", 
  "clientId": "1ix3i3kz92l8b8z13m10pafuf5tz", 
  "data": {
    "event": {
      "type": "updated", 
      "createdDate": "2017-01-26T04:28:36.000+0000"
    }, 
    "sobject": {
      "StageName": "Closed Lost", 
      "Id": "006G000000P3j6CIAR", 
      "Name": "MVC Componentes Plasticos Ltda.-LTD&CFR Domestic-Sep-15-13"
    }
  }
}

Please help me 
If something goes wrong in lightning component and I go back to component bundle and mofidy the logic there and save and comeback to browser and refresh the page and execute the component , But the component is sometimes displaying the same old logic. Is it because the Javascript handler code is being cached in browser or any other reason. I am able to look at the new logic in browser after making three or four refreshes.