• Amol Dixit
  • NEWBIE
  • 5 Points
  • Member since 2012


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 13
    Replies
Hi,

I am trying to incorporate apex:chart, but it is not getting displayed.

I have one panel which includes another visualforce page having apex:chart.

But the apex:chart is not getting rendered.
<apex:outputPanel id="chartPanel">
		 	<apex:chart height="400" width="700" data="getRemoteData" name="RemotingLineChart">
				    	  <apex:axis type="Numeric" position="left" fields="data1" 
				            title="Opportunities Closed" grid="true"/>
				    	  <apex:axis type="Category" position="bottom" fields="name" 
				            title="Month of the Year">
				    	</apex:axis>
				    	<apex:lineSeries axis="left" fill="true" xField="name" yField="data1"
				          markerType="cross" markerSize="4" markerFill="#FF0000"/>
			</apex:chart>
        </apex:outputPanel>

I am including the page dynamically on click of tab.
<apex:outputpanel id="includeDynamicPageId">
            <apex:insert name="pageContent" />
            <div>
                <apex:include pageName="{!childPagereference}" id="childPageId" rendered="{!isRenderChildPage}"/>
            </div>
          </apex:outputpanel>

Tried with Remoting as well but its not working.

If i go to inline page individually, then graph gets displayed. Only issue is when i use it as a include page.

Could you please help me out.

Thank you.
Warm Regards,
Amol
Hi,

I am trying to write Test method to test record access with different profiles. I have one profile for which dont have access to payment records, trying to simutate the same, but In test class, getting Access to Payment records. Due to which assert it failing.

Through salesforce UI, I dont get record access with that profile.  Is there anything I am missing? Could you please help me out in this. Sample code below.
User userObj = TestDataUtility.createUsers(1, 'Charity Auctions Administrator', 'testAuctionAdmin', true )[0];
		System.runAs(userObj){
			List<Account> accountList = TestDataUtility.createAccounts(1, true);
			if(!Utilities.isEmpty(accountList)){
					//Insert single Auction Record.
					List<Auction__c> auctionList = TestDataUtility.createAuctions(1,accountList[0].id, true);
					//Create User
					
					for(Auction__c auctionObj : auctionList){
						auctionObj.Bid_Amount__c = 200;
						auctionObj.High_Bidder__c = userObj.id;
						auctionObj.Auction_Status__c = Constants.AUCTION_STATUS_ENDED;
					}
		
					AuctionStatusChangeHandler.isTriggerInvoked = false;
					//Update Auctions so that Auction status changed to "Ended", Payment records gets created here.
					upsert auctionList;
			}
		}
		
		userObj = TestDataUtility.createUsers(1, 'Charity Auctions Charity', 'testCharityUser', true )[0];
			
		System.runAs(userObj){
			List<Payment__c> accountPaymentList = [Select (Select Id, name, OwnerId, RecordTypeId, Payment_Amount__c, Account__c, Auction__c, Payment_Status__c, Payment_Date__c From Payments__r) From Account limit 1].Payments__r;
			System.debug('Owner===>' + accountPaymentList[0].OwnerId);
			System.debug('userObj===>' + userObj.Id);
			
//Here this Assert is failing, I should get 0 records but getting 1 record.
			System.assertEquals(0, accountPaymentList.size());
		}

 
Hi I am trying to use Chatter Actions links (PILOT). I need more clarity on following points.

1. Feed Element Capabilities ( Banner capability, Bundle Capability)
2. Error handling in case of Asynchronous API calls and Update Status of Action Link

 I am able to post the chatter actions in feeds, but how to add Feed elment capabilities in request JSON.

{
    "body": {
        "messageSegments": [
            {
                "type": "Text",
                "text": "Either Accept Or Reject. This is chatter post with Actions"
            }
        ]
    },
    "subjectId": "me",
    "feedElementType": "feedItem",
    "capabilities": {
        "associatedActions": {
            "actionLinkGroupIds": [
                "0Ago00000000006CAA"
            ]
        }
    }
}
How to add capabilities in request JSON?

Also I am able to post the Action links, how to handle the exception/response in action links(These links would be present in Chatter feed). Also i am not sure how to update the status of Action link?

Requesting you to please clarify/ answer above points.


Thanks in advance

Hi,

 

I want to get User level Salesforce Password policies fields such as

 

1) User password Expire in

2) Minimum password length. etc.

 

To enforce it on my custom password, whether it is following it or not? (In custom page with APEX and VF)

 

What objects are used for this, I have searched it, but couldn't found. Is there any API provided for this?

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I want to implement change password functionality on my page, for that purpose I have created one component. (Same code like standard changepassword page) But when I am trying to change password the error Message appears "The system is unable to change your password.".

 

component is:

 

 

<apex:component controller="ChangePasswordController">
      <center>
        <apex:panelGrid bgcolor="white" columns="1"> 
          <br/>
          <br/>
          <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="1" styleClass="topPanelContainer"> 
            <br/>
            <apex:outputPanel layout="block" styleClass="topPanel">
              <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="2"> 
                <apex:image url="{!URLFOR($Resource.SiteSamples, 'img/clock.png')}"/>
                <apex:panelGroup >
                  <br/>
                  <apex:outputText styleClass="title" value="{!$Label.site.change_your_password}"/>
                  <br/>
                  <apex:form id="theForm">
                    <apex:panelGrid columns="2" style="margin-top:1em;">
                      <apex:outputLabel rendered="{! !$Site.IsPasswordExpired}" value="{!$Label.site.old_password}" for="oldpsw"/>
                      <apex:inputSecret required="true" id="oldpsw" rendered="{! !$Site.IsPasswordExpired}" value="{!oldPassword}"/>
                      <apex:outputLabel value="{!$Label.site.new_password}" for="psw"/>
                      <apex:inputSecret required="true" id="psw" value="{!newPassword}"/>
                      <apex:outputLabel value="{!$Label.site.verify_new_password}" for="vpsw"/>
                      <apex:inputSecret required="true" id="vpsw" value="{!verifyNewPassword}"/>
                      <apex:outputText value=""/>
                      <apex:commandButton id="cpwbtn" action="{!changePassword}" value="{!$Label.site.change_password}"/>
                    </apex:panelGrid> 
                  </apex:form>                  
                  <br/>
                </apex:panelGroup>
              </apex:panelGrid> 
             </apex:outputPanel>
            <c:SiteFooter />
          </apex:panelGrid> 
       </apex:panelGrid>
      </center>
      <br/>
</apex:component>

 Page is :

<apex:page id="ProfilePage" controller="UserProfileController" sidebar="false" showheader="false">
<apex:composition template="SecondaryTemplate">

    <apex:define name="pageContent">
     	<apex:form >		    
		    <div class="breadcrumbs">
                <apex:commandLink id="HomeLink" value="{!$Label.Home}" action="{!navigateToHomePage}"></apex:commandLink>
                <apex:outputLabel value = " > " styleClass="sep-current"/>
                <apex:outputLabel styleClass="currentPage" value="{!$Label.Profile}"/>                
            </div>
            <apex:outputPanel id="msgRenderer">
		   		<div id="errMsg">
		   		<apex:pageMessages />
		   		</div>
		    </apex:outputPanel>  
		</apex:form>

            <div class="page-header">{!$Label.Profile}</div>   

			<c:ChangePasswordComponent id="ChangePasswordComponent"/>
	        <div style="height:30px;">
	        </div>
	        
	     
	       
    </apex:define>
