• Andrei Kuznetsov
  • NEWBIE
  • 55 Points
  • Member since 2010
  • SFDC Solutions Technical Analyst
  • T1CRM

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 25
    Replies
Hello,
  Can anybody tell me the diffrence ​between execute and executebatch in BatchApex?

Thanks in advance
  • August 10, 2015
  • Like
  • 0
Hello everyone!

I'm trying to run command line Data Loader. I used to do it years ago and cannot recall I had such a problem. The error I'm getting is this: "Error loading config fil: filepath\config.properties. Please make sure that it exists and is readable."

The file is there and I tried some troubleshooting, including providing global filepath and downgrading Data Loader version from 36.0 to 29.00. The problem is still there. Please help!

Regards
Hello Salesforce.com professionals!

I've run into the following situation and need some help in investigation. I have VF page, which consist of tabs. Let's call this page 'MainPage'. Each tab is VF Component.

**************************************************
    <apex:tabPanel switchType="client" value="{!selectedTab}" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" >       
        <apex:tab label="{!dealObjectLabel} Details" name="DealDetails" id="tabOne">
            <c:DealDetails value="{!deal}" parentController="{!parentControl}"/>
        </apex:tab>        
        <apex:tab label="Team Members" name="DealTeamMembers" id="tabTwo" disabled="{!dtmDisabled}">
            <c:DealTeamMembers value="{!deal}" parentController="{!parentControl}"/>
        </apex:tab>       
        <apex:tab label="Products" name="DealProducts" id="tabThree" disabled="{!dpDisabled}">
            <c:DealProducts value="{!deal}" parentController="{!parentControl}"/>
        </apex:tab>       
        <apex:tab label="Contacts" name="DealContacts" id="tabFour" disabled="{!dcDisabled}">
            <c:DealContacts value="{!deal}" parentController="{!parentControl}"/>
        </apex:tab>
    </apex:tabPanel>   
    </apex:outputpanel>
**************************************************
Each VF component has its own controller, and it's own custom Save() function. Each VF component calls that corresponding Save() function using jscript. Exaple of Save() function on DealDetails component:

**********************************************
        function saveDetail()
        {     
            commitSave_D(true);
        }

            <apex:actionFunction name="commitSave_D" action="{!doSave}" reRender="ownerSecID,pbs1,pbsNotes,generalerrors" >
                <apex:param name="y_Detail" value="y_Detail" assignTo="{!isFromParent_Detail}" />
            </apex:actionFunction>
**********************************************
There is 'Save and Close' button on the 'MaingPage', which will call its own Save jscript function. This jscript function calls Save jscript functioin on each individual component.
******************************************** Save function on MainPage ************************************
        function saveAllComponents()
        {
            if (!isCurrentlySaving)
            {              
                setButtonStates(true);
                isCurrentlySaving = true;
                errorMessages = "";
                isSavingAll = true;
                saveDetail();
                saveProducts();
                saveContacts();
            }
        }
********************************************
The problem that customer has is ocassional hanging up and timing out of the 'MainPage' when they click on 'Save and Close' button. The question is if it's possible that calling having Saving code in mulitples components and controllers can cause this type of slowdown? Will it be significantly faster if entire Saving code was called from the MainPage?

