• David Roberts 4
  • NEWBIE
  • 114 Points
  • Member since 2015
  • Business Development manager
  • Logicom Virtual Worlds

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 15
    Questions
  • 178
    Replies
I can create a file using:
String strDebug = 'some debug information \n';
       
        
        //ContentDocument
        //SELECT title,  LatestPublishedVersionId FROM ContentDocument where title = 'debuglog.txt'
        ContentVersion file = new ContentVersion(
            title = 'debuglog.txt',
            versionData = Blob.valueOf( strDebug ),
            pathOnClient = '/debuglog.txt'
        );
        
        insert file;

but how do I overwrite it (add a new version) so I don't get multiple 'debuglog.txt' files?
Is there a 'Who' lookup or do I need to have both a Contact and a User field with a check that only one of these is used?
What, if any, are the pitfalls?
A Trailblazer Community posting (https://success.salesforce.com/_ui/core/userprofile/UserProfilePage?u=00530000001sMqZ&tab=sfdc.ProfilePlatformFeed&fId=0D53A00004Y1vM9&s1oid=00D300000000iTz&emkind=chatterGroupDigest&s1nid=0DB30000000072L&emtm=1566722973622&s1uid=0053A00000DGqXQ&fromEmail=1&s1ext=0)led me to develop this handy solution for exporting the Country and State codes. Knowledge article 338321  (https://help.salesforce.com/articleView?id=000338321&type=1&mode=1) was the starting point.
Here's the Visualforce Page:
<apex:page controller="ExportToExcelController" readOnly="true" 
    action="{!fetchListOfCountryCodes}" contentType="application/vnd.ms-excel#{!fileName}.xls">
  <!-- https://help.salesforce.com/articleView?id=000338321&type=1&mode=1 -->  
    
    <table>
        <apex:repeat value="{!Countries}" var="cos">
            <tr>
            <td><apex:outputText>{!cos[0]}</apex:outputText></td>
            <td><apex:outputText>{!cos[1]}</apex:outputText></td>
            </tr>
        </apex:repeat>
        <tr></tr>
        <apex:repeat value="{!States}" var="st">
            <tr>
            <td><apex:outputText>{!st[0]}</apex:outputText></td>
            <td><apex:outputText>{!st[1]}</apex:outputText></td>
            </tr>
        </apex:repeat>
        
    </table>
    
</apex:page>

and the controller:
public class ExportToExcelController {
    
    public String fileName {get; set;}
    public List<List<String>> Countries {get; set;}
    public List<List<String>> States {get; set;}

    public void fetchListOfCountryCodes() {
        
        List<Schema.PicklistEntry> ple;
        fileName = 'countryandstatecodes';
        
        Countries = new List<List<String>>();
        Schema.DescribeFieldResult fieldResult = User.Countrycode.getDescribe();
        ple = fieldResult.getPicklistValues();
        //System.debug('Picklist::'+ple);
        for( Schema.PicklistEntry f : ple){
            
            List<String> aCountry = new List<String>();
            aCountry.add(f.getLabel());
            aCountry.add(f.getValue());
            
        	//System.debug(f.getLabel() +'::'+ f.getValue());
            Countries.add(aCountry);
        }
        
        States = new List<List<String>>();
        fieldResult = User.statecode.getDescribe();
        ple = fieldResult.getPicklistValues();
        //System.debug('Picklist::'+ple);
        for( Schema.PicklistEntry f : ple){
            
            List<String> aState = new List<String>();
            aState.add(f.getLabel());
            aState.add(f.getValue());
            
        	//System.debug(f.getLabel() +'::'+ f.getValue());
            States.add(aState);
        }
        
    }//fetchListOfCountryCodes
}//ExportToExcelController

​​​​​​​
The "Search in Files" feature is particularly irritating because it doesn't search components.
Also, the debug logs won't show the last few lines without jumping back up the list.
The "Search"  box overlays the horizontal scroll bar.
I'm currently hardcoding an input value into a vf page.
When testing, I want a different value.

<!-- Normal Run-->
<apex:input value="runtime" name="status"/>
<!-- Test-->
<apex:input value="testing" name="status"/>

Does a vf page have the equivalent of the apex isTest() function?

or is there another method of forcing a different value to be used during testing?
I'm using force.com IDE Eclipse to develop apex and Lightning components.
The test results shows a list of classes/components with their code coverage.
Ideally, selecting one shows the lines of code not covered.

However, sometimes I get the message "unable to find the apex source" and a number of dialogues pop up saying that.

What is the correct procedure to resolve this?


​Any pointers greatly appreciated.
I have a custom object for territories holding postcode and manager of that area.
I want to search for a postcode/zip match and update the page with the result.
I'm using a command button to initiate the search.
My search is returning the correct result but not refreshing the other fields.
I guess I'm not using rerender correctly but can't get it to work.
Please help.

Here's the code:

<apex:page controller="TerritoryController" tabstyle="Territory__c">
    <apex:form >
        
        <apex:pageBlock title="Area Representative Lookup" id="theBlock">


            <apex:pageBlockSection columns="1" id="theSection">
                     


                
                <apex:outputText value="{!Area}"/>
                <apex:outputText value="{!Name}"/>
                <apex:outputText value="{!Manager}"/>
                <apex:outputText value="{!Postcode}"/>
                
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="search by postcode" for="searchText" />
                    <apex:inputText value="{!searchText}" id="SearchText"/>
                </apex:pageBlockSectionItem>
                
                
                
            </apex:pageBlockSection>

            <apex:pageBlockButtons >
                <apex:commandButton action="{!lookup}" value="Lookup"   rerender="theSection"/> 
            </apex:pageBlockButtons>
<!-- rerender="theBlock"  immediate="true" -->
        </apex:pageBlock>
        
    </apex:form>
</apex:page>

public class TerritoryController {
    // Called by apex page:
    // ...salesforce.com/apex/vwAreaRepLookup
    
    public List<Territory__c> myTerList;
    
    public string name;
    public string postcode;
    public string area;
    public string manager;
    public string searchText;
           
    
     //constructor
    public TerritoryController() {
        searchText = '';
    }



    public List<Territory__c> getmyTerList() {
        
        system.debug('in getmyTerList searchText=>'+searchText+'<');
        
        ApexPages.Message msgErr;
        ApexPages.Message msgInfo;
        String err = 'Hello';
        String info = 'Hi!';
        
//example error post
//err='whatever';
//msgErr = new ApexPages.Message(ApexPages.Severity.ERROR, err);
//ApexPages.addmessage(msgErr);

//example info post
//info = 'searchtext=>'+searchText+'<';
//msgInfo = new ApexPages.Message(ApexPages.Severity.INFO, info);
//ApexPages.addmessage(msgErr);

Territory__c[] myTerList = [Select territory__c.area__c, territory__c.postcode__c, territory__c.name, territory__c.territory_manager__c from Territory__c where postcode__c = :searchText ];
        return myTerList; 
            
            

    }//getMyRetLicList
    
    
    public String getManager() {
        return 'nothing';
    }

    public String getArea() {
        return 'nothing';
    }

    public String getName() {
        return 'nothing';
    }
    
    public String getPostcode() {
        system.debug('in get postcode');
        return 'nothing';
    }
    
    public String getSearchText() {
        return 'MK';
    }
    
    public void setSearchText(String theSearchText) {
        searchText = theSearchText;
    }
    
    public void lookup() {
        
        system.debug('in lookup searchText=>'+searchText+'<');
            
    
        Territory__c result = [Select territory__c.area__c, territory__c.postcode__c, territory__c.name, territory__c.territory_manager__c from Territory__c where postcode__c = :searchText limit 1];
        
        name = result.name;
        postcode = result.postcode__c;
        area = result.area__c;
        manager = result.territory_manager__c;
        system.debug('name: '+name);
    

    }//Lookup


}//TerritoryController
I have a page that gets criteria including current location using javascript.
I then construct a url with parameters and launch another page using apex redirect to show a map - but it doesn't draw the map.
Yet, when I launch the page directly using the constructed URL, the map appears.
When sandbox laucnches it, a complex URL is displayed.
What is happenning and how can I remedy it?
I have festooned my code with console logs and system logs but can't see why it fails.
Please help.
I struggled to create a simple Lightning Component that I could add to an account page, so thought I'd share my result.
The presentation of the information isn't tidy yet...that's my next learning excercise!
This can also be used as an action via an action button on the page.
It was based on the article
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action_recordid.htm#components_using_lex_s1_config_action_recordid

Hope this helps others.

accountSummary.cmp
-----------------------------
<aura:component controller="accountSummaryController"
                implements="force:lightningQuickActionWithoutHeader,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes">
    
    <!-- based on https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_using_lex_s1_config_action_recordid.htm#components_using_lex_s1_config_action_recordid -->

     <aura:attribute name="account" type="Account" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    <!-- Display details about the account -->
    <div class="slds-page-header" role="banner">
        <p class="slds-text-heading--label">{!v.account.Name}</p>
    </div>
    
    <!-- Display the details form needs work -->
    <div class="slds-form--stacked">
  
    <div class="slds-form-element">       
        <p class="slds-text-heading--label">{!v.account.BillingCity}</p>
    </div>
        <div class="slds-form-element">    
        <p class="slds-text-heading--label">{!v.account.BillingState}</p>
    </div>
    <div class="slds-form-element"> 
        <p class="slds-text-heading--label">{!v.account.Website}</p>
    </div>
 
    </div>

</aura:component>

accountSummaryController.js
---------------------------------------

({
    doInit : function(component, event, helper) {

        // Prepare the action to load account record
        var action = component.get("c.getAccount");
        action.setParams({"accountId": component.get("v.recordId")});

        // Configure response handler
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(component.isValid() && state === "SUCCESS") {
                component.set("v.account", response.getReturnValue());
            } else {
                console.log('Problem getting account, response state: ' + state);
            }
        });
        $A.enqueueAction(action);
    }   
})

