• Qingsong
  • NEWBIE
  • 60 Points
  • Member since 2008

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies

Hi all, 

 

I'm trying to create a pdf with VF page and open it as landscape. I'm NOT rendering it on VF page but in apex method otherwise, my VF page does not convert to pdf. Here's my VF page code: 

 

<apex:page standardController="Expenses__c" extensions="PDFGenerator" renderAs="pdf">

<apex:form >

<apex:pageBlock title="Expense Report">

<apex:repeat var="p" value="{!LI}">

<apex:pageblockSection>
<apex:outputText value="{!p.Name}"/>
<apex:outputText value="{!p.Date_Submitted__c}"/>
</apex:pageblockSection>



<table border='1' style="border-collapse: collapse;">
<apex:repeat var="m" value="{!p.Expense_Line_Items__r}">

<tr > <td> <apex:outputText value="{!m.Name}"/> </td>
<td> <apex:outputText value="{!m.Amount__c}"/> </td>
<td> <apex:outputText value="{!m.Date_of_Expense__c}"/></td>
<td> <apex:outputText value="{!m.Payee__c}"/> </td>
<td> <apex:outputText value="{!m.Contact__c}"/> </td>
<td> <apex:outputText value="{!m.Code__c}"/> </td>
<td> <apex:outputText value="{!m.Office__c}"/> </td>
<td> <apex:outputText value="{!m.Job_Number__c}"/> </td>
</tr>
</apex:repeat>

</Table>



</apex:repeat>


</apex:pageBlock>
</apex:form>

</apex:page>

 

 

Here's is the code from Apex method which makes the vforce to pdf. Is there anyway I can make the report to landscape?

 

body = pdf.getContentaspdf();

I have custom component which combined to dropdown list, and I did binding to custom object fields, no issue to get the value from object, but can not save the change..need helps.

 

custom component clss

public with sharing class cComponetCombinedList {
  public string basecolorvalue {get;set;} 
  public string stripecolorvalue {get;set;}
  private list<SelectOption> items;
  public list<SelectOption> getItems(){
    List<SelectOption> items = new List<SelectOption>();
    items.add(new SelectOption('','--None--'));
    items.add(new SelectOption('BG','BG'));
    items.add(new SelectOption('BK','BK'));
    items.add(new SelectOption('BU','BU'));
    items.add(new SelectOption('BU (LT BL)','BU (LT BL)'));
    items.add(new SelectOption('BN','BN'));
    items.add(new SelectOption('DB','DB'));
    items.add(new SelectOption('DG','DG'));
    items.add(new SelectOption('GN','GN'));
    items.add(new SelectOption('GN (LT GN)','GN (LT GN)'));
    items.add(new SelectOption('GY','GY'));
    items.add(new SelectOption('OG','OG'));
    items.add(new SelectOption('PK','PK'));
    items.add(new SelectOption('RD','RD'));
    items.add(new SelectOption('VT','VT'));
    items.add(new SelectOption('WH','WH'));
    items.add(new SelectOption('YE','YE'));
    return items;
  }
  

}

 

Custom Component

 

<apex:component controller="cComponetCombinedList">
	<apex:attribute name="basecolor" description="the base color of the cable" 
			type="String" required="true" assignTo="{!basecolorvalue}">
	</apex:attribute>
	<apex:attribute name="stripecolor" description="the stripe color of the cable" 
			type="String" required="true" assignTo="{!stripecolorvalue}">
	</apex:attribute>
	<apex:selectList value="{!basecolorvalue}" size="1">
		<apex:selectOptions value="{!items}">
		</apex:selectOptions>
	</apex:selectList>
	<apex:selectList value="{!stripecolorvalue}" size="1">
		<apex:selectOptions value="{!items}">
		</apex:selectOptions>
	</apex:selectList>
</apex:component>

 

below is the component referenced in VF:

apex:PageBlockSectionItem >
					<apex:outputLabel value="Pin 1 Base / Stripe Color:"/>
					<c:ComponentCombinedList basecolor="{!SRS_Product_Configuration__c.Pin_1_Base_Color__c}" 
								stripecolor="{!SRS_Product_Configuration__c.Pin_1_Stripe_Color__c}">
					</c:ComponentCombinedList>
				</apex:PageBlockSectionItem>

 

rendered in page correct:

 

1

 

when I change the values and save:

2

 

the value still as old:

 

Any ideas, comments are apperiated. Thanks

 

Qingsong

 

 

I know how to use apex to get Sobject prefix Id:
Schema.DescribeSObjectResult d = Schema.SObjectType.Reference_Opportunity__c ;
system.debug('======DescribeSObjectResult'+d.getKeyPrefix());

I have code:
<apex:commandButton value="Create new Reference Opportunity" onClick="window.open('https://cs4.salesforce.com/a0a/e?CF00NP0000000aoFc={!PXRB__c.Name}&CF00NP0000000aoFc_lkid={!PXRB__c.Id}&saveURL=%2F{!PXRB__c.Id}&retURL=%2F{!PXRB__c.Id}');"/>

this link will open an new screen for create new record under Reference_Opportunity__c, because this is child object of PXRB__C, so the default value will be put into PXRB_No__c field.

the "a0a" is the prefix of Sobject Reference_Opportunity__c
the "CF00NP0000000aoFc" is ID of the PXRB_No__c field in Sobject Reference_Opportunity__c

When we deploy into production, the SObject as well as the field Id will be different, so my question is how to get PXRB_No__c Id from production by using apex code.

Thanks.

Qingsong

Hi all,

Is there anyone who has experience to get external database information, the background are:

1. we have one customer object

2. we are going to create an PDF page to shows it in pretty format, some of information we can get from the customer object, but some of information we have to to get from external database (SQL Database).

3. we do not want to those information which hosted in external database (SQL database) to sync back to salesforce even it might more easlier, but we would like have the real time data snapshot.

 

So the question is how to get those information and put in the class? is there any reference docment? Thanks.

 

Qingsong

Hi, I do have a page which have pageBlock table, I want to click the link in one of the row then jump to the line item edit page, after complete the edit page, click save button, the page can get back to the view page, so there I am using apex-param to pass the line item Id to the line item edit page, there is no problem when I click the link, the edit page shows up with respect record, but the problem is coming when I click the save button, the system give me a error message "System.QueryException: List has no rows for assignment to SObject Class.InnovationExtension.getInnovationToolItem: line 25, column 49
External entry point

Line Item Edit Page <apex:page standardController="In__c" showHeader="true" extensions="InnovationExtension" tabStyle="In__c"> <apex:sectionHeader title="Commercialization/Timing Items Edit" subtitle="{!InnovationToolItem.Name}"></apex:sectionHeader> <apex:form > <apex:pageBlock title="Edit" mode="Edit"> <apex:pagemessages /> <apex:pageBlockButtons > <apex:commandButton action="{!checkListItemSave}" value="Save" /> <apex:commandButton action="{!checkListItemCancel}" value="Cancel" /> </apex:pageBlockButtons> <apex:pageBlockSection title="General Information" columns="1"> <apex:outputField value="{!InnovationToolItem.Name}" style="width: 325px; height: 18px"/> <apex:inputField value="{!InnovationToolItem.Needed_or_Not__c}" /> <apex:inputField value="{!InnovationToolItem.Owner__c}" style="width: 200px; height: 18px"/> <apex:inputField value="{!InnovationToolItem.Target_Completion_Date__c}" style="width: 200px; height: 18px"/> <apex:inputField value="{!InnovationToolItem.Actual_Completion_Date__c}" style="width: 200px; height: 20px"/> <apex:inputField value="{!InnovationToolItem.Status__c}" style="width: 300px; height: 18px"/> <apex:inputField value="{!InnovationToolItem.Comments__c}" style="width: 600px; height: 72px"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <apex:relatedList subject="{!InnovationToolItem}" list="NotesAndAttachments" /> </apex:page>

 

"

master details - list view page:

 