Thanks!
Hi,
We implemented custom Ideas using Idea Themes. The code works fine, but there is one problem. When ideas are resorted by Top Points and user goes to the next page of ideas, <apex:vote> components is displayed beside wrong records. For example, if my top idea has 200 points, and idea on the second page on the top only has 50 points, the 200 points will be displayed. I saw other people have the same problem, haven't seen any solution for it. Here is my code:
=========================================================================================================
<apex:pageBlock title="{!$ObjectType.Idea.LabelPlural} | {!$Label.Contributions}">
<apex:dataList style="list-style-type:none;" value="{!modifiedIdeas}" var="ideadata" id="apples">
<apex:outputPanel rendered="{!($CurrentPage.parameters.sort != 'comments')}" id="ideaOutput">
<apex:panelGrid columns="3" cellspacing="10" columnClasses="columnTop">
<apex:vote objectId="{!ideadata.Id}" id="vte" />
<apex:image style="border:2px solid #335CAD;" url="{!ideadata.CreatorSmallPhotoUrl}" height="40px" width="40px"/>
<apex:panelGroup >
<ideas:detailoutputLink styleClass="ideaTitle" style="color:#335CAD;" ideaId="{!ideadata.Id}" page="ViewPage">{!ideadata.Title}</ideas:detailoutputLink>
&nbsp;
<apex:outputText style="background-color:#FFFF94;font-size:12px;font-weight:bold;" value=" {!ideadata.Status} " rendered="{!ideadata.Status != ''}"/>
<br />
<span style="color:#990000; font-weight:bold; font-size:10px;">
<apex:outputText value="{!$Label.Posted_by}: "/>
<apex:outputLink style="text-decoration:none;" value="/apex/IdeaProfilePage?c={!currentZone}&u={!ideadata.CreatedBy.Id}&sort=ideas">{!ideadata.CreatedBy.CommunityNickname}</apex:outputLink>
<apex:outputText value="{!IF(ideadata.Categories != '',' -- ','')}" />
<apex:outputText value="{!SUBSTITUTE(ideadata.Categories,';',' | ')}"/>
<apex:outputText value=" -- {!ideadata.CreatedDate}"/>
<br /><br />
</span>
<apex:outputText escape="false" value="{!ideadata.Body}"/><br /><br />
<apex:outputLink styleClass="commentLink" style="color:#335CAD;" value="/apex/ViewPage?id={!ideadata.Id}">[{!ideadata.NumComments} {!$Label.Comments}]</apex:outputLink>
</apex:panelGroup>
<br />
</apex:panelGrid>
</apex:outputPanel>
</apex:dataList>
<apex:pageBlockButtons location="top">
<apex:commandButton value="{!$Label.Post_Your_Idea}" action="{!getPostPage}"/>
</apex:pageBlockButtons>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}" >{!$Label.Prev}</apex:commandLink>&nbsp;&nbsp;
<apex:commandLink action="{!next}" rendered="{!hasNext}" >{!$Label.Next}</apex:commandLink>
</apex:pageBlock>
==============================================================================================================
 
Hi. Our company wants to use standard Content tab in our new partner community. But, we need to come up with more intuitive name and having it displayed to portal users. Content tab is not available for renaming so I took two approaches, first to use Web tab with the following url:
http://cs3.salesforce.com/sfc/#search. The problem with this apporach as that it shows up as tab with another Salesforce screen inside.

The second approach was to have VF tab with VF page like this:

<apex:page action="/sfc/#search" tabstyle="Search__tab">
</apex:page>

But, Content tab is still displayed. I couldn't find any solution on internet.

Thank you!

Hi All,

I have web tab that points to Opportunities standard object. The URL is http:///006/o?isdtp=vw, and I expected this to mimic Opportunities standard tab. And the page that opens up looks pretty much the same. But, neither New nor New Opportunity buttons don't work. Nothing happens when I click on them. Does anyone know why? Note: creating VF tab that points to Opportunities object works fine with regard to the same buttons. Thank you!

Hi,

 

I've created Page that will display all Contacts for the Account. Beside each Conact there is a check box. User will check some Contacts and click on Update button. This action will copy Account's address to all selected contacts' addressess. Here is my controller. Now, how do I test it so I have 100% coverage?

 

=============================================================================================

public class TD_ContactsAddressController
{
    List<contactwrapper> contactList = new List<contactwrapper>();
    List<Contact> selectedContacts = new List<Contact>();
    // Sorting
    List<Contact> sortContacts = new List<Contact>();
    public String sortField {get; set;}
    public String previousSortField {get; set;}
   
    //Constructor
    public TD_ContactsAddressController(ApexPages.StandardController controller){
 
    }
       