</apex:composition>
</apex:page>

 Is that message coming because of security constraints or any other problem is there?
 also I want to ask that can we iclude component in component?

 

 

 

Please help me out.

 

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I have created Configuration file to schedule Dataloader through CLI(Command Line Interface). I have setted Time Zone as "GMT", and Use Europian Format as a true. But it is taking one day less.

 

That means reading one day less from actual date.

 

 

Please provide me the solution for this.

 

 

  <map>
                <entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
    
    <entry key="process.outputError" value="c:\Program Files\salesforce.com\Data Loader\Test\error.txt"/>
                <entry key="process.outputSuccess" value="c:\Program Files\salesforce.com\Data Loader\Test\success.txt"/>
    <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="--"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="--"/>
                <entry key="process.encryptionKeyFile" value="c:\Program Files\salesforce.com\Data Loader\Test\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.externalIdField" value="AX_object__c"/>
                <entry key="sfdc.entity" value="AX_object__c"/>
                <entry key="process.operation" value="insert"/>
               <entry key="sfdc.timeZone" value="GMT"/>
              <entry key="process.useEuropeanDates" value="true"/>
              <entry key="dataAccess.name" value="c:\Program Files\salesforce.com\Data Loader\Test\SFData.csv"/>
              <entry key="process.mappingFile" value="c:\Program Files\salesforce.com\Data Loader\Test\axmapping.sdl"/>    
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
            </map>

 

I have Checked the log, Found some entries,

 

<sobj:Allocation_To__c xsi:type="xsd:dateTime">2014-07-11T18:30:00.000Z</sobj:Allocation_To__c>

 

<sobj:Allocation_From__c xsi:type="xsd:dateTime">2012-07-31T18:30:00.000Z</sobj:Allocation_From__c>

 

 

                <userLanguage>en_US</userLanguage>
                  <userLocale>en_US</userLocale>
                  <userName>admin@sfpmoportal.com</userName>
                  <userTimeZone>Asia/Calcutta</userTimeZone>

 

But I is taking wrong date. The fields are of type "Date", but taking as a "dateTime". Please help me out.

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I have created Configuration file to schedule Dataloader through CLI(Command Line Interface). I have setted Time Zone as "GMT", and Use Europian Format as a true. But it is taking one day less.

 

That means reading one day less from actual date.

 

 

Please provide me the solution for this.

 

 

  <map>
                <entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
    
    <entry key="process.outputError" value="c:\Program Files\salesforce.com\Data Loader\Test\error.txt"/>
                <entry key="process.outputSuccess" value="c:\Program Files\salesforce.com\Data Loader\Test\success.txt"/>
    <entry key="sfdc.endpoint" value="/>
                <entry key="sfdc.username" value="--"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="--"/>
                <entry key="process.encryptionKeyFile" value="c:\Program Files\salesforce.com\Data Loader\Test\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.externalIdField" value="AX_object__c"/>
                <entry key="sfdc.entity" value="AX_object__c"/>
                <entry key="process.operation" value="insert"/>
               <entry key="sfdc.timeZone" value="GMT"/>
              <entry key="process.useEuropeanDates" value="true"/>
              <entry key="dataAccess.name" value="c:\Program Files\salesforce.com\Data Loader\Test\SFData.csv"/>
              <entry key="process.mappingFile" value="c:\Program Files\salesforce.com\Data Loader\Test\axmapping.sdl"/>    
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
            </map>

 

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I have created Configuration file to schedule Dataloader through CLI(Command Line Interface). I have setted Time Zone as "GMT", and Use Europian Format as a true. But it is taking one day less.

 

That means reading one day less from actual date.

 

 

Please provide me the solution for this.

 

 

  <map>
                <entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
    
    <entry key="process.outputError" value="c:\Program Files\salesforce.com\Data Loader\Test\error.txt"/>
                <entry key="process.outputSuccess" value="c:\Program Files\salesforce.com\Data Loader\Test\success.txt"/>
    <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="--"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="--"/>
                <entry key="process.encryptionKeyFile" value="c:\Program Files\salesforce.com\Data Loader\Test\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.externalIdField" value="AX_object__c"/>
                <entry key="sfdc.entity" value="AX_object__c"/>
                <entry key="process.operation" value="insert"/>
               <entry key="sfdc.timeZone" value="GMT"/>
              <entry key="process.useEuropeanDates" value="true"/>
              <entry key="dataAccess.name" value="c:\Program Files\salesforce.com\Data Loader\Test\SFData.csv"/>
              <entry key="process.mappingFile" value="c:\Program Files\salesforce.com\Data Loader\Test\axmapping.sdl"/>    
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
            </map>

 

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hello,

 

I want to create schedular which will Upload excel sheet into object everyday. I am able to do it with CLI(Command Line Interface.). But unable to create "batch file" for that...(which will executes everyday through schedular).

 

Please may I know How to write Batch file for that???

 

I wrote

"call process c:\Program Files\salesforce.com\Data Loader\Test" myUploadProcess", but got error.

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hello,

 

I want to create schedular which will Upload excel sheet into object everyday. I am able to do it with CLI(Command Line Interface.). But unable to create "batch file" for that...(which will executes everyday through schedular).

 

Please may I know How to write Batch file for that???

 

I wrote

"call process c:\Program Files\salesforce.com\Data Loader\Test" myUploadProcess", but got error.

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I want to add schedular to upload Excel sheet everyday through uploader. Is there any way to do that?

 

I have gone through web I found that using command line for Dataloader we can do that. I have done changes in process-conf.xml file as

 

 

 

 <bean id="MyProcess"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
        <description>Opportunity Upsert job gets the Customer record updates from a CSV file and uploads them to salesforce using 'upsert'.</description>
        <property name="name" value="MyProcess"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="shahid_ali@persistent.co.in"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="---------"/>
                <entry key="process.encryptionKeyFile" value="c:\dataloader\samples\conf\sample.key"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="TaskSchedular__c"/>
                <entry key="process.operation" value="Insert"/>
                <entry key="process.mappingFile" value="c:\dataloader\samples\conf\scheduleMapping.sdl"/>
                <entry key="dataAccess.name" value="c:\dataloader\samples\data\Schedule_Test.csv"/>
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2006-12-01T00:00:00.000-0800"/>
            </map>
        </property>

 

I have run the code on command line as "process ../conf Myprocess".

 

But it is giving error as:

C:\Program Files\salesforce.com\Data Loader\bin>process ../conf MyProcesscle
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: C:\Users\jeffrey.lai\AppData\Local\Temp\sdl.log (
The system cannot find the path specified)
        at java.io.FileOutputStream.openAppend(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
        at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java
:207)
        at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:3
07)
        at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
va:295)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
or.java:176)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
gurator.java:191)
        at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