<apex:page standardController="In__c" showHeader="true" extensions="InnovationExtension" tabStyle="In__c">
.......... 

<apex:pageBlock title="Commercialization Checklist" mode="view"> <!-- Display General Group --> <apex:pageBlockSection title="General" id="Generals" columns="1"> <apex:pageBlockTable value="{!Generals}" var="ge"> <apex:column value="{!ge.No__c}" width="50" /> <apex:column headervalue="Items" width="500"> <apex:commandLink action="{!checkListItem}" value="{!ge.Name}" > <apex:param name="Checklist" value="{!ge.id}"/> </apex:commandLink> </apex:column> <apex:column headerValue="Needed?" width="50" > <apex:outputField value="{!ge.Needed_or_Not__c}" /> </apex:column> <apex:column headerValue="Exist?" width="50" > <apex:outputField value="{!ge.Exist_or_Not__c}" /> </apex:column> <apex:column headerValue="Owner" width="150" > <apex:outputField value="{!ge.Owner__c}" /> </apex:column> <apex:column headerValue="Original Target Completion Date" width="150" > <apex:outputField value="{!ge.Target_Completion_Date__c}" /> </apex:column> <apex:column headerValue="Forecast/Actual Completion Date" width="150" > <apex:outputField value="{!ge.Actual_Completion_Date__c}" /> </apex:column> <apex:column headerValue="Status" width="150" > <apex:outputField value="{!ge.Status__c}" /> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection>

 

 

 