    public List<contactwrapper> getContacts()
    {
        contactList.clear();
        for(Contact c : [SELECT Name, Title, Email, Phone, Employed_By__c, TD_Use_Account_Address__c from Contact where AccountId = :Apexpages.Currentpage().getparameters().get('Id') ORDER BY Name ASC])
        {           
            sortContacts.add(c);
            System.debug('sortContacts: ' + sortContacts);
            contactList.add(new contactwrapper(c)); 
            System.debug('contactList: ' + contactList);         
        }
       
        if (contactList != null && !contactList.IsEmpty())
        {    return contactList;     }
        {    return null;            }
    }
   
    public PageReference getSelected()
    {
        selectedContacts.clear();
        for(contactwrapper conwrapper : contactList)
        if(conwrapper.selected == true)
        selectedContacts.add(conwrapper.con);
        return null;
    }
   
    public List<Contact> GetSelectedContacts()
    {
        if(selectedContacts.size()>0)
        return selectedContacts;
        else
        return null;
    }   
   
    public class contactwrapper
    {
        public Contact con{get; set;}
        public Boolean selected {get; set;}
        public String ContactURL {get;set;}
        public contactwrapper(Contact c)
        {
            con = c;
           ;
            ContactURL = '/' + c.Id;
        }
    }
   
    //Sorting.
    public void doSort(){
        String order = 'asc';
       
        /*This checks to see if the same header was click two times in a row, if so it switches the order.*/
        if(previousSortField == sortField){
            order = 'desc';
            previousSortField = null;
        }else{
            previousSortField = sortField;
        }
      
        //To sort the table we simply need to use this one line, nice!
        superSort.sortList(sortContacts, sortField, order);
    }   
   
    // Update Contacts
    public PageReference doUpdateAddress(){
        for (Contact c : selectedContacts)
        {
            c.TD_Use_Account_Address__c = true;
        }
       
        try {
          update selectedContacts;         
          }
        catch (DmlException e) {
          ApexPages.addMessages(e);
          }
        return new PageReference('/'+ ApexPages.currentPage().getParameters().get('id'));       
    }
 }

=============================================================================================

 

Thank you!

Hello! I'm new to salesforce and just received my first sophisticated task. Our org is quite plane and I can't find any good examples of Visualforce pages and apex code. Here is my task and if anyone has done something similar, please advice me how to approach it.

 

On Account standard screen I need to place button, let's call it 'Use Account Address'. Clicking on this button should open up VF page that list all the Contacts for this Account. Beside each Contact record there should be check box. There should be also 'Update Selected' button on this page, clicking on which will update all selected Contacts with Account's address and return user back to Account page.

 

Thanks a lot in advance!