...and the controller class
accountSummaryController.apxc
-------------------------------------------

public with sharing class accountSummaryController {

    @AuraEnabled
    public static Account getAccount(Id accountId) {
        // Perform isAccessible() checks here
        return [SELECT Name, BillingCity, BillingState,website FROM Account WHERE Id = :accountId];
    }
    
}
 
Could someone explain the query syntax in
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_methods.htm
which uses
results = (List<Account>)[FIND :searchText RETURNING account(Name, billingpostalcode, Phone)][0];
For a start, I don't know what the [0] is doing.
Also, what are search criteria. It isn't returning every account I'd expect.

An alternative would be:
        results = [SELECT  Name, Phone, billingpostalcode FROM Account where name like :searchText];
although I'd add a '%' to the search text.

Hope someone can explain.
Thanks.
 
I've been trying to add the attendees as a related list on my custom controlled apex page but can't find a syntax that works.
I get errors like: "'EventRelations' is not a valid child relationship name for entity Event "

<apex:relatedList subject="{!anEvent}" list="EventRelations">
        <apex:facet name="header">Attendees</apex:facet>
    </apex:relatedList>

where "anEvent" is my event record (public Event in controller) which succesfully returns all the fields of the event in a pageBlock.

​Any ideas?
I'm trying to "Build a mapping application for iPhone" following the instructions at
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_mobile_example.htm
but, as far as I'm concerned, there are some missing instructions.
I'm new to this so, although it may seem obvious, I just don't know how to make it work.