standard controller extension public class InnovationExtension { private final In__C Innovations; List<Innovation_Tool__c> Launchs; Innovation_Tool__c InnovationToolItem; public Innovation_Tool__c getInnovationToolItem(){

//Error here, when I click the save button in line item page, the system give the the error displayed above. Innovation_Tool__c InnovationToolItem = [Select Id, IsDeleted, Name, No__c, Innovation__c, Needed_or_Not__c, Exist_or_Not__c, Group__c, Owner__c, Target_Completion_Date__c, Actual_Completion_Date__c, Status__c, Comments__c FROM Innovation_Tool__c where Id = :ApexPages.currentPage().getParameters().get('Checklist')]; return InnovationToolItem; } public InnovationExtension(ApexPages.StandardController controller) { this.Innovations = (In__C)controller.getRecord(); InnovationsList = [Select Id, IsDeleted, Name, Market_Drivers_Trends__c FROM In__c where Id = :ApexPages.currentPage().getParameters().get('id') Limit 1]; Launchs = (List<Innovation_Tool__c>)[Select Id, IsDeleted, Name, No__c, Innovation__c, Needed_or_Not__c, Exist_or_Not__c, Group__c, Owner__c, Target_Completion_Date__c, Actual_Completion_Date__c, Status__c FROM Innovation_Tool__c where Innovation__c = :ApexPages.currentPage().getParameters().get('id') and Group__c='Launch' order by No__c]; } public PageReference checkListItem() { PageReference pdfPage = Page.ADPItemEdit; pdfpage.setRedirect(false); return pdfPage; } public PageReference checkListItemSave() { update InnovationToolItem; return Page.Innovation; } public PageReference checkListItemCancel() { return Page.Innovation; } }

 

 

I used same standard controller extension in both pages, as per the tips from Visualforce Page developer wazird guide line, the controll should not be rerender when I switched in different page but use same controller, not sure where wrong, Please save me!!!

 

Thanks a lot

 

 

 

 
I am using apex data loader 11.0 command line to extract data to CSV file, it's works, I would like to extract data from salesforce directly into MS SQL 2005, I was spent a lot of time to try and search the knowadge in this community but still not able to get this works, below is my code in database-con.xml:
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dbDataSource"
      class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://localhost;databaseName=CRMReport;"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>


<bean id="tmpAccount"
      class="com.salesforce.lexiloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig" ref="queryAccount"/>
    <property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccount"
      class="com.salesforce.lexiloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
 select Id, IsDeleted, MasterRecordId, 
  Name, Type, RecordTypeId, ParentId, 
  BillingStreet, BillingCity, BillingState, 
  BillingPostalCode, BillingCountry, ShippingStreet, 
  ShippingCity, ShippingState, ShippingPostalCode, 
  ShippingCountry, Phone, Fax, 
  Website, Industry, AnnualRevenue, 
  NumberOfEmployees, 
  Description, CurrencyIsoCode, 
  OwnerId, CreatedDate, CreatedById, 
  LastModifiedDate, LastModifiedById, 
  SystemModstamp, LastActivityDate, 
  Region__c, Annual_Procurment__c, 
  Trial_Balance_Code__c, Customer_Group__c, 
  SAP_VEGA_1_Account_Number__c, 
  SAP_VEGA_2_Account_Number__c, 
  QAD_Account_Number__c, 
  BAAN_Account_Number__c, Brief_Name__c,Customer_PBU__c
 from tmpAccount
        </value>
    </property>
</bean>
</beans>


 
and then I have process-conf.xml as well:
 
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <!-- Extract Account to CSV File -->
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 11.0\Delphi\Conf\ExtractAccountMap.sdl"/>
                <entry key="dataAccess.type" value="databaseWrite"/>
                <entry key="dataAccess.name" value="tmpAccount"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, 
                     RecordTypeId, ParentId, BillingStreet, BillingCity, 
                     BillingState, BillingPostalCode, BillingCountry, 
                     ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, 
                     ShippingCountry, Phone, Fax, Website, Industry, AnnualRevenue, 
                     NumberOfEmployees, Description, CurrencyIsoCode, OwnerId, 
                     CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, 
                     SystemModstamp, LastActivityDate, Region__c, Annual_Procurment__c, 
                     Trial_Balance_Code__c, Customer_Group__c, 
                     SAP_VEGA_1_Account_Number__c, SAP_VEGA_2_Account_Number__c, 
                     QAD_Account_Number__c, BAAN_Account_Number__c, Brief_Name__c, 
                     Customer_PBU__c FROM Account"/>
            </map>
        </property>
    </bean>
</beans>

 

I downloaded the Microsoft SQL Server 2005 JDBC 1.2 into my C:\MSJDBC folder, and changed the original proccess.bat file to:
Code:
@echo off
if not [%1]==[] goto run
echo.
echo Usage: process ^<configuration directory^> ^[process name^]
echo.
echo      configuration directory -- directory that contains configuration files,
echo          i.e. config.properties, process-conf.xml, database-conf.xml
echo.
echo      process name -- optional name of a batch process bean in process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir AccountInsert
echo.
echo          If process name is not specified, the parameter values from config.properties
echo          will be used to run the process instead of process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir
echo.

goto end

:run
set PROCESS_OPTION=
if not [%2]==[] set PROCESS_OPTION=process.name=%2

..\_jvm\bin\java.exe -classpath ..\DataLoader.jar;C:\MSJDBC\sqljdbc_1.2\enu\sqljdbc.jar -Dsalesforce.config.dir=%1 

com.salesforce.lexiloader.process.ProcessRunner %PROCESS_OPTION%

:end

 
and then we I execute the extract in command line:
 
process.bat ./conf csvAccountExtractProcess
 
I was get below errors:
 

177924 [csvAccountExtract] DEBUG com.salesforce.lexiloader.client.PartnerClient - Beginning web service operation: query
320410 [csvAccountExtract] ERROR com.salesforce.lexiloader.dao.database.Database Reader  - Database error encountered while writing row#1 through row#215 (execute batch update). Database configuration: tmpAccount.  Sql error: The SELECT statement is not permitted in a batch..com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT statement is not permitted in a batch.
 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at com.salesforce.lexiloader.dao.database.DatabaseWriter.writeRowList(DatabaseWriter.java:180)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.writeExtraction(QueryVisitor.java:205)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.visit(QueryVisitor.java:111)
        at com.salesforce.lexiloader.action.ExtractAction.execute(ExtractAction.java:108)
        at com.salesforce.lexiloader.controller.Controller.executeAction(Controller.java:126)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:136)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
 at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)