Hi,
We implemented custom Ideas using Idea Themes. The code works fine, but there is one problem. When ideas are resorted by Top Points and user goes to the next page of ideas, <apex:vote> components is displayed beside wrong records. For example, if my top idea has 200 points, and idea on the second page on the top only has 50 points, the 200 points will be displayed. I saw other people have the same problem, haven't seen any solution for it. Here is my code:
=========================================================================================================
<apex:pageBlock title="{!$ObjectType.Idea.LabelPlural} | {!$Label.Contributions}">
<apex:dataList style="list-style-type:none;" value="{!modifiedIdeas}" var="ideadata" id="apples">
<apex:outputPanel rendered="{!($CurrentPage.parameters.sort != 'comments')}" id="ideaOutput">
<apex:panelGrid columns="3" cellspacing="10" columnClasses="columnTop">
<apex:vote objectId="{!ideadata.Id}" id="vte" />
<apex:image style="border:2px solid #335CAD;" url="{!ideadata.CreatorSmallPhotoUrl}" height="40px" width="40px"/>
<apex:panelGroup >
<ideas:detailoutputLink styleClass="ideaTitle" style="color:#335CAD;" ideaId="{!ideadata.Id}" page="ViewPage">{!ideadata.Title}</ideas:detailoutputLink>
&nbsp;
<apex:outputText style="background-color:#FFFF94;font-size:12px;font-weight:bold;" value=" {!ideadata.Status} " rendered="{!ideadata.Status != ''}"/>
<br />
<span style="color:#990000; font-weight:bold; font-size:10px;">
<apex:outputText value="{!$Label.Posted_by}: "/>
<apex:outputLink style="text-decoration:none;" value="/apex/IdeaProfilePage?c={!currentZone}&u={!ideadata.CreatedBy.Id}&sort=ideas">{!ideadata.CreatedBy.CommunityNickname}</apex:outputLink>
<apex:outputText value="{!IF(ideadata.Categories != '',' -- ','')}" />
<apex:outputText value="{!SUBSTITUTE(ideadata.Categories,';',' | ')}"/>
<apex:outputText value=" -- {!ideadata.CreatedDate}"/>
<br /><br />
</span>
<apex:outputText escape="false" value="{!ideadata.Body}"/><br /><br />
<apex:outputLink styleClass="commentLink" style="color:#335CAD;" value="/apex/ViewPage?id={!ideadata.Id}">[{!ideadata.NumComments} {!$Label.Comments}]</apex:outputLink>
</apex:panelGroup>
<br />
</apex:panelGrid>
</apex:outputPanel>
</apex:dataList>
<apex:pageBlockButtons location="top">
<apex:commandButton value="{!$Label.Post_Your_Idea}" action="{!getPostPage}"/>
</apex:pageBlockButtons>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}" >{!$Label.Prev}</apex:commandLink>&nbsp;&nbsp;
<apex:commandLink action="{!next}" rendered="{!hasNext}" >{!$Label.Next}</apex:commandLink>
</apex:pageBlock>
==============================================================================================================
 
So...I created my almost very first trigger...it's not firing. Please help. I pieced together code from different sources and thought I was on the right track...hmmmm

Trying to create a contract when the checkbox "Ready for Contract" is checked. Do I need the opportunity ID as well? Not sure why this is not working. Thanks in advance for help. Shannon

trigger CreateContract on Opportunity (before insert) {
 private List<Contract> ctr = new List<Contract>();
  
  for(Opportunity o : Trigger.new) {
    if(o.Ready_for_Contract__c = true) {
      Contract c = new Contract(Id = o.Account.Id,
                                Name = o.Name,
                                Status = 'Activated',
                                Total_Contract_Value__c = o.Total_Sales_Price_of_Products__c,
                                StartDate = o.Contract_Start_Date__c,
                                Payment_Status__c = 'Ready to Be Invoiced');
      ctr.add(c);
      }
      insert ctr;
      }
      }
Hi Experts,

Could you tell me the explantion and soluation on this please " Need to create a new page layout for the object WPD Task for the MRS Operational Multi User profile  and assign this new page layout to MRS Operational MultiUser profile". 

Thanks in advance
Hello,
  Can anybody tell me the diffrence ​between execute and executebatch in BatchApex?

Thanks in advance
  • August 10, 2015
  • Like
  • 0
Hi all

I have a custom VF page to list the Ideas. I have included pagination to display 5 ideas per page. I have used <apex:vote> component to display the promote/demote details.

The issue is, the first time the page is displayed, the vote component is bindied properly. Once we hit the 'Next Page' link, the vote component remains the same as the first page irrespective of the current idea status. I have displayed the associated Idea id to make sure that new ids are bindied and it is.

Is this a Salesforce VF issue or Is there any set up that needs to be done to refresh the VF vote correctly? Can somebody point us in the right direction to resolve this issue?

Thanks
Hi. Our company wants to use standard Content tab in our new partner community. But, we need to come up with more intuitive name and having it displayed to portal users. Content tab is not available for renaming so I took two approaches, first to use Web tab with the following url:
http://cs3.salesforce.com/sfc/#search. The problem with this apporach as that it shows up as tab with another Salesforce screen inside.

The second approach was to have VF tab with VF page like this:

<apex:page action="/sfc/#search" tabstyle="Search__tab">
</apex:page>

But, Content tab is still displayed. I couldn't find any solution on internet.