Configurator.java:523)
        at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.ja
va:436)
        at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:999)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:867)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:773)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionCon
verter.java:483)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.apache.log4j.Logger.getLogger(Logger.java:117)
        at com.salesforce.dataloader.process.ProcessRunner.<clinit>(ProcessRunne
r.java:82)
2012-08-06 15:14:29,137 INFO  [main] process.ProcessConfig getBeanFactory (Proce
ssConfig.java:103) - Loading process configuration from config file: C:\Program
Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml
0 [main] INFO com.salesforce.dataloader.process.ProcessConfig  - Loading process
 configuration from config file: C:\Program Files\salesforce.com\Data Loader\bin
\..\conf\process-conf.xml
2012-08-06 15:14:29,193 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinit
ions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file
 [C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml]
56 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader  -
Loading XML bean definitions from file [C:\Program Files\salesforce.com\Data Loa
der\bin\..\conf\process-conf.xml]
2012-08-06 15:14:29,196 ERROR [main] process.ProcessConfig getProcessInstance (P
rocessConfig.java:96) - Error loading process: MyProcesscle configuration from c
onfig file: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf
.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException pars
ing XML document from file [C:\Program Files\salesforce.com\Data Loader\bin\..\c
onf\process-conf.xml]; nested exception is java.io.FileNotFoundException: C:\Pro
gram Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (The system c
annot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
59 [main] ERROR com.salesforce.dataloader.process.ProcessConfig  - Error loading
 process: MyProcesscle configuration from config file: C:\Program Files\salesfor
ce.com\Data Loader\bin\..\conf\process-conf.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException pars
ing XML document from file [C:\Program Files\salesforce.com\Data Loader\bin\..\c
onf\process-conf.xml]; nested exception is java.io.FileNotFoundException: C:\Pro
gram Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (The system c
annot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
2012-08-06 15:14:29,202 FATAL [main] process.ProcessRunner topLevelError (Proces
sRunner.java:238) - Failed to create process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loadin
g process: MyProcesscle configuration from config file: C:\Program Files\salesfo
rce.com\Data Loader\bin\..\conf\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOExc
eption parsing XML document from file [C:\Program Files\salesforce.com\Data Load
er\bin\..\conf\process-conf.xml]; nested exception is java.io.FileNotFoundExcept
ion: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (T
he system cannot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        ... 3 more
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
65 [main] FATAL com.salesforce.dataloader.process.ProcessRunner  - Failed to cre
ate process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loadin
g process: MyProcesscle configuration from config file: C:\Program Files\salesfo
rce.com\Data Loader\bin\..\conf\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOExc
eption parsing XML document from file [C:\Program Files\salesforce.com\Data Load
er\bin\..\conf\process-conf.xml]; nested exception is java.io.FileNotFoundExcept
ion: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (T
he system cannot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        ... 3 more
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
C:\Program Files\salesforce.com\Data Loader\bin>

 

Please suggest me if there is another way to do that.. And whats the problem with this command line code? Do I need to do some changes?

 

 

Thak you so much...

 

Warm Regards,

Amol Dixit.

 

 

Hi,

 

I want to send pdf attachment through email, which will execute on E-Mail service. I wrote class for that and it is sending pdf successfully, but i am getting error while opening the pdf as,

 

"adobe reader could not open attachment.pdf becauseit is eithernot a supportedfile type or because file has been damaged (for example, it was sent as an email attachment & was't correctly decoded."

 

Please help me out. Thank you so much..

 

global class DeliverTrackerbyEmail implements Messaging.InboundEmailHandler {

global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, 
                                                  Messaging.InboundEnvelope env){

Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();

String myPlainText = '';

// Add the email plain text into the local variable

try
{
      myPlainText = email.plainTextBody;
      
}
catch (System.StringException e)
{
}
 
       String fromMail=email.fromAddress;
       String submodule=myPlainText.substring(0,8);
       Resource__c res=[Select Name,Employee__r.Name__c
       From Resource__c  
       Where Employee__r.Email_ID__c = :fromMail];
       
       String ResourceNumber=res.Name;
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
     
        Resource__c ab=[select id from Resource__c where Name=:ResourceNumber limit 1];
        // Reference the attachment page and pass in the account ID
        PageReference pdf =  Page.attachmentPDF;
        pdf.getParameters().put('id',ResourceNumber); 
        pdf.setRedirect(true);

        // Take the PDF content
        Blob b = pdf.getContent();

        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName('attachment.pdf');
        efa.setBody(b);

        String addresses;
   
        String[] toAddresses = new String[]{fromMail};
        mail.setSubject( 'Tracker ' );
        mail.setToAddresses(toAddresses);
        mail.setPlainTextBody(' Hi,'+res.Employee__r.Name__c+' Please find the Attched Tracker with this mail. ');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});// Sends the email 
       
   
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});   

  result.success = true;

  // Return the result for the Force.com Email Service
  return result;
}
static testMethod void testTasks() {

// Create a new email and envelope object
   Messaging.InboundEmail email = new Messaging.InboundEmail();
   Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();

// Create the plainTextBody and fromAddres for the test
    email.plainTextBody = 'Here is my plainText body of the email';
    email.fromAddress ='rmencke@salesforce.com';

EmailServiceClass taskObj = new EmailServiceClass();
taskobj.handleInboundEmail(email, env);
} 


}

Thank you,

Amol Dixit

 

Hi,

 

I am trying to write test method form a class but having issue. Although I have given correct values the coverage is upto 40 % only. I dont know what is the problem. Please help.

 

public class DetailTrainingPlanController {
Public String message = System.currentPagereference().getParameters().get('msg');

    public DetailTrainingPlanController(editTrainingPlan controller) {

    }
public String message{get;set;}

 public double totalHours{get;set;}
  
  
public List<Training_Plan__c> TP{get;set;}
   

     public List<Submodule__c> moduleHour{get;set;}
   
   
     public Map<String, List<Submodule__c>> moduleMap {get;set;}
    
     public Map<String, double> hourMap {get;set;}
     public List<Submodule__c> submoduleList{get;set;}
     public List<String> submoduleNamesList{get;set;}
     public List<Module__c> moduleList;
     public List<double> hourlist{get;set;}
     Integer flag{get;set;}
    
     public DetailTrainingPlanController(){
         moduleMap = new Map<String, List<Submodule__c>>();
         TP=new List<Training_Plan__c>();
         TP=Database.Query('select  Selected_hours__c from Training_Plan__c where Name__c=:message');
         totalHours=0;
     }
     
     public PageReference back(){
         return new PageReference('/apex/CRUDTrainingPlan');
    }
 
 