320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - Processed 214 of 214 total records. Rate: 24851000 records per hour. Estimated time to complete: 0 minutes and 0 seconds.  There are 0 successes and 214 errors.
320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - The extract has fully completed.  There were 0 successful extracts and 214 errors.

Looks like the SELECT statement have some problems, I am looking the solution here, any leads very be high appericated, Thanks
 


Message Edited by Qingsong on 04-15-2008 06:57 PM

Message Edited by Qingsong on 04-15-2008 07:09 PM

Message Edited by Qingsong on 04-15-2008 07:13 PM

Hi all, 

 

I'm trying to create a pdf with VF page and open it as landscape. I'm NOT rendering it on VF page but in apex method otherwise, my VF page does not convert to pdf. Here's my VF page code: 

 

<apex:page standardController="Expenses__c" extensions="PDFGenerator" renderAs="pdf">

<apex:form >

<apex:pageBlock title="Expense Report">

<apex:repeat var="p" value="{!LI}">

<apex:pageblockSection>
<apex:outputText value="{!p.Name}"/>
<apex:outputText value="{!p.Date_Submitted__c}"/>
</apex:pageblockSection>



<table border='1' style="border-collapse: collapse;">
<apex:repeat var="m" value="{!p.Expense_Line_Items__r}">

<tr > <td> <apex:outputText value="{!m.Name}"/> </td>
<td> <apex:outputText value="{!m.Amount__c}"/> </td>
<td> <apex:outputText value="{!m.Date_of_Expense__c}"/></td>
<td> <apex:outputText value="{!m.Payee__c}"/> </td>
<td> <apex:outputText value="{!m.Contact__c}"/> </td>
<td> <apex:outputText value="{!m.Code__c}"/> </td>
<td> <apex:outputText value="{!m.Office__c}"/> </td>
<td> <apex:outputText value="{!m.Job_Number__c}"/> </td>
</tr>
</apex:repeat>

</Table>



</apex:repeat>


</apex:pageBlock>
</apex:form>

</apex:page>

 

 

Here's is the code from Apex method which makes the vforce to pdf. Is there anyway I can make the report to landscape?

 

body = pdf.getContentaspdf();

I have custom component which combined to dropdown list, and I did binding to custom object fields, no issue to get the value from object, but can not save the change..need helps.

 

custom component clss

public with sharing class cComponetCombinedList {
  public string basecolorvalue {get;set;} 
  public string stripecolorvalue {get;set;}
  private list<SelectOption> items;
  public list<SelectOption> getItems(){
    List<SelectOption> items = new List<SelectOption>();
    items.add(new SelectOption('','--None--'));
    items.add(new SelectOption('BG','BG'));
    items.add(new SelectOption('BK','BK'));
    items.add(new SelectOption('BU','BU'));
    items.add(new SelectOption('BU (LT BL)','BU (LT BL)'));
    items.add(new SelectOption('BN','BN'));
    items.add(new SelectOption('DB','DB'));
    items.add(new SelectOption('DG','DG'));
    items.add(new SelectOption('GN','GN'));
    items.add(new SelectOption('GN (LT GN)','GN (LT GN)'));
    items.add(new SelectOption('GY','GY'));
    items.add(new SelectOption('OG','OG'));
    items.add(new SelectOption('PK','PK'));
    items.add(new SelectOption('RD','RD'));
    items.add(new SelectOption('VT','VT'));
    items.add(new SelectOption('WH','WH'));
    items.add(new SelectOption('YE','YE'));
    return items;
  }
  

}

 

Custom Component

 

<apex:component controller="cComponetCombinedList">
	<apex:attribute name="basecolor" description="the base color of the cable" 
			type="String" required="true" assignTo="{!basecolorvalue}">
	</apex:attribute>
	<apex:attribute name="stripecolor" description="the stripe color of the cable" 
			type="String" required="true" assignTo="{!stripecolorvalue}">
	</apex:attribute>
	<apex:selectList value="{!basecolorvalue}" size="1">
		<apex:selectOptions value="{!items}">
		</apex:selectOptions>
	</apex:selectList>
	<apex:selectList value="{!stripecolorvalue}" size="1">
		<apex:selectOptions value="{!items}">
		</apex:selectOptions>
	</apex:selectList>