Thank you!

Hi All,

I have web tab that points to Opportunities standard object. The URL is http:///006/o?isdtp=vw, and I expected this to mimic Opportunities standard tab. And the page that opens up looks pretty much the same. But, neither New nor New Opportunity buttons don't work. Nothing happens when I click on them. Does anyone know why? Note: creating VF tab that points to Opportunities object works fine with regard to the same buttons. Thank you!

I have a VF page that displays a series of records with a checkbox next to each record.  I have a command button that allows the user to update selected records.

 

The problem is my uptest method is returns an empty list when I try to call my update method that processes the selected records.

 

Here is my VF page:

 

<apex:page title="Unbilled Project Time" StandardController="Project_Invoice__c" extensions="ProjectTimeController">
    <script>
    	function checkAll(cb){
    		var inputElem = document.getElementsByTagName("input");
    		for(var i=0; i<inputElem.length; i++){
        		if(inputElem[i].id.indexOf("selectLine")!=-1){
            		inputElem[i].checked = cb.checked;
        		}
    		}
		}
    </script>
    <apex:sectionHeader title="Project Name: {!ProjectName} - Invoice Number: {!InvoiceNumber}" />
    <apex:form >
    	<apex:pageBlock id="pgBlock" >
    	<apex:pageMessages />
    		<apex:PageBlockButtons location="both" >
            <apex:commandButton value="Update Project Time" action="{!processProjectTimeUpdates}" reRender="pgBlock" />
        </apex:PageBlockButtons>
    		<apex:pageBlockTable value="{!ProjectTime}" var="p" id="theTable" rowClasses="odd,even">
            	<apex:column >
                	<apex:facet name="header">
                    	<apex:inputCheckbox onclick="checkAll(this)" />
                	</apex:facet>
                	<apex:inputCheckbox value="{!p.selected}" Id="selectLine" />
            	</apex:column>      
            	<apex:column >
                	<apex:facet name="header">
                    	Project Time #
                	</apex:facet>
                	<apex:outputLink value="/{!p.projTime.Id}">{!p.projTime.Name}</apex:outputLink> 
            	</apex:column>
            	<apex:column >
                	<apex:facet name="header">
                    	Project
                	</apex:facet>
                	<apex:outputLink value="/{!p.projTime.Project__c}">{!p.projTime.Project__r.Name}</apex:outputLink> 
            	</apex:column>
            	<apex:column >
                	<apex:facet name="header">
                    	Work Date
                	</apex:facet>
                	<apex:outputText value="{0,date,MM/dd/yyyy}">
                		<apex:param value="{!p.projTime.Work_Date__c}" />
                	</apex:outputText>
            	</apex:column>
            	<apex:column >
                	<apex:facet name="header">
                    	Hours
                	</apex:facet>
                	<apex:outputText value="{!p.projTime.Hours__c}" />
            	</apex:column>
            	<apex:column >
                	<apex:facet name="header">
                    	Hourly Rate
                	</apex:facet>
                	<apex:outputText value="{!p.projTime.Hourly_Rate__c}" />
            	</apex:column>
            	<apex:column >
                	<apex:facet name="header">
                    	Fee Amount
                	</apex:facet>
                	<apex:outputText value="{!p.projTime.Fee_Amount__c}" />
            	</apex:column>
    		</apex:pageBlockTable>
    	</apex:pageBlock>
    </apex:form>
     
 
</apex:page>

 

 

Here is my controller:

 

public class ProjectTimeController {
	
	private List<Project_Invoice__c> listPI = new List<Project_Invoice__c>();
    public String getProjectName() {return listPI[0].Project__r.Name;}
    public String getInvoiceNumber() {return listPI[0].Invoice_Number__c;}
	private List<ProjectTimeLines> ProjectTimeList {get; set;}
	
	
	public ProjectTimeController(ApexPages.StandardController stdController) 
    {
    	listPI = [Select Project__r.Name, Invoice_Number__c From Project_Invoice__c Where Id = :ApexPages.currentPage().getParameters().get('Id')];
    }
    