    public void populatedata(){
    try{
   
        List<Training_Plan__c> trainingPlanList=new List<Training_Plan__c>();
        trainingPlanList=Database.query('Select unselected__c from Training_Plan__c where Name=:message');
        String submoduleNames=trainingPlanList[0].unselected__c;
        submoduleNamesList= new List<String>();
        if(submoduleNames!=null)
            submoduleNamesList=submoduleNames.split('/',100);
        flag=0;
        submoduleList=Database.query('Select selected__c,name from Submodule__c');
        for(Integer i=0;i<submoduleList.size();i++)
        {
              flag=0;
              for(Integer j=0;j<submoduleNamesList.size();j++)
              {
                    if(submoduleList[i].name==submoduleNamesList[j])
                    {
                        flag=1;
                    }
              }
              if(flag==0)
              {
                    submoduleList[i].selected__c=true;
              }
              else
                    submoduleList[i].selected__c=false;
      
              upsert submoduleList;
        }
        upsert submoduleList;
             hourlist=new List<Double>();
             hourmap=new map<String,Double>();
     Double hours=0;
        List<Module__c> lst=new List<Module__c>();
        lst=Database.query('select Name,name__c from Module__c');
        for(Integer i=0;i<lst.size();i++)
        {
        hours=0;
        String mname=lst[i].name;
        List<Submodule__c> sub=new List<Submodule__c>();
        sub=Database.query('select Name,Hours__c,selected__c from Submodule__c where Module__r.name=:mname');
        for(Integer j=0;j<sub.size();j++)
        {
            if(sub[j].selected__c==true)
            {
                hours=hours+Double.valueof(sub[j].Hours__c);
              
            }
        }
  
            hourlist.add(hours);
            hourmap.put(lst[i].name__c,hours);
             totalHours=totalHours+hours;
        }
      }
      catch(Exception e){}
      }

      public static TestMethod void checkTrainingPlan()
  {
   
    Training_Plan__c tp=new Training_Plan__c();
    tp.Name__c='Abc';
    tp.Selected_hours__c=Double.valueOf('10');
    tp.Unselected__c='SM-00001/SM-00002/SM-00003/SM-00005/';
    insert tp;
        PageReference pageref = Page.DetailTrainingPlan;
        pageref.getParameters().put('msg',tp.Name);// msg is not setting
              Test.setCurrentPage(pageref);
      
      DetailTrainingPlanController dtpc=new DetailTrainingPlanController();
       System.debug('Msg is '+dtpc.message+'EEEEEEEEEEE');
 
      dtpc.populateData();
   
  }
  public static TestMethod void testGetPopulate()
  {
//  Tried This as well but msg value is not set in class..
  PageReference pageref = Page.DetailTrainingPlan;
        pageref.getParameters().put('msg','TP-0074');
              Test.setCurrentPage(pageref);
                DetailTrainingPlanController dtpc=new DetailTrainingPlanController();
                dtpc.populateData();
  }
 

}

 

Thank you.

Hi,

 

I want to write test method for the following class. I have tried a lot but I didn't able to do it.  Code Coverage remains 30% only.

I am not be able to write test methods for save,search and AdvanceSeach methods. Please help.

 

Class :

 

public class EditSubmodulesController {
private ApexPages.StandardController controller {get; set;}
  public List<Submodule__c> searchResults {get;set;}
  public string searchText {get;set;}
 
  // standard controller - could also just use custom controller
  public EditSubmodulesController(ApexPages.StandardController controller) { }
 public EditSubmodulesController()
 {
 
 }
 
  Public String message = System.currentPagereference().getParameters().get('msg');
  // fired when the search button is clicked
  public void search() {
    String qry = 'select Module__r.Name__c,Hours__c,Name__c,Level__c,Link__c,Source_Type__c,module__c from  Submodule__c where Name =:message';
    searchResults = Database.query(qry);

  }
  public void Advancedsearch() {
    String qry = 'select Module__r.Name__c,Hours__c,Name__c,Level__c,Link__c,Source_Type__c,module__c from  Submodule__c where Name =:message where Name LIKE \'%'+searchText+'%\' or Name__c LIKE \'%'+searchText+'%\'';
    searchResults = Database.query(qry);
   
  }
  // fired when the save records button is clicked
  public PageReference save() {
 
    try {
          upsert searchResults;
   
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
 return new PageReference('/apex/CRUDSubmodule');
 //   return new PageReference('/'+ApexPages.currentPage().getParameters().get('id'));
  }
 
  // takes user back to main record
  public PageReference cancel() {
    return new PageReference('/apex/CRUDSubmodule');
  }

 

static testMethod void verifyIsEditSubmodules ()
{

       String nextPage='/apex/CRUDSubmodule';
    PageReference pageRef = Page.EditSubmodules;
    Test.setCurrentPage(pageRef);
    EditSubmodulesController controller = new EditSubmodulesController();
    nextPage = controller.cancel().getUrl();
    System.debug('nextPage is'+nextPage);
    System.assertEquals('/apex/CRUDSubmodule',nextPage);
   
}

}

 

Thank you

 

Amol Dixit.

Hi,

 

In our application we have to send Emails to users everyday and depending on the responce from user appropriate actions wiil be taken in objects fields.

 

how can i provide links in email body by which, click on the link will automatically sends an email to our inbound email address?

 

 

Thank you.

Amol Dixit.

Hi,

 

I wants to know about email body Actions in Salesforce. I have created an application in which I require to send an email to user and provide one button in mail body. Once he click on that button the appropriate action will be taken in SF object.

 

How can I provide such action based email functionality??

 

 

Thank you.

 

Amol Dixit.

Hi,

 

 

I have created An application. I want to deploy it at customer premises. How can I disable Editor of VF page. Because each time I open page it will get open with Editor(Editing functionality).

 

Is there any way to hide it??

 

 

Thank you.

Amol Dixit.

Hi,

 

I have very big problem. I have created an app in which I wants to chage the batch and plan of the resource. And accordingly I am creating tracker for them. But every time I update records It will give me Warning Mail, I dont know why?? Please help me out.

 

/*

Operation: /apex/changeplan

 

By user/organization: 00590000000v5ZR/00D90000000c8Oe

 

Caused the following Apex resource warnings:

 

Number of SOQL queries: 67 out of 100

 

(these emails can be disabled from the user detail page for this user)*/

 

 

Class  is as follows=

 

 

 

public class changePlanController{

    public Boolean getChkFlag() {
    if(chkFlag)
     chkFlag=true;
        return chkFlag;
    }
public Resource__c rso{get;set;}

    public String batch { get; set; }

    public String getBatch() {
        return null;
    }


    public changePlanController() {
        datevalue=new Special_Case__c();
        rso=new Resource__c();
        recalculateCounter=0;
        showChangeBlock=true;
        pcheck=false;
        bcheck=false;
        chkFlag=false;
    }
public boolean chkFlag{get;set;}    
public String assignTo1{get;set;}
public boolean showChangeBlock{get;set;}
public String checkRadio{get;set;}    
public String kt{get;set;}
public boolean showblock{get;set;}
public String BatchNameS{get;set;}
public boolean bcheck{get;set;}
public boolean pcheck{get;set;}
public String planname{get;set;}
public String planNameS{get;set;}
public Special_Case__c datevalue{get;set;}
public Integer chk{get;set;}
public String resourceName{get;set;}
public String lastTrainingBatch{get;set;}
public String lastTrainingPlan{get;set;}
public String pl{get;set;}
 public String unselectSub{get;set;}
public String batchname{get;set;}
public String ResName{get;set;}
Double hrs=0;
public Date startdate{get;set;}
Integer Year,Month,Day,objectdate,objectmonth,objectyear;
public String recievedId{get;set;}
public Special_Case__c splcase{get;set;}
public List<Special_Case__c> lst= new List<Special_Case__c>();
public Integer recalculateCounter{get;set;}
 public List<String> finalone{get;set;}
 public String trial{get;set;}
    public List<Resource__c> rs{get;set;}
    Double AllTotal=0;
    public String ras{get;set;}
 