</apex:component>

 

below is the component referenced in VF:

apex:PageBlockSectionItem >
					<apex:outputLabel value="Pin 1 Base / Stripe Color:"/>
					<c:ComponentCombinedList basecolor="{!SRS_Product_Configuration__c.Pin_1_Base_Color__c}" 
								stripecolor="{!SRS_Product_Configuration__c.Pin_1_Stripe_Color__c}">
					</c:ComponentCombinedList>
				</apex:PageBlockSectionItem>

 

rendered in page correct:

 

1

 

when I change the values and save:

2

 

the value still as old:

 

Any ideas, comments are apperiated. Thanks

 

Qingsong

 

 

I know how to use apex to get Sobject prefix Id:
Schema.DescribeSObjectResult d = Schema.SObjectType.Reference_Opportunity__c ;
system.debug('======DescribeSObjectResult'+d.getKeyPrefix());

I have code:
<apex:commandButton value="Create new Reference Opportunity" onClick="window.open('https://cs4.salesforce.com/a0a/e?CF00NP0000000aoFc={!PXRB__c.Name}&CF00NP0000000aoFc_lkid={!PXRB__c.Id}&saveURL=%2F{!PXRB__c.Id}&retURL=%2F{!PXRB__c.Id}');"/>

this link will open an new screen for create new record under Reference_Opportunity__c, because this is child object of PXRB__C, so the default value will be put into PXRB_No__c field.

the "a0a" is the prefix of Sobject Reference_Opportunity__c
the "CF00NP0000000aoFc" is ID of the PXRB_No__c field in Sobject Reference_Opportunity__c

When we deploy into production, the SObject as well as the field Id will be different, so my question is how to get PXRB_No__c Id from production by using apex code.

Thanks.

Qingsong

Hey all,

Just a quick simple question.

Trying to update an object through Apex remoting. One of the fields I am attempting to update is a date time. In what format do I need to pass a datetime for it to work? I've tried just passing a date object, and date.toUTCString(). How do I need to format the datetime in javascript for apex to be able to deal with it? Thanks!

 

 

 

 

Hi ,

 

i wrote a before delete trigger , which works fine but the error message iam trying to display on the page when the trigger fires is not displaying on the same page , insetad its displaying on a different page with the message as below.

 

"Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "You cannot delete this record".

Click here to return to the previous page.   "

 

"You cannot delete this record" is the error message which i wrote in the trigger  which has to be displayed when a user is trying to delete that record.So iam not sure why its not showing the error message on the page .

 

 

 

 

Hi,

 

I am getting the following error and am struggling to find a fix.

 

"This page has changed since you started your edit. Refresh your page and try again."

 

The code has been running fine on developer accounts on na6 and na7 but is now failing on cs2!  Turning on logging doesnt pick up anything.  I don't understand why it works fine on one instance but not the other... dont think there is anything in the config that is much different.  Refreshing does not help.

 

I think the error may happen during a redirect but I will have to go through the code  - just wondering if anyone has seen this one before?

 

Any thoughts?

 

Thanks

Graham

Hi Friends,

 

One issue that i am facing to display the attachments related to an object on a VisualForce page is making me think that can we use the standard attachment View URL on a visualforce page.

 

URL is this:

 

https://cs2.salesforce.com/servlet/servlet.FileDownload?file=(FileName)

 

Can someone clarify this please??

 

Cool_D

 

PS: Whenever i use this link on my VF page, my URL gets broken in IE redirecting me to "https://cs2.salesforce.com/apex"

 

Hi there,

I am trying to create a trigger on a custom object "VerwijderFnc__c" what deletes records in another custom object "Functionaris__c"

 

process is: insert a record into VerwijderFnc__c and get the Id from the Functionaris__c to delete those Functionaris__c record(s).

Sometimes i get more then 20 records as a result! and that is too much!

 