    public List<ProjectTimeLines> getProjectTime()  
    {
    	ProjectTimeList = new List<ProjectTimeLines>(); 
    	
    	List<Project_Time__c> lstPT = [Select Id, Name, Hours__c, Hourly_Rate__c, Fee_Amount__c, Work_Date__c, Project__c, Project_Invoice__c, Project__r.Name, Project__r.Id From Project_Time__c Where Fee_Amount__c > 0 AND Project_Invoice__c = null Order By Project__r.Name, Work_Date__c ASC];
    	   
    	for (Project_Time__c pt : lstPT) {   
    		ProjectTimeList.add(new ProjectTimeLines(pt));
    	}
    	 	  	
 	  	return ProjectTimeList;
    }
    
    public PageReference processProjectTimeUpdates()
    {
        List<Project_Time__c> selectedPTLs = new List<Project_Time__c>();
        List<Project_Time__c> ptls = new List<Project_Time__c>();
        for(ProjectTimeLines pt : ProjectTimeList){
            if(pt.selected){
                selectedPTLs.add(pt.projTime);
            }
        }
        
        Project_Invoice__c pi = [Select Id From Project_Invoice__c Where Project__c =: selectedPTLs[0].Project__c];
        string str = '';
        if (selectedPTLs.size() != 0) {
        	for(Project_Time__c p : selectedPTLs){
        		str += p.Name + ', ';
            	p.Project_Invoice__c = pi.Id;
            	ptls.add(p);
        	}
        	update ptls;
			ApexPages.Message msg = new ApexPages.message(ApexPages.Severity.CONFIRM, 'The following Project Time records: ' + str + ' have been successfully updated.');
			ApexPages.addMessage(msg);

        	return null;
        }
        else {
        	ApexPages.Message msg = new ApexPages.message(ApexPages.Severity.ERROR, 'No records selected.  Please select at least one record.');
        	ApexPages.addMessage(msg);
        	
        	return null;	
        }
    }
    
    public class ProjectTimeLines 
    {
    	public Project_Time__c projTime {get; set;}
    	public Boolean selected {get; set;}
    	
    	public ProjectTimeLines(Project_Time__c  pt) {
    		projTime = pt;;	
    	}	
    }
    
    static testMethod void test() 
    {	
    	Project__c p = new Project__c(Name = 'Test Project', Hourly_Rate__c = 80.00);
    	insert p;
    	
    	Project_Invoice__c pi = new Project_Invoice__c(Project__c = p.Id);
    	insert pi;
    	
    	Project_Time__c pt = new Project_Time__c(Project__c = p.Id, Work_Date__c = System.today());
    	insert pt;
    	
		PageReference page= new PageReference('/apex/ProjectTimeUnbilled?Id='+ pi.Id);
        Test.setCurrentPage(page);
        
        
        ApexPages.StandardController ctl = new ApexPages.StandardController(pi);
        ProjectTimeController Ctrl = new ProjectTimeController(ctl);
        
        
        Ctrl.getProjectTime();
        Ctrl.getProjectName();
        Ctrl.getInvoiceNumber();
        //Ctrl.processProjectTimeUpdates();
    }

}

 

This is the line that that returns the empty list:

 

Project_Invoice__c pi = [Select Id From Project_Invoice__c Where Project__c =: selectedPTLs[0].Project__c];

 

 

Thanks for any help

Hello! I'm new to salesforce and just received my first sophisticated task. Our org is quite plane and I can't find any good examples of Visualforce pages and apex code. Here is my task and if anyone has done something similar, please advice me how to approach it.

 

On Account standard screen I need to place button, let's call it 'Use Account Address'. Clicking on this button should open up VF page that list all the Contacts for this Account. Beside each Contact record there should be check box. There should be also 'Update Selected' button on this page, clicking on which will update all selected Contacts with Account's address and return user back to Account page.

 

Thanks a lot in advance!

Does anybody know how to use the Apex:vote component?