    public List<SelectOption> getItems1() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('Training Batch','Training Batch'));
        options.add(new SelectOption('Training Plan','Training Plan'));
         return options;
    }
    public void show(){
        showChangeBlock=true;
    }
    
    public void assign1(){
    showblock=true;
    trial='Hello';
        if(assignTo1=='Training Batch')
        {
            Bcheck=true;
            Pcheck=false;
        }
        else if(assignTo1=='Training Plan')
        {
            Pcheck=true;
            Bcheck=false;
        }
    }
    
    
    public PageReference saveNew()
    {
            resourceName=ras.substring(ras.indexOf('[')+1,ras.indexOf(']'));
            List<Special_Case__c> rt=new List<Special_Case__c>();
            rt=Database.query('select Id from Special_Case__c where EmpId__c=:resourceName');
            delete rt;
           for(Integer i=0;i<specialCase.size();i++)
            {
                Special_Case__c SC=new Special_Case__c();
                SC.New_Start_Date__c=specialCase[i].spCase.New_Start_Date__c;
                SC.New_End_Date__c=specialCase[i].spCase.New_End_Date__c;
                SC.New_Hours__c=specialCase[i].spCase.New_Hours__c;
                SC.EmpId__c=resourceName;
                insert SC;
            }


            return null;
    
    }
     public class text1 {
    public String Value { get; set; }
    public string flag {get;set;}
    public String Link{get;set;}
    public String sourceType{get;set;}
    public Special_Case__c spCase{get;set;}
    public text1()
    {
    spCase=new Special_Case__c();
    }
  }


  private List<text1> specialCase;

  public void setspecialCase(List<text1> items) {
    specialCase = items;
  }

 
  public List<text1> getspecialCase() {
    if(specialCase==null) {
      specialCase = new List<text1>();
      specialCase.add(new text1());
    }
    return specialCase;
  }
 
  public void addItem1() {
    specialCase.add(new text1());
  }
  public void deletemodule()
  {
  for(Integer i=specialCase.size()-1;i>=0;i--)
  {
  if(specialCase[i].flag=='true'){
  specialCase.remove(i);
  }
  }
    }
    
public Pagereference change(){
/*
Id d=Rso.Training_Batch__c;
List<Training_Batch__c> bchList=Database.query('select Name__c,Name from Training_Batch__c where id=:d');
BatchNameS=bchList[0].Name;
return null;
*/

reCalculateCounter=1;
MilestoneCalculation();
recalculateCounter=0;
ID lastid;
resourceName=ras.substring(ras.indexOf('[')+1,ras.indexOf(']'));
List<Resource_Tracker__c> rt=new List<Resource_Tracker__c>();
rt=Database.query('select Id from Resource_Tracker__c where Resource__r.Name=:resourceName');
delete rt;
   List<Resource__c> resource=new List<Resource__c>();
          resource= Database.query('select  Start_Date_on_SF__c,Training_Plan__r.Unselected__c,Training_Batch__r.Training_Plan__r.Unselected__c,Id,Name,Training_Batch__r.Name,Training_Batch__r.Training_Plan__r.Name,Training_Plan__r.Name,Training_Batch__c,Training_Plan__c from Resource__c where Name=:resourceName');
          lastid=resource[0].Id;
          resourceName=resource[0].Name;
        
          lastTrainingPlan=resource[0].Training_Batch__r.Training_Plan__r.Name;
          lastTrainingBatch=resource[0].Training_Batch__r.Name;
  BatchNameS=Rso.Training_Batch__c;
        if(bcheck==false)
      {
      Id d=Rso.Training_Plan__c;
      List<Training_Plan__c> plList=Database.query('select Name__c,Name from Training_Plan__c where id=:d');
      pl=plList[0].Name;
    
     List<Training_Plan__c> lst=new List<Training_Plan__c>();
     lst=Database.query('select Unselected__c,id from Training_Plan__c where Name=:pl');
     unselectSub=lst[0].Unselected__c;
     List<Resource__c> rlist=new List<Resource__c>();
     rlist=Database.query('select Training_Plan__c,Training_Batch__c,Training_Batch__r.Training_Plan__c from Resource__c where Name=:resourceName');
     rlist[0].Training_Batch__c=null;
      rlist[0].Training_plan__c=lst[0].id;
      
   /*  if(rlist[0].Training_Batch__c==null)
     rlist[0].Training_Plan__c=lst[0].id;
     else
     rlist[0].Training_Batch__r.Training_Plan__c=lst[0].id;*/
     upsert rlist;
       }
     else
     {
     Id d=Rso.Training_Batch__c;
     List<Training_Batch__c> bchList=Database.query('select Name__c,Name from Training_Batch__c where id=:d');
     BatchNameS=bchList[0].Name;
     List<Resource__c> rlist=new List<Resource__c>();
     rlist=Database.query('select Training_Plan__c,Training_Batch__c from Resource__c where Name=:resourceName');
     rlist[0].Training_Plan__c=null;
     rlist[0].Training_Batch__c=null;
     upsert rlist;
      List<Training_Batch__c> lst=new List<Training_Batch__c>();
     lst=Database.query('select Training_Plan__r.Name,Training_Plan__r.Unselected__c,Training_Plan__r.Name__c,id from Training_Batch__c where Name=:BatchNameS');
     unselectSub=lst[0].Training_Plan__r.Unselected__c;
     rlist[0].Training_batch__c=lst[0].id;
     upsert rlist;
     pl=lst[0].Training_Plan__r.Name;
     }
 
          finalone=new List<String>();
          if(unselectSub!=Null)
          finalone=unselectSub.split('/',100);
          
          List<Training_Plan_Module__c> mdle=new List<Training_Plan_Module__c>();
          mdle=Database.query('select Module__r.Name,Module__r.Name__c from Training_Plan_Module__c where Training_Plan__r.Name=:pl order by  Module__r.Name');

         for(Integer i=0;i<mdle.size();i++)
         {
         
             List<Submodule__c> submodule=new List<Submodule__c>();
             List<String> temp1=new List<String>();
             
             kt=mdle[i].Module__r.Name;
           
                submodule=Database.query('select Name,Hours__c,ID from Submodule__c where Module__r.Name=:kt');
                for(Integer j=0;j<submodule.size();j++)
                {
                    chk=0;
                    if(unselectSub!=Null)
                    {
                      for(Integer k=0;k<finalone.size();k++)
                     {
                           
                     if(finalone[k]==submodule[j].Name)
                     {
                             chk=1;
                          
                     }
                     }
                     }
                     
                         if(chk==0)
                         {
                                 Resource_Tracker__c Re=new Resource_Tracker__c();
                                 Re.Resource__c=lastid;           
                                 Re.Submodule__c=submodule[j].id;
                                 insert re;
                         }
                }
             }
             milestoneCalculation();

Pagereference ref=new Pagereference('/apex/changeplan');
ref.setredirect(true);
return ref;

}

}