There are two parts that don't make sense to me and I'd be grateful for any assistance.

I'm not sure what to do with the
"The following markup defines the iuivf page used as the template:"
Where do I save the code and as what?

Similarly, what do I do with
" Visualforce page that displays the phone number and rating of the account the user selected from the list view."
What do I call it? Is this the main page that is called to make this work?

Many thanks, Dave.

 
I'm having great difficulty assigning and testing account ids that I've created in a custom object.

I want to compare accounts
if (thisAc == thatAc){
} //endif

and tried
if (thisAc.id == thatAc.id){
​} //endif

My custom object has an account field: MyCustomObject__c has referenceCompany__c
I can't seem to copy it to another custom object - even a temporary Account

starting from MyCustomObject my1...

MyOtherCustomObject myOco = new(MyOtherCustomObject);
myOco.copiedCompany__c = my1.referenceCompany__c;

I've tried:
Account thisAc = .my1.referenceCompany__c;
and
Account thatAc= .my1.referenceCompany__r; (which seems close to the answer).


Any suggestions?

Thanks in advance.


 
I am trying to achieve the following:
 
I have accounts:
ManufacturerA
RetailerX
RetailerY
 
There is a custom object “Licence” consisting of:
Licence holder (an account e.g. RetailerY) with other licence details.
An account may have multiple licences.
 
I have a custom object “Retailer of” consisting of:
Manufacturer (account)
Retailer (account)
For example;
RetailerX is a retailer of ManufacturerA
RetailerY is a retailer of ManufacturerA
 
