• CodeTalker
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 14
    Replies
 
Hi Everyone,
 
We have written a service that connects to SF to download accounts, analyze them, and then upload new leads. This was done before Apex code came out using the SF Java API.
 
Now Apex code is out. I have written apex classes which do the same thing (upload leads, download accounts.)
 
I have read through the Apex Langauge Reference several times too. But I am still a little confused about
when to use Apex code.
 
1. Should apex code be used for SOQL queries or DML statements instead of the API?
 
2. In a web services scenario, does Apex code have any advantages over the API? Is it faster?
 
3. Also is my (simple) apex code optimized for uploading leads? Or is there a better way?
 
Code:
webService static void saveLeads(Lead[] leads){insert leads;}

 

Message Edited by CodeTalker on 09-24-2007 01:52 PM

Message Edited by CodeTalker on 09-24-2007 01:52 PM

 
 
1. Using the metadata.wsdl, can I programatically create custom fields on standard objects?
 
 
2. When putting up an application on the AppExchange..
If I create custom fields in a standard object, those fields are not generated automatically
when the user downloads the application. Is that correct?
 
 
 
 
Hello,
 
I am having trouble calling a package created in Apex. I downloaded the WSDL and also generated the classes using Axis. I used the example from the  Salesforce Apex Language Reference pdf called "myPackage." (I modified it just a little.)
 
package myPackage {
webService Id makeContact(String lastName) {
Contact c = new Contact(lastName = 'Apex', firstName = 'Test');
insert c;
commit;
return c.id;
}
}
 
I now have 4 classes:
MyPackageBindingStub
MyPackageService
MyPackageServiceLocator
MyPackagePortType
 
Can someone show me how to relate these classes together to be able to call the package method.
I've tried logging in to salesforce using a bean, and then putting its session id into a new session header for the stub. When I go to call the method I get an error "No operation for this request."
 

MyPackageService service = new MyPackageServiceLocator();

MyPackageBindingStub bind = new MyPackageBindingStub();

SessionHeader sh = new SessionHeader(bean.getSessionId());

bind.setHeader(service.getServiceName().getNamespaceURI(), "SessionHeader", sh);

bind._setProperty(MyPackageBindingStub.ENDPOINT_ADDRESS_PROPERTY, bean.getLoginResult().getServerUrl());

String id = bind.makeContact("APEX test");

 
 
Does anyone have an example for calling a package? Thank you!
 
 
 
I am trying to get the Stock Quote example (Apex Cookbook p.169) working. All the individual steps seem to work(?), at least no errors are being generated. But I can't get the Tab to get and display the stock quote. Has anyone gotten it to work?

Hi
I hope someone has done the same thing and can help point out what is wrong with my problem here.
I wanted to change the Lead Home Page Tab to remove the Reports, Tools and Summary portions from the Content area of the Lead Home Tab.
The code from the Lead Home Page is copied using Web Developer View Source and by deleting the parts of the code for the Reports, Tools, Summary and also the left frames for Search, Recent Items, etc and the top frame for the tabs, logos, etc, the resulting Home Page interface looks perfect. However when I click on any of the links for example NEW button in the Content area, the return page includes the left frame and top frame interface within the content portion apart from the New Page.
Could someone help me as to what should I be looking for to amend in the coding? I have tried to look at the various materials available but could not find anything close as to how to solve this issue.
Any pointer will be highly appreciated
Thanks in advance
SL
  • November 02, 2007
  • Like
  • 0
 
Hi Everyone,
 
We have written a service that connects to SF to download accounts, analyze them, and then upload new leads. This was done before Apex code came out using the SF Java API.
 
Now Apex code is out. I have written apex classes which do the same thing (upload leads, download accounts.)
 
I have read through the Apex Langauge Reference several times too. But I am still a little confused about
when to use Apex code.
 
1. Should apex code be used for SOQL queries or DML statements instead of the API?
 
2. In a web services scenario, does Apex code have any advantages over the API? Is it faster?
 
3. Also is my (simple) apex code optimized for uploading leads? Or is there a better way?
 
Code:
webService static void saveLeads(Lead[] leads){insert leads;}

 

Message Edited by CodeTalker on 09-24-2007 01:52 PM

Message Edited by CodeTalker on 09-24-2007 01:52 PM

I'm a newbie in this Salesfore Java developement... i just want to write a very simple Java program that do some salesforce queries like inserting, upserting data... like the quickstartJava sample...
 
My current set up is:
Tomcat 4.1
Java SDK 1.5
Axis 1.4
 
When i tried to convert the enterprise.wsdl from my salesforce account to java classes, i got a list of exception errors... can someone help me understand what is going on?  Many thanks!
 