Thank you

Amol Dixit

Hi !

 

 

I wants to provide pagination to my Visual force page. How can I provide that??

 

 

VF Page:

 

<apex:page controller="CRUDModuleController">
<apex:form id="form">
<apex:pageBlock title="Modules">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockButtons location="top">
<apex:commandButton value="New" action="{!addNew}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!moduleList}" var="row">
<apex:column >
<apex:outputLink title="" value="/apex/editModule" style="font-weight:bold">Edit <apex:param name="msg" value="{!row.Name}"/></apex:outputLink>&nbsp;|&nbsp;
 <a href="javascript&colon;if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');" style="font-weight:bold">Del</a>
 
</apex:column>
<apex:column value="{!row.Name}"/>
<apex:column headerValue="Module Name">
 <apex:outputLink value="/apex/DetailModule" >
                        <apex:outputField value="{!row.Name__c}"/>
                         <apex:param name="msg" value="{!row.Name}"/>
                        </apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>

<apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" >
<apex:param name="accountid" value="" assignTo="{!selectedModuleId}"/>
</apex:actionFunction>
</apex:form>
</apex:page>

 

 

VF Class:

public class CRUDModuleController {


public List<module__c> moduleList { get; set; }

public string selectedModuleId { get; set; }

public CRUDModuleController() {

LoadData();
}

private void LoadData() {
moduleList = [Select id,name,Name__c from module__c];
}

public void DeleteAccount()
{
if (selectedModuleId == null) {

return;
}

module__c tobeDeleted = null;
for(module__c a : moduleList)
if (a.Id == selectedModuleId) {
tobeDeleted = a;
break;
}

if (tobeDeleted != null) {
Delete tobeDeleted;
}


LoadData();
}

public Pagereference addNew()
{
PageReference ref=new PageReference('/apex/addModule');
ref.setRedirect(true);
return ref;

}

}

 

Thank you !

 

 

Amol Dixit.

Hi,

 

I have created an Application with VF Pages.  But unfortunatey one of Vf page got deleted. So is there any way to recover my deleted VF page???

 

 

Thank you!

 

Amol Dixit

Hi,

 

I want to add schedular to upload Excel sheet everyday through uploader. Is there any way to do that?

 

I have gone through web I found that using command line for Dataloader we can do that. I have done changes in process-conf.xml file as

 

 

 

 <bean id="MyProcess"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
        <description>Opportunity Upsert job gets the Customer record updates from a CSV file and uploads them to salesforce using 'upsert'.</description>
        <property name="name" value="MyProcess"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="shahid_ali@persistent.co.in"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="---------"/>
                <entry key="process.encryptionKeyFile" value="c:\dataloader\samples\conf\sample.key"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="TaskSchedular__c"/>
                <entry key="process.operation" value="Insert"/>
                <entry key="process.mappingFile" value="c:\dataloader\samples\conf\scheduleMapping.sdl"/>
                <entry key="dataAccess.name" value="c:\dataloader\samples\data\Schedule_Test.csv"/>
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2006-12-01T00:00:00.000-0800"/>
            </map>
        </property>

 

I have run the code on command line as "process ../conf Myprocess".

 

But it is giving error as:

C:\Program Files\salesforce.com\Data Loader\bin>process ../conf MyProcesscle
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: C:\Users\jeffrey.lai\AppData\Local\Temp\sdl.log (
The system cannot find the path specified)
        at java.io.FileOutputStream.openAppend(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
        at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java
:207)
        at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:3
07)
        at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
va:295)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
or.java:176)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
gurator.java:191)
        at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
Configurator.java:523)
        at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.ja
va:436)
        at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:999)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:867)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:773)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionCon
verter.java:483)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.apache.log4j.Logger.getLogger(Logger.java:117)
        at com.salesforce.dataloader.process.ProcessRunner.<clinit>(ProcessRunne
r.java:82)
2012-08-06 15:14:29,137 INFO  [main] process.ProcessConfig getBeanFactory (Proce
ssConfig.java:103) - Loading process configuration from config file: C:\Program
Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml
0 [main] INFO com.salesforce.dataloader.process.ProcessConfig  - Loading process
 configuration from config file: C:\Program Files\salesforce.com\Data Loader\bin
\..\conf\process-conf.xml
2012-08-06 15:14:29,193 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinit
ions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file
 [C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml]
56 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader  -
Loading XML bean definitions from file [C:\Program Files\salesforce.com\Data Loa
der\bin\..\conf\process-conf.xml]
2012-08-06 15:14:29,196 ERROR [main] process.ProcessConfig getProcessInstance (P
rocessConfig.java:96) - Error loading process: MyProcesscle configuration from c
onfig file: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf
.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException pars
ing XML document from file [C:\Program Files\salesforce.com\Data Loader\bin\..\c
onf\process-conf.xml]; nested exception is java.io.FileNotFoundException: C:\Pro
gram Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (The system c
annot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
59 [main] ERROR com.salesforce.dataloader.process.ProcessConfig  - Error loading
 process: MyProcesscle configuration from config file: C:\Program Files\salesfor
ce.com\Data Loader\bin\..\conf\process-conf.xml
org.springframework.beans.factory.BeanDefinitionStoreException: IOException pars
ing XML document from file [C:\Program Files\salesforce.com\Data Loader\bin\..\c
onf\process-conf.xml]; nested exception is java.io.FileNotFoundException: C:\Pro
gram Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (The system c
annot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
2012-08-06 15:14:29,202 FATAL [main] process.ProcessRunner topLevelError (Proces
sRunner.java:238) - Failed to create process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loadin
g process: MyProcesscle configuration from config file: C:\Program Files\salesfo
rce.com\Data Loader\bin\..\conf\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOExc
eption parsing XML document from file [C:\Program Files\salesforce.com\Data Load
er\bin\..\conf\process-conf.xml]; nested exception is java.io.FileNotFoundExcept
ion: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (T
he system cannot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        ... 3 more
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
65 [main] FATAL com.salesforce.dataloader.process.ProcessRunner  - Failed to cre
ate process
com.salesforce.dataloader.exception.ProcessInitializationException: Error loadin
g process: MyProcesscle configuration from config file: C:\Program Files\salesfo
rce.com\Data Loader\bin\..\conf\process-conf.xml
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:97)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:287)
        at com.salesforce.dataloader.process.ProcessRunner.getInstance(ProcessRu
nner.java:273)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.ja
va:246)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOExc
eption parsing XML document from file [C:\Program Files\salesforce.com\Data Load
er\bin\..\conf\process-conf.xml]; nested exception is java.io.FileNotFoundExcept
ion: C:\Program Files\salesforce.com\Data Loader\bin\..\conf\process-conf.xml (T
he system cannot find the path specified)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:341)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:302)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:73)
        at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFa
ctory.java:61)
        at com.salesforce.dataloader.process.ProcessConfig.getBeanFactory(Proces
sConfig.java:104)
        at com.salesforce.dataloader.process.ProcessConfig.getProcessInstance(Pr
ocessConfig.java:93)
        ... 3 more
Caused by: java.io.FileNotFoundException: C:\Program Files\salesforce.com\Data L
oader\bin\..\conf\process-conf.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.springframework.core.io.FileSystemResource.getInputStream(FileSys
temResource.java:110)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea
nDefinitions(XmlBeanDefinitionReader.java:328)
        ... 8 more
C:\Program Files\salesforce.com\Data Loader\bin>

 

Please suggest me if there is another way to do that.. And whats the problem with this command line code? Do I need to do some changes?

 

 

Thak you so much...

 

Warm Regards,

Amol Dixit.

 

 

I need to show listview on the lightning web component same as used in the aura component.

I am able to fetch records of listview object but there is to the component to show that information in Lightning web component.

I found data-table to show this but pagination will be a problem with this. 
Is there any component from which we can show listview with pagination in the lightning web component 



 
Hi All
I am trying to achieve functionality of allowing fileupload for guest users using lightning component. I have created a custom object and gave permissions to guest user profile to it.
Created a ltg fileupload component and it works perfectly fine for logged in user. Salesforce documentation for reference-
https://developer.salesforce.com/docs/component-library/bundle/lightning:fileUpload/documentation
​​​​​​​
I have enabled to guest site file upload setting as well on org.
When i try in incognito mode, it still gives me ‘cant upload filename.ext’ error. 
What else could i be missing? I am using custom template in communities and i have enterprise edition license.

Thanks
Niket
Hi,
Can we export list of records from a lightning page to Excel sheet on click of button?In VF pages we use ContentType ,how can we do the same in Lightning?

Thanks in advance
Hi guys/gals,

Do you have any idea on how to obtain the Cloak of Adventure sweatshirt after completing 5 badges on trailheads?

Source: http://go.pardot.com/l/27572/2016-01-06/4wy4tn?utm_campaign=newyear-trailhead-sweatshirt

I haven't received any email address or notification about the completion after I had received 5 new badges on my profile. 

The sweetshirt looks really cool and I want to get it :D  Ty
 

I do the following query, to get BOTH closed activites and open ones:

 

SELECT name, id, (SELECT id,ActivityDate,Description,Subject,IsClosed,CallType,CallDisposition,Status,ActivityType

FROM ActivityHistories where isTask = true

 Order by ActivityDate desc

) ,

(SELECT id,ActivityDate,Description,Subject,IsClosed,CallType,CallDisposition,Status,ActivityType

FROM OpenActivities where isTask = true

 Order by ActivityDate desc

)

FROM Account where name like '%Abseck%'

 

The query results are saved in lstactivity

 

I am trying to loop thru and get at the ActivityHistories info

for(Account a : lstactivity)

{

 

   for(ActivityHistory t : a.ActivityHistories)

   {

       System.debug(t.ActivityDate);

   }

}

 

I am getting an error that t.ActivityDate doesn't exist.

am I referencing ActivityHistories correctly in the loop?..I wasn't sure what to use for the names

 

 

When I do it for OpenActivities it works...

for(Account a : lstactivity)

{

 

   for(OpenActivity t : a.OpenActivities)

   {

       System.debug(t.ActivityDate);

   }

}

 

Please hlep!... Thanks in advance.

 

Hi,

 

I want to get User level Salesforce Password policies fields such as

 

1) User password Expire in

2) Minimum password length. etc.

 

To enforce it on my custom password, whether it is following it or not? (In custom page with APEX and VF)

 

What objects are used for this, I have searched it, but couldn't found. Is there any API provided for this?

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I have created Configuration file to schedule Dataloader through CLI(Command Line Interface). I have setted Time Zone as "GMT", and Use Europian Format as a true. But it is taking one day less.

 

That means reading one day less from actual date.

 

 

Please provide me the solution for this.

 

 

  <map>
                <entry key="sfdc.debugMessages" value="true"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\accountMasterSoapTrace.log"/>
    
    <entry key="process.outputError" value="c:\Program Files\salesforce.com\Data Loader\Test\error.txt"/>
                <entry key="process.outputSuccess" value="c:\Program Files\salesforce.com\Data Loader\Test\success.txt"/>
    <entry key="sfdc.endpoint" value="https://login.salesforce.com"/>
                <entry key="sfdc.username" value="--"/>
                <!-- password below has been encrypted using key file, therefore it will not work without the key setting: process.encryptionKeyFile
                the password is not a valid encrypted value, please generate the real value using encrypt.bat utility -->
                <entry key="sfdc.password" value="--"/>
                <entry key="process.encryptionKeyFile" value="c:\Program Files\salesforce.com\Data Loader\Test\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.externalIdField" value="AX_object__c"/>
                <entry key="sfdc.entity" value="AX_object__c"/>
                <entry key="process.operation" value="insert"/>
               <entry key="sfdc.timeZone" value="GMT"/>
              <entry key="process.useEuropeanDates" value="true"/>
              <entry key="dataAccess.name" value="c:\Program Files\salesforce.com\Data Loader\Test\SFData.csv"/>
              <entry key="process.mappingFile" value="c:\Program Files\salesforce.com\Data Loader\Test\axmapping.sdl"/>    
                <entry key="dataAccess.type" value="csvRead"/>
                <entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800"/>
            </map>

 

 

Thank you.

 

Warm Regards,

Amol Dixit.

Hi,

 

I want to send pdf attachment through email, which will execute on E-Mail service. I wrote class for that and it is sending pdf successfully, but i am getting error while opening the pdf as,

 

"adobe reader could not open attachment.pdf becauseit is eithernot a supportedfile type or because file has been damaged (for example, it was sent as an email attachment & was't correctly decoded."

 

Please help me out. Thank you so much..

 

global class DeliverTrackerbyEmail implements Messaging.InboundEmailHandler {

global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, 
                                                  Messaging.InboundEnvelope env){

Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();

String myPlainText = '';

// Add the email plain text into the local variable

try
{
      myPlainText = email.plainTextBody;
      
}
catch (System.StringException e)
{
}
 
       String fromMail=email.fromAddress;
       String submodule=myPlainText.substring(0,8);
       Resource__c res=[Select Name,Employee__r.Name__c
       From Resource__c  
       Where Employee__r.Email_ID__c = :fromMail];
       
       String ResourceNumber=res.Name;
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
     
        Resource__c ab=[select id from Resource__c where Name=:ResourceNumber limit 1];
        // Reference the attachment page and pass in the account ID
        PageReference pdf =  Page.attachmentPDF;
        pdf.getParameters().put('id',ResourceNumber); 
        pdf.setRedirect(true);

        // Take the PDF content
        Blob b = pdf.getContent();

        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName('attachment.pdf');
        efa.setBody(b);

        String addresses;
   
        String[] toAddresses = new String[]{fromMail};
        mail.setSubject( 'Tracker ' );
        mail.setToAddresses(toAddresses);
        mail.setPlainTextBody(' Hi,'+res.Employee__r.Name__c+' Please find the Attched Tracker with this mail. ');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});// Sends the email 
       
   
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});   

  result.success = true;

  // Return the result for the Force.com Email Service
  return result;
}
static testMethod void testTasks() {

// Create a new email and envelope object
   Messaging.InboundEmail email = new Messaging.InboundEmail();
   Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();

// Create the plainTextBody and fromAddres for the test
    email.plainTextBody = 'Here is my plainText body of the email';
    email.fromAddress ='rmencke@salesforce.com';

EmailServiceClass taskObj = new EmailServiceClass();
taskobj.handleInboundEmail(email, env);
} 


}