I want to report the licence data of retailers of a manufacturer.
 
Manufacturer: ManufacturerA:
               Retailer: RetailerX
                              Licence 001 …other details
   Licence 005 …other details
               Retailer: RetailerY
                              Licence 8097 …other details
                              Licence 8098 …other details
                              Licence 8099 …other details
                              Licence 8100 …other details


I have tried joined reports but haven't found a way to achieve it.
Please can anyone tell me how?
(I'm assuming I have structured the data in the only way possible using custom objects).

Does it require a VisualForce page?

Any suggestions and examples would be much appreciated.

Dave.
 
The following code throws an exeption at the callout request
CALLOUT_REQUEST [35]|System.HttpRequest[Endpoint=http//:www.virtualworlds.co.uk/getParams.php, Method=POST]
and genearates the error,
"no protocol: http//:www.virtualworlds.co.uk/getParams.php".

I generate the list from custom objects and have verified that the list has entries.

Can you tell me what is wrong?

Code:

public class HelloWorld {
    
    public static void tryPost() {

     System.debug( 'Posting...' );
        List<licence__c> myList = new List<licence__c>();
        myList= [select Id,Name from licence__c LIMIT 20];  
        
      
        String endPoint = 'http//:www.virtualworlds.co.uk/getParams.php';
        String method = 'POST';
        
        //Prepare http req
        System.debug( 'New Request...' );
        HttpRequest req = new HttpRequest();
        System.debug( 'Set endpoint...' );
        req.setEndpoint(endPoint); 
    
        req.setMethod(method);
        String JSONString = JSON.serialize(myList);  
        req.setBody(JSONString);
        System.debug( 'new Http...' );
        Http http = new Http();
        System.debug( 'Send request...' );
        HTTPResponse res = http.send(req);
        System.debug( 'Result?...' );
        System.debug(res.getBody());      
  

}
The "Search in Files" feature is particularly irritating because it doesn't search components.
Also, the debug logs won't show the last few lines without jumping back up the list.
The "Search"  box overlays the horizontal scroll bar.
I can create a file using:
String strDebug = 'some debug information \n';
       
        
        //ContentDocument
        //SELECT title,  LatestPublishedVersionId FROM ContentDocument where title = 'debuglog.txt'
        ContentVersion file = new ContentVersion(
            title = 'debuglog.txt',
            versionData = Blob.valueOf( strDebug ),
            pathOnClient = '/debuglog.txt'
        );
        
        insert file;

but how do I overwrite it (add a new version) so I don't get multiple 'debuglog.txt' files?
Hi All,
         i have a requirement in which i have a field on lead object called ToBeDeleted__c, which should be true when one of the following condition is true :-
1.lead name contains 'test'   
2.The owner of the lead is inactive.
3.lead has duplicate records than last created record need to be checked.
4.lead is created 1 year or more than one year ago.
I want to create a batch which set the checkbox field true when above condition met.
How to do it ?Can someone guide me with it?
Thanks
I am working on Lightning component and implementing the CSS but its not working. can anyone help me out in sorting out this issue.

In my below component, I want to change the colour and size of Label "Search Campaign by Name", my code is below
<aura:component Controller="CampaignMemberController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	    <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    
    <aura:attribute name="mydata" type="Object"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute name="inputKey" type="String"/>
    <aura:attribute name="sortedBy" type="String"/>
    <aura:attribute name="sortedDirection" type="String"/>
    <aura:attribute name="defaultSortDirection" type="String"/>
  <form class="slds-form--inline">
      <div class="slds-form-element">
    <lightning:input aura:id="searchId" type="search" label="Search Campaign by Name" name="searchName" value="{!v.inputKey}"/>
          </div>
      <div class="slds-form-element">
        <lightning:button label="Search" onclick="{!c.doSearch}"/>
      </div>
    </form>
    <lightning:datatable class="{table-test}"
                         sortedBy="{! v.sortedBy }"
                         sortedDirection="{! v.sortedDirection }"
                         defaultSortDirection="{! v.defaultSortDirection }"
                         onsort="{! c.updateColumnSorting }"
                         data="{! v.mydata }" 
                         columns="{! v.mycolumns }" 
                         keyField="Id"
                         onrowaction="{! c.handleRowAction }"/>
</aura:component>
I also want to change the column header styling too.
({
    init: function (cmp, event, helper) {
        var actions = [{ label: 'Show details', name: 'show_details'}];
        
        cmp.set('v.mycolumns', [
            { type: 'action', typeAttributes: { rowActions: actions } },
            {label:"Campaign Name", fieldName:"Campaign_Name__c",class:"table-test",type:"Formula(Text)"},
            {label:"Last Activity Date", fieldName:"Last_Activity_Date__c",sortable:true, type:"Formula(Date)"},
            {label:"Name",sortable:true, fieldName: 'linkName', type: 'url', 
            typeAttributes: {label: { fieldName: 'LastName' }, target: '_blank'}},
            {label:"Phone", fieldName:"Phone", type:"phone"},
            {label:"Company(Account)", fieldName:"CompanyOrAccount", type:"Text(255)"},
            {label:"Email", fieldName:"Email", type:"Email",sortable:true},
            {label:"Status", fieldName:"Status", type:"Picklist"},
            {label:"Owner", fieldName:"Owner__c", type:"Formula(Text)"}
        ]);
    },
    
    handleRowAction : function(cmp,event,helper){
        var action = event.getParam('action');
        var row = event.getParam('row');
        // navigate to sObject detail page     
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": row.Id,
            "slideDevName": "detail"
        });
        navEvt.fire();
    },
    
    doSearch : function(cmp,event,helper){
        var src = cmp.get("v.inputKey");
        var action=cmp.get('c.getCampaignMember');
        if (src == '' || src == null) {
            // display error message if input value is blank or null
            alert('Enter search keyword');
        }
        action.setParams({Keys:src});
        action.setCallback(this,$A.getCallback(function(response){
            var state=response.getState();
            if(state==="SUCCESS"){
                var oResponse=response.getReturnValue();
                cmp.set("v.mydata",oResponse);
                                var records =response.getReturnValue();
                records.forEach(function(record){
                    record.linkName = '/'+record.Id;
                    cmp.set("v.mydata",records);
                })
            }else if(state==="ERROR"){
                var errors=response.getError();console.error(errors);
            }
        }
                                              ));
        $A.enqueueAction(action);
    },
        updateColumnSorting: function (cmp, event, helper) {
        var fieldName = event.getParam('fieldName');
        var sortDirection = event.getParam('sortDirection');
        cmp.set("v.sortedBy", fieldName);
        cmp.set("v.sortedDirection", sortDirection);
        helper.sortData(cmp, fieldName, sortDirection);
    }
    
})


 
I would like to receive information regarding the Error: "An internal server error has occurred Error ID: 435276104-25533 (-2090061783)"

This error appears when, by pressing a button in a lightning component, I call a method @AuraEnabled and in this method I do 2 DML-deletion: one for the PermissionSetAssignments and one for the PermissionSets.

Method:
       @AuraEnabled
    public static String deleteExistingCBAPermissionSets(){
       try{
            map<Id,PermissionSet> mapIdToPermissionSet = new map<Id,PermissionSet>();
            for(PermissionSet ps : [Select Name, Label from PermissionSet where Name like 'CBA_%']){
                mapIdToPermissionSet.put(ps.Id, ps);
            }
            list<PermissionSetAssignment> permissionsSetAssignToDelete = new list<PermissionSetAssignment>();
            for(PermissionSetAssignment psa : [Select Id, PermissionSetId
                                                from PermissionSetAssignment
                                                where PermissionSetId IN: mapIdToPermissionSet.keyset()]){
                permissionsSetAssignToDelete.add(psa);
            }
            if(permissionsSetAssignToDelete.size()>0){
                delete permissionsSetAssignToDelete;
            }
            if(mapIdToPermissionSet.size()>0){
                delete mapIdToPermissionSet.values();
            }
            return 'OK';
        }catch (exception e){
            return e.getMessage()+' at line '+e.getLineNumber();
        }

    }

I run the same code from Execute Anonymous and it works correctly. It deletes the desired permissions.
I also tried to declare the class "without sharing" but the result is the same.

Does anyone know the kind of error?
Thanks in advance for your answers.
1.I create lightning:checkboxGroup component. options and value are comming from server controller.
2.i set the options in controller. options are loaded and checkboxes are showing.
3.i set the value in the controller.but checkboxes are not checked dynamically.
can you please help me?
I have created a lightning component and I wanted to display it in account tab in detail record page, so for that i created a tab just beside the account detail tab and drag an dropped the component there.
It workers fine in salesforce lighting but when i tried to login through salesforce 1 mobile app that tab itself is not visible and also the component is not visible.can anyone tell me why this is happenening ?
 
I create a bunch of buttons in a table with aura:iteration. Think of it as one per contact per row to act on the record. Here is the button markup inside a td -
 
<lightning:button variant="brand" label="Charge" value="{!s.Id}" onclick="{!c.callMyCallback}" />
Now, how do I access the value attribute for the button in my client js controller callback? event.currentTarget.value is undefined. Any ideas?
Thanks.
 
  • November 03, 2016
  • Like
  • 0

Hi,

Lets say we have an object and on the lightning component we are displaying its details. when ever i click on the button i need to pass record id to the controller.

This how my code look like:-
<aura:iteration items="{! v.vegs}" var="veg">
            <div class='tile' aura:id="test1" press="{! c.tester}" >              
                <img src='{! veg.Image__c}'  onClick="{! c.tester}" aura:id="imgId" value="{! veg.Name }"> </img>
                Name: {! veg.Name } <br></br>             
                price: {! veg.Price__c }   <br></br>
                <ui:button label="Add to cart" press="{! c.addToCart}"  aura:id="btn1" >      </ui:button>               
           </div>
</aura:iteration>

I want something similer to :-
 
<aura:iteration items="{!v.newCases}" var="case">
<button type="button" onclick="{!c.showCaseDeleteModal(case.Id)}">Delete</button>
</aura:iteration>


How can I pass the id to a component controller when the  button gets clicked?


Thank you!
I am attempting to use the dhtmlx gantt chart in salesforce.  Currently I am trying to display all cases from all accounts that meet certain critieria.  Then I would like to use those cases and associated dates in a field to populate Gantt chart.  Looking for any assistance possible.  I cannot get a visualforce page to show any case information when I use a basic controller.

<apex:page standardController="Case" >
    <apex:form >
        <apex:pageBlock >  
            <apex:pageMessages />
            <apex:pageBlockButtons> 
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
              <apex:PageBlockTable value="{!Case}" var="c">
                <apex:column value="{!c.Account}"/>
                  <apex:column value="{!c.Number}"/>
                <apex:column value="{!c.Owner}"/>
                <apex:column headerValue="Install Date">
                    <apex:inputField value="{!a.Planned_Install_Date__c}"/>
                </apex:column>
            </apex:PageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
How can I auto lauch a visual force page in Lightning from an action button that calls a controller and redirects to a custom object and stays in lightning?  I need all this to happen in one click.

We currently have a process that takes the values from the opportunity and populates a custom object.  This process uses field ID's to map the values to a custom object.  The existing button does not appear in "Lightning Experience."  The only way that is obvious to accomplish this task in the "Lightning Experience" is to utilize a visual force page. The user should click a Lightning Experience "Action" button.  The page should launch automatically, execute code in the controller and return to the visual force page to "navigatetoSObject."   It is important that the user has a limited number of clicks that they have to execute.  The "navigatetoSObject" is necessary so the user is not forced back into "Salesforce Classic" mode.  If a PageReference is executed in the controller "Salesforce Classic" appears even though the user has chosen to be in the "Lightning Experience." 


 
  • December 28, 2016
  • Like
  • 0

Hi there

 

It seems to me that the "ALL ROWS" keyword that you use in SOQL (to access records in the recycled bin) can only be used in Apex.

 

I went to Developer Console in the Query Editor and tried typing this

 

SELECT ID FROM Fruit__c 

and it executes.

 

But If I add "ALL ROWS" at the end, i.e.

SELECT ID FROM Fruit__c ALL ROWS

 

then I got

"Unknown error parsing query" error.

 

If I write this in an Apex code, like this

 

List<Fruit__c> fruits = [SELECT ID FROM Fruit__c ALL ROWS];

 

then the line actually executes successfully.

 

It seems weird to me that "ALL ROWS" keyword cannot be used inside the Query Editor.  Wondering if anyone has encountered that?

 

Thanks

King

Hi,

 

Is there any way that i can search for any text in a class/page while working in Developer Console. I have a long class with thousand lines of code and need to find some specific text in that class. Browsers 'Ctr + F' does not works. It only shows me the search results from the few lines of code that is visible on the page.

 

Does DC provides any search text box which i am missing which i can use to search the text from my code?

  • September 14, 2012
  • Like
  • 1

On a VF page, I have a pageBlockTable.  There are times where there are more than 1000 records in the collection to be rendered.  When this occurs, the Visualforce collection limit of 1000 is hit and the page doesn't load.  I need to figure out a creative solution for getting around this.  In the end...

 

  1. I need all records to render on the page. If I do any pagination, it'll happen client-side after the records are loaded in the HTML.  I know the first responses to this will be about whether I really need to have all those records on the page and how there is doubt about whether I need to, but for the purposes of this forum post, please work with me here.
  2. I want to keep the look and feel of a pageBlockTable if possible.

 

When not using pageBlockTables, I have used a construct similar to the following to get through a collection of more than 1000 items.

 

<apex:repeat value="{!myCollection}" var="item" rows="1000" first="0">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="1000">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="2000">
{!item.text}
</apex:repeat>

 

pageBlockTable has the rows and first parameters, but if I do that, I'd be getting a new pageBlockTable everytime.

 

The options I can think of are:

 

  • Get a creative solution from the forums to actually utilize the pageBlockTable (purpose of this post)
  • Use apex:dataTable and try to use style classes to mimix the pageBlockTable look and feel. This is a nice possibility I haven't tried yet.
  • Use apex:repeat tags and make up my own HTML styling

 

Any help is appreciated.

 

 

  • September 13, 2010
  • Like
  • 0

Hi all,

 

Im newbie in force.com, and i have a question, my question is that: i want to export list of object into CSV file using Apex. So please help me how to do this?

 

Thanks,

I want to displqy events field on email template. so plz help me or suggest what can i do to print any of field may be standard or custom in email template

I use a controller to display a list of products with a checkbox against each product value . When the end user selects few products and clicks "add quantity" button it should navigate to another VF page in which i should display the selected products and an input filed for quantity. Quite similiar to the way of adding products in opportunity. In the code below im using a single controller for 2 VF pages. Problem i m facing here is when the second page is called the wrapperList becomes null instead of holding the values of the selected products. Please give me some suggestions.

 

public with sharing class productAdd
{        
    public  List<Product2> Stdproduct{get;set;}
    public List<wrapper> wrapperList {get;set;}  
    public list<wrapper> SelectedprodList{get;set;}	
    public class wrapper
    {
        public product2 cont{get;set;}
        public Boolean selected{get;set;}
        public integer quantity{get;set;}
        public wrapper(product2 c)
        {
            cont = c;
            selected = false;
        } 
    }
	public  List<wrapper> getProdList()
    {        
        if((wrapperList == null) || (wrapperList.size() == 0))
        {                      
            wrapperList = new List<wrapper>();
            Stdproduct = [Select id, Name from product2 limit 2];           
            for(Product2 c :(List<Product2>)Stdproduct)            
            {               
                wrapperList.add(new wrapper(c));
            }
        }             
        return wrapperList;
    }
    
    public PageReference AddQuantity()
    {   
        PageReference pageRef= new PageReference('/apex/AddQuantity');
        pageRef.setredirect(true);        
        return pageRef;           
    }

    public list<wrapper> getSelectedproducts()
    {
        selectedprodList = new list<wrapper>();      
        for(wrapper cCon:getProdList())
        {            
            if(cCon.selected==true)  
            {                        
                selectedprodList.add(cCon);
            }                           
        }        
        return selectedprodList;           
    }        
}

<!-- 1st Page -->
<apex:page Controller="productAdd" sidebar="false">
    <table  width="90%">
	    <apex:form>
			<apex:repeat value="{!ProdList}" var="l" >               
				<tr>
				<td>
				<apex:inputCheckbox value="{!l.selected}"/>
				</td>
				<td class="fieldname">{!l.cont.name}</td>                       
				</tr>                
			</apex:repeat>
				<tr>
				<apex:commandButton value="Add Quantity" action="{!AddQuantity}"/>
				</tr>             
	    </apex:form> 
    </table>
</apex:page>


<!-- 2nd Page -->
<apex:page Controller="productAdd">
	<apex:form >
		<apex:pageBlock > 
			<apex:pageBlockTable value="{!Selectedproducts}" var="c" id="table"> 
				<apex:column value="{!c.cont.Name}" />                
				<apex:column >
				<apex:inputText value="{!c.quantity}"/>
				</apex:column> 
			</apex:pageBlockTable> 
		</apex:pageBlock> 
	</apex:form> 
</apex:page>