so i try to make this trigger bulksafe .... But i can't get ik to work for me !

This was 1e my code for the trigger: (NOT BULKSAFE)

 

trigger deleteFromFunctionaris on VerwijderFnc__c (before insert) {
     for(VerwijderFnc__c verwijdertabel: Trigger.new){
         for (Functionaris__c fs: [SELECT Id FROM Functionaris__c WHERE mskey__c = :verwijdertabel.MSkey__c]){
            //Delete all the Functionaris__c entries with given mskey__c
            delete fs;
         }
     }
}

 

then i tried something like: (BUT ALSO GIVES TOO MANYDML STATMENTS)

 

trigger deleteFromFunctionaris on VerwijderFnc__c (before insert) {

 

Map<String, VerwijderFnc__c> fncMap = new Map<String, VerwijderFnc__c>(); for (VerwijderFnc__c fnc : System.Trigger.new) {  if ((fnc.mskey__c != null) && (System.Trigger.isInsert || (fnc.mskey__c != System.Trigger.oldMap.get(fnc.Id).mskey__c))) {

fncMap.put(fnc.mskey__c, fnc);

}

}

 

for (Functionaris__c func : [SELECT Id FROM Functionaris__c WHERE mskey__c IN :fncMap.KeySet()]) { delete func;

}

}

 

 

 

!! Help !!

 

 

 

Message Edited by Streepeye on 03-31-2009 05:56 AM

I need to change the button name from "New Event" to "New Appointment" on the Contact Detail realted list "Open Activities". 

 

I have tried to create a new button in the event button area, but this does not show as an option in the contact page layout "open activities" button area.

 

Any help would be appreciated.

  • March 28, 2009
  • Like
  • 0
 

 
I am using apex data loader 11.0 command line to extract data to CSV file, it's works, I would like to extract data from salesforce directly into MS SQL 2005, I was spent a lot of time to try and search the knowadge in this community but still not able to get this works, below is my code in database-con.xml:
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dbDataSource"
      class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://localhost;databaseName=CRMReport;"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>


<bean id="tmpAccount"
      class="com.salesforce.lexiloader.dao.database.DatabaseConfig"
      singleton="true">
    <property name="sqlConfig" ref="queryAccount"/>
    <property name="dataSource" ref="dbDataSource"/>
</bean>
<bean id="queryAccount"
      class="com.salesforce.lexiloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
        <value>
 select Id, IsDeleted, MasterRecordId, 
  Name, Type, RecordTypeId, ParentId, 
  BillingStreet, BillingCity, BillingState, 
  BillingPostalCode, BillingCountry, ShippingStreet, 
  ShippingCity, ShippingState, ShippingPostalCode, 
  ShippingCountry, Phone, Fax, 
  Website, Industry, AnnualRevenue, 
  NumberOfEmployees, 
  Description, CurrencyIsoCode, 
  OwnerId, CreatedDate, CreatedById, 
  LastModifiedDate, LastModifiedById, 
  SystemModstamp, LastActivityDate, 
  Region__c, Annual_Procurment__c, 
  Trial_Balance_Code__c, Customer_Group__c, 
  SAP_VEGA_1_Account_Number__c, 
  SAP_VEGA_2_Account_Number__c, 
  QAD_Account_Number__c, 
  BAAN_Account_Number__c, Brief_Name__c,Customer_PBU__c
 from tmpAccount
        </value>
    </property>
</bean>
</beans>


 
and then I have process-conf.xml as well:
 