Thank you,

Amol Dixit

 

Hi,

 

I am trying to write test method form a class but having issue. Although I have given correct values the coverage is upto 40 % only. I dont know what is the problem. Please help.

 

public class DetailTrainingPlanController {
Public String message = System.currentPagereference().getParameters().get('msg');

    public DetailTrainingPlanController(editTrainingPlan controller) {

    }
public String message{get;set;}

 public double totalHours{get;set;}
  
  
public List<Training_Plan__c> TP{get;set;}
   

     public List<Submodule__c> moduleHour{get;set;}
   
   
     public Map<String, List<Submodule__c>> moduleMap {get;set;}
    
     public Map<String, double> hourMap {get;set;}
     public List<Submodule__c> submoduleList{get;set;}
     public List<String> submoduleNamesList{get;set;}
     public List<Module__c> moduleList;
     public List<double> hourlist{get;set;}
     Integer flag{get;set;}
    
     public DetailTrainingPlanController(){
         moduleMap = new Map<String, List<Submodule__c>>();
         TP=new List<Training_Plan__c>();
         TP=Database.Query('select  Selected_hours__c from Training_Plan__c where Name__c=:message');
         totalHours=0;
     }
     
     public PageReference back(){
         return new PageReference('/apex/CRUDTrainingPlan');
    }
 
 

    public void populatedata(){
    try{
   
        List<Training_Plan__c> trainingPlanList=new List<Training_Plan__c>();
        trainingPlanList=Database.query('Select unselected__c from Training_Plan__c where Name=:message');
        String submoduleNames=trainingPlanList[0].unselected__c;
        submoduleNamesList= new List<String>();
        if(submoduleNames!=null)
            submoduleNamesList=submoduleNames.split('/',100);
        flag=0;
        submoduleList=Database.query('Select selected__c,name from Submodule__c');
        for(Integer i=0;i<submoduleList.size();i++)
        {
              flag=0;
              for(Integer j=0;j<submoduleNamesList.size();j++)
              {
                    if(submoduleList[i].name==submoduleNamesList[j])
                    {
                        flag=1;
                    }
              }
              if(flag==0)
              {
                    submoduleList[i].selected__c=true;
              }
              else
                    submoduleList[i].selected__c=false;
      
              upsert submoduleList;
        }
        upsert submoduleList;
             hourlist=new List<Double>();
             hourmap=new map<String,Double>();
     Double hours=0;
        List<Module__c> lst=new List<Module__c>();
        lst=Database.query('select Name,name__c from Module__c');
        for(Integer i=0;i<lst.size();i++)
        {
        hours=0;
        String mname=lst[i].name;
        List<Submodule__c> sub=new List<Submodule__c>();
        sub=Database.query('select Name,Hours__c,selected__c from Submodule__c where Module__r.name=:mname');
        for(Integer j=0;j<sub.size();j++)
        {
            if(sub[j].selected__c==true)
            {
                hours=hours+Double.valueof(sub[j].Hours__c);
              
            }
        }
  
            hourlist.add(hours);
            hourmap.put(lst[i].name__c,hours);
             totalHours=totalHours+hours;
        }
      }
      catch(Exception e){}
      }

      public static TestMethod void checkTrainingPlan()
  {
   
    Training_Plan__c tp=new Training_Plan__c();
    tp.Name__c='Abc';
    tp.Selected_hours__c=Double.valueOf('10');
    tp.Unselected__c='SM-00001/SM-00002/SM-00003/SM-00005/';
    insert tp;
        PageReference pageref = Page.DetailTrainingPlan;
        pageref.getParameters().put('msg',tp.Name);// msg is not setting
              Test.setCurrentPage(pageref);
      
      DetailTrainingPlanController dtpc=new DetailTrainingPlanController();
       System.debug('Msg is '+dtpc.message+'EEEEEEEEEEE');
 
      dtpc.populateData();
   
  }
  public static TestMethod void testGetPopulate()
  {
//  Tried This as well but msg value is not set in class..
  PageReference pageref = Page.DetailTrainingPlan;
        pageref.getParameters().put('msg','TP-0074');
              Test.setCurrentPage(pageref);
                DetailTrainingPlanController dtpc=new DetailTrainingPlanController();
                dtpc.populateData();
  }
 

}

 

Thank you.

Hi,

 

I want to write test method for the following class. I have tried a lot but I didn't able to do it.  Code Coverage remains 30% only.

I am not be able to write test methods for save,search and AdvanceSeach methods. Please help.

 

Class :

 

public class EditSubmodulesController {
private ApexPages.StandardController controller {get; set;}
  public List<Submodule__c> searchResults {get;set;}
  public string searchText {get;set;}
 
  // standard controller - could also just use custom controller
  public EditSubmodulesController(ApexPages.StandardController controller) { }
 public EditSubmodulesController()
 {
 
 }
 
  Public String message = System.currentPagereference().getParameters().get('msg');
  // fired when the search button is clicked
  public void search() {
    String qry = 'select Module__r.Name__c,Hours__c,Name__c,Level__c,Link__c,Source_Type__c,module__c from  Submodule__c where Name =:message';
    searchResults = Database.query(qry);

  }
  public void Advancedsearch() {
    String qry = 'select Module__r.Name__c,Hours__c,Name__c,Level__c,Link__c,Source_Type__c,module__c from  Submodule__c where Name =:message where Name LIKE \'%'+searchText+'%\' or Name__c LIKE \'%'+searchText+'%\'';
    searchResults = Database.query(qry);
   
  }
  // fired when the save records button is clicked
  public PageReference save() {
 
    try {
          upsert searchResults;
   
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
 return new PageReference('/apex/CRUDSubmodule');
 //   return new PageReference('/'+ApexPages.currentPage().getParameters().get('id'));
  }
 
  // takes user back to main record
  public PageReference cancel() {
    return new PageReference('/apex/CRUDSubmodule');
  }

 

static testMethod void verifyIsEditSubmodules ()
{

       String nextPage='/apex/CRUDSubmodule';
    PageReference pageRef = Page.EditSubmodules;
    Test.setCurrentPage(pageRef);
    EditSubmodulesController controller = new EditSubmodulesController();
    nextPage = controller.cancel().getUrl();
    System.debug('nextPage is'+nextPage);
    System.assertEquals('/apex/CRUDSubmodule',nextPage);
   
}

}

 

Thank you

 

Amol Dixit.

Hi !

 

I have created application based on VF pages and wants to provide the validations and Exception handling. How can I provide my custom Validations & Exception?

 

 

Thank you.

 

Amol Dixit.