Code:
java org.apache.axis.wsdl.WSDL2Java enterprise.wsdl
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: javax.wsdl.Definition

        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.class$(JavaGenerator
Factory.java:68)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addDefinitionGenerat
ors(JavaGeneratorFactory.java:179)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.addGenerators(JavaGe
neratorFactory.java:133)
        at org.apache.axis.wsdl.toJava.JavaGeneratorFactory.<init>(JavaGenerator
Factory.java:111)
        at org.apache.axis.wsdl.toJava.Emitter.<init>(Emitter.java:159)
        at org.apache.axis.wsdl.WSDL2Java.createParser(WSDL2Java.java:209)
        at org.apache.axis.wsdl.gen.WSDL2.<init>(WSDL2.java:96)
        at org.apache.axis.wsdl.WSDL2Java.<init>(WSDL2Java.java:194)
        at org.apache.axis.wsdl.WSDL2Java.main(WSDL2Java.java:371)

 
  • September 19, 2007
  • Like
  • 0
 
 
1. Using the metadata.wsdl, can I programatically create custom fields on standard objects?
 
 
2. When putting up an application on the AppExchange..
If I create custom fields in a standard object, those fields are not generated automatically
when the user downloads the application. Is that correct?
 
 
 
 
Hello,
 
I am having trouble calling a package created in Apex. I downloaded the WSDL and also generated the classes using Axis. I used the example from the  Salesforce Apex Language Reference pdf called "myPackage." (I modified it just a little.)
 
package myPackage {
webService Id makeContact(String lastName) {
Contact c = new Contact(lastName = 'Apex', firstName = 'Test');
insert c;
commit;
return c.id;
}
}
 
I now have 4 classes:
MyPackageBindingStub
MyPackageService
MyPackageServiceLocator
MyPackagePortType
 
Can someone show me how to relate these classes together to be able to call the package method.
I've tried logging in to salesforce using a bean, and then putting its session id into a new session header for the stub. When I go to call the method I get an error "No operation for this request."
 

MyPackageService service = new MyPackageServiceLocator();

MyPackageBindingStub bind = new MyPackageBindingStub();

SessionHeader sh = new SessionHeader(bean.getSessionId());

bind.setHeader(service.getServiceName().getNamespaceURI(), "SessionHeader", sh);

bind._setProperty(MyPackageBindingStub.ENDPOINT_ADDRESS_PROPERTY, bean.getLoginResult().getServerUrl());

String id = bind.makeContact("APEX test");

 
 
Does anyone have an example for calling a package? Thank you!
 
 
 
Hi,
 
As a system administrator, I have created some customized views under the Accounts Tab. Now I would like to access this view from a client application using API instead of writing queries from the scratch to get the same resultset .  Please let me know if there is any methods which will let me access the customized views directly.
 
Thanks,
I am trying to write some trigger code and I need to access the field names of some of our custom fields.  I have a custom field named "Users" on the account level, and I want to create a string that contains the actual name of the field if it changed. However I don't know how to access a field's name (custom or otherwise).  I tried Trigger.new.Users__C.toLabel But this did not work.  Is this possible?
 
Here is my trigger code:
 

if (Trigger.old.Users__C != Trigger.new.Users__C)

{

String whatChanged = 'Changed '+ Trigger.new.Users__C.toLabel +' from '+ Trigger.old.Users__C + ' to ' + Trigger.new.Users__C;

}

 

Hello,
could we get Contacts Views name and definition through API

example All Contacts, My Contacts, etc
Hi:
 
I'm encountering errors during compilation time.  I'm using eclipse IDE running on jdk 1.4.2.
 
Two errors came up:
 
1)  "Too manay parameters, paramter Tools_Status__c is exceeding the limit of 255 words eligible for method parameters"
 
2)  "Too manay parameters, paramter vendio__c is exceeding the limit of 255 words eligible for method parameters"
 
Anyone encountered this before?
 
Let me know if you have a solution for this.
 
thanks,
 
jay

Message Edited by Jeps on 05-04-2006 02:44 PM

Message Edited by Jeps on 05-04-2006 02:45 PM

  • May 04, 2006
  • Like
  • 0

Please note there is an omission in the API 2.5 documentation concerning SOQL and LIKE.

 

The documentation is missing description of the LIKE keyword, which as in the case with SQL, allows wild card searching of text fields.

 

For example:

 

select id, firstname, lastname  from lead where lastname like 'Smith%'

 

Will match all last names starting with Smith.

 

select id, firstname, lastname  from lead where lastname like 'Smith_'

 

Will match all last names starting with Smith up to 1 additional character.  (IE Smiths will match, but Smithson will not.)

 

The documentation will be updated soon to reflect this feature.

  • December 04, 2003
  • Like
  • 0

How long does a session last after it goes idle? If some activity is performed periodically within this session time out limit, can the session last indefinitely?

thanks,

Peush