Code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <!-- Extract Account to CSV File -->
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.lexiloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.entity" value="Account"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="C:\Program Files\salesforce.com\Apex Data Loader 11.0\Delphi\Conf\ExtractAccountMap.sdl"/>
                <entry key="dataAccess.type" value="databaseWrite"/>
                <entry key="dataAccess.name" value="tmpAccount"/>
                <entry key="sfdc.extractionSOQL" value="Select Id, IsDeleted, MasterRecordId, Name, Type, 
                     RecordTypeId, ParentId, BillingStreet, BillingCity, 
                     BillingState, BillingPostalCode, BillingCountry, 
                     ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, 
                     ShippingCountry, Phone, Fax, Website, Industry, AnnualRevenue, 
                     NumberOfEmployees, Description, CurrencyIsoCode, OwnerId, 
                     CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, 
                     SystemModstamp, LastActivityDate, Region__c, Annual_Procurment__c, 
                     Trial_Balance_Code__c, Customer_Group__c, 
                     SAP_VEGA_1_Account_Number__c, SAP_VEGA_2_Account_Number__c, 
                     QAD_Account_Number__c, BAAN_Account_Number__c, Brief_Name__c, 
                     Customer_PBU__c FROM Account"/>
            </map>
        </property>
    </bean>
</beans>

 

I downloaded the Microsoft SQL Server 2005 JDBC 1.2 into my C:\MSJDBC folder, and changed the original proccess.bat file to:
Code:
@echo off
if not [%1]==[] goto run
echo.
echo Usage: process ^<configuration directory^> ^[process name^]
echo.
echo      configuration directory -- directory that contains configuration files,
echo          i.e. config.properties, process-conf.xml, database-conf.xml
echo.
echo      process name -- optional name of a batch process bean in process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir AccountInsert
echo.
echo          If process name is not specified, the parameter values from config.properties
echo          will be used to run the process instead of process-conf.xml,
echo          for example:
echo.
echo              process ../myconfigdir
echo.

goto end

:run
set PROCESS_OPTION=
if not [%2]==[] set PROCESS_OPTION=process.name=%2

..\_jvm\bin\java.exe -classpath ..\DataLoader.jar;C:\MSJDBC\sqljdbc_1.2\enu\sqljdbc.jar -Dsalesforce.config.dir=%1 

com.salesforce.lexiloader.process.ProcessRunner %PROCESS_OPTION%

:end

 
and then we I execute the extract in command line:
 
process.bat ./conf csvAccountExtractProcess
 
I was get below errors:
 

177924 [csvAccountExtract] DEBUG com.salesforce.lexiloader.client.PartnerClient - Beginning web service operation: query
320410 [csvAccountExtract] ERROR com.salesforce.lexiloader.dao.database.Database Reader  - Database error encountered while writing row#1 through row#215 (execute batch update). Database configuration: tmpAccount.  Sql error: The SELECT statement is not permitted in a batch..com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT statement is not permitted in a batch.
 at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
        at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at com.salesforce.lexiloader.dao.database.DatabaseWriter.writeRowList(DatabaseWriter.java:180)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.writeExtraction(QueryVisitor.java:205)
        at com.salesforce.lexiloader.action.visitor.QueryVisitor.visit(QueryVisitor.java:111)
        at com.salesforce.lexiloader.action.ExtractAction.execute(ExtractAction.java:108)
        at com.salesforce.lexiloader.controller.Controller.executeAction(Controller.java:126)
        at com.salesforce.lexiloader.process.ProcessRunner.run(ProcessRunner.java:136)
        at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)
 at com.salesforce.lexiloader.process.ProcessRunner.main(ProcessRunner.java:228)

320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - Processed 214 of 214 total records. Rate: 24851000 records per hour. Estimated time to complete: 0 minutes and 0 seconds.  There are 0 successes and 214 errors.
320410 [csvAccountExtract] INFO com.salesforce.lexiloader.action.progress.NihilistProgressAdapter  - The extract has fully completed.  There were 0 successful extracts and 214 errors.

Looks like the SELECT statement have some problems, I am looking the solution here, any leads very be high appericated, Thanks
 


Message Edited by Qingsong on 04-15-2008 06:57 PM

Message Edited by Qingsong on 04-15-2008 07:09 PM

Message Edited by Qingsong on 04-15-2008 07:13 PM
Hi -
Is it possible to update the lead/contact owner of a large number of records using the data loader? I poked around a little and couldn't find anythig suitable and it's just not going to work if I have to transfer 250 at a time when I have 60K records to move.
Thanks for any help!