- sfdcdev.wordpress.com
- NEWBIE
- 110 Points
- Member since 2008
-
ChatterFeed
-
3Best Answers
-
0Likes Received
-
0Likes Given
-
8Questions
-
20Replies
passing a list from apex controller to javascript..
Hi everyone i have a list in my Apex class which has soql query result..
String query = 'SELECT City,Latitude__c FROM Lead WHERE City LIKE \''+city+'%\'';
leadrecords = Database.query(query);
Eg :in the above line leadrecords is alist of lead type
private List<Lead> leadrecords;
So now iam trying to pass this list to ajavascript variable so dat javascript variable should have query output...but when i have done like this iam able to pass the list but when iam tryong to display that it is displaying the ids but i want to display the field city and latitude which are storesd in that list how to do it please someone help me with the solution... to javascript variable so how to pass this list to javascript variable
-
- anu_karthi
- March 31, 2010
- Like
- 0
- Continue reading or reply
Problems with running applets in Visual Force
Exception in thread "AWT-EventQueue-4" java.lang.ClassFormatError: Incompatible magic value 168430090 in class file javax/servlet/ServletConfig
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at org.apache.commons.discovery.tools.ClassUtils.findPublicStaticMethod(ClassUtils.java:116)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:178)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.access$200(EngineConfigurationFactoryFinder.java:46)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:128)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)
at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at SforceServiceLocator.<init>(SforceServiceLocator.java:8)
at UploadingPDF.login(UploadingPDF.java:78)
at UploadingPDF.actionPerformed(UploadingPDF.java:224)
at javax.swing.JTextField.fireActionPerformed(Unknown Source)
at javax.swing.JTextField.postActionEvent(Unknown Source)
at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
What can I do??Do i need to do the login and other such commands in this java file heres the whole java fileI have used this function as well.The error starts immediately after printing"Creating the binding to the web service":->
public boolean login() {
un = ****;
if (un.length() == 0) {
return false;
}
pw = ******;
if (pw.length() == 0) {
return false;
}
// Provide feed back while we create the web service binding
System.out.println("Creating the binding to the web service...");
/*
* There are 2 ways to get the binding, one by passing a url to the
* getSoap() method of the SforceServiceLocator, the other by not
* passing a url. In the second case the binding will use the url
* contained in the wsdl file when the proxy was generated.
*/
try {
binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
System.out
.println("The login url is: "
+ binding
._getProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY));
} catch (ServiceException ex) {
System.out
.println("ERROR: creating binding to soap service, error was: \n"
+ ex.getMessage());
System.out.print("Hit return to continue...");
return false;
}
// Time out after a minute
binding.setTimeout(60000);
// Attempt the login giving the user feedback
System.out.println("LOGGING IN NOW....");
try {
loginResult = binding.login(un, pw);
} catch (LoginFault lf) {
System.out.println(lf.getExceptionMessage());
// lf.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
} catch (UnexpectedErrorFault uef) {
System.out.println(uef.getExceptionMessage());
uef.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
} catch (RemoteException re) {
System.out.println(re.getMessage());
re.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
}
System.out
.println("\nThe session id is: " + loginResult.getSessionId());
System.out.println("\nThe new server url is: "
+ loginResult.getServerUrl());
// set the session header for subsequent call authentication
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
loginResult.getServerUrl());
// Create a new session header object and set the session id to that
// returned by the login
SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResult.getSessionId());
binding.setHeader(new SforceServiceLocator().getServiceName()
.getNamespaceURI(), "SessionHeader", sh);
loggedIn = true;
// call the getServerTimestamp method
getServerTimestampSample();
// call the getUserInfo method
getUserInfoSample();
return true;
}
-
- iceberg4u
- October 23, 2008
- Like
- 0
- Continue reading or reply
Salesforce.com splitting records in bulk Activity Trigger
Hello,
We are trying to update some Task records using data loader or with Informatica. We have 4 triggers on Task Object which will be executed once the record set is updated.
In the past what used to happen is that when set of 50 task records got updated, they used to be batched up and sent as one set. All the Governor Limits are applied against this set.
Recently what we noticed is that, 50 record set is being split into 50 individual records and each of the triggers is run for this Individual task. This process is repeated until all the 50 records are finished. All these operations happen in one context and all the SOQLs and DMLs are added up cumulatively. This is resulting in our code crossing the governor limits which in turn is causing the failure of the update.
Is anyone else facing the same issue? Were you guys able to resolve this? and if yes how.
It would be great if any one can provide us with solution to your problem.
We really appreciate your help.
Thanks,
Girish Suravajhula
-
- sfdcdev.wordpress.com
- May 16, 2011
- Like
- 0
- Continue reading or reply
Batch Insert of Records in CSV file
Hello,
I am planning to do a insert of a large number of records that are inside of a CSV file. In the past we have provided the client a solution of using a Java program that reads the CSV file and makes the Insert by making use of Salesforce API.
However, now that the batch mode is available I was wondering if we can make use of it in this perticular scenario. Is there a way that we can can parse a large CSV file and insert records into Salesforce using salesforce batch mode.
Right now it appears that the batch mode can only run on records that are already inserted into Salesforce. I want the other way round, I want batch mode to be operational on records that are yet to be inserted into Salesforce.
It some one already did this, please post the code and I guess it woud be helpfull for lot of people who are running in this issue.
-
- sfdcdev.wordpress.com
- June 08, 2009
- Like
- 0
- Continue reading or reply
pageRef.setRedirect(false) not working suddenly
This is so frightening when something like this happens.
We had the following code
pageRef = new PageReference(url); pageRef.setRedirect(false); return pageRef;
It was working just fine up until two days ago. Suddenly, it stops working and the Visual Force page sits in the intermediate page and nothing happens after the method executes in the controller. Is there any change recently that I am not aware of. Please respond.
Thanks,
Girish Suravajhula.
Message Edited by Girish989 on 09-11-2008 07:48 AM
-
- sfdcdev.wordpress.com
- September 11, 2008
- Like
- 0
- Continue reading or reply
Using visual Force page as Homepage component.
I have a visual force custom search developed, can I use it a home page component.
Here is the simple code for my Visual Force page and I want this to be a homepage component.
<apex:page showHeader="false" controller="quichSeachController"> <apex:form target="_top"> <apex:panelGrid columns="2" style="width:100%;height:100%;background:#e8e8e8"> <apex:outputLabel value="SSN" for="SSN"/> <input id="ssn" name="ssn" size="10" /> <apex:outputLabel value="DOB" for="DOB"/> <input id="dob" name="dob" size="10" /> <apex:outputLabel value="TN" for="TN"/> <input id="tn" name="tn" size="10" /> <apex:commandButton action="{!go}" value="Go!" styleClass="btn"/> </apex:panelGrid> </apex:form> </apex:page>
I currently embed it using an iframe here is the code for that:
<P><IFRAME style="Z-INDEX: 220; WIDTH: 179px; POSITION: relative; HEIGHT: 100px" src="/apex/QuickSearch" frameBorder=0 scrolling=no target="_top"> </IFRAM><P></IFRAME></P>
However I don't want to do that as it would make the page loading slower as this would load separately from the main page.
Any advice will be greatly appreciated.
Regards,
Girish Suravajhula.
-
- sfdcdev.wordpress.com
- August 11, 2008
- Like
- 0
- Continue reading or reply
Apex File logging.
Hello,
It would be great if some one can suggest me a way to
develop Logger class that will log all my apex messages to a local file.
This would greatly help me, as this would give me an ability
to go through the failure messages, and debug the application more effectively.
I created an apex class that logs into Salesforce Document
object, but it would create 2 additional calls to Salesforce and is lot of
overhead for each request. Suggestions would be greatly appreciated.
public class Logger { private static final Document log = [Select d.Body From Document d where d.Name='LogFile'][0]; private String logMessage = ''; public void addToLog(String message){ logMessage = logMessage + System.now() + '::' +message + '\n'; } public void logmessage(){ log.body= Blob.valueOf(log.body.toString()+ logMessage); update log; logMessage = ''; } }
Thanks,
Girish S
-
- sfdcdev.wordpress.com
- June 27, 2008
- Like
- 0
- Continue reading or reply
Problem with Migration Tool
I am trying to Migrate my SControls from SandBox env to antother.
I am not able to migrate one of the scontrol that has this "Case.ContactId".
It gives me an error saying that ContactId does not exist for Case Object.
However during the coding of SControl it will not give me any error. It will even show it in the drop down when I select Case.
Any idea why this is happening. Help will be greatly appreciated.
var url = "/email/author/emailauthor.jsp—p3_lkid={!Case.Id}&rtype=003&p2_lkid={!Case.ContactId}&"+ "save=1&p24=&p4=&p5=&template_id="+tid+"&new_template=1";
Thanks,
GirishS
-
- sfdcdev.wordpress.com
- June 04, 2008
- Like
- 0
- Continue reading or reply
Display of null values
I am trying to disply values in a table. When one of the value is empty, it removes the line below it. Exactly the same problem we would get , when you are coding in HTML and the value returned from the backend is null.
I tried
<apex:outputText value="{!IF(aBilldetail.Proration_Phone__c==null,'  ',aBilldetail.Proration_Phone__c)}"
style="display: block;" />
but this doesnt work becuase SF coverts   to &,nbsp and treats it as a string.
Thanks,
GirishS
-
- sfdcdev.wordpress.com
- May 30, 2008
- Like
- 0
- Continue reading or reply
Display CheckBox in Results
-
- sfdcdev.wordpress.com
- May 30, 2008
- Like
- 0
- Continue reading or reply
Error occurred while loading a Visualforce page
I'm playing with the following example: http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_custom.htm
I created both the controller and the page. However, I see an error: http://i.imgur.com/JxJbnMy.png
I have *no* idea what went wrong. The question is how to debug this?
- iskradev
- September 09, 2013
- Like
- 0
- Continue reading or reply
OAuth 2.0 Web Server Flow with HTTPS callback uri
Hi,
I've implemented Salesforce OAuth 2.0 Web Server flow and it works perfectly well with a HTTP callback uri. But when I use an HTTPS callback URI, the page on which the User Approves the app to use Salesforce asks for less permissions than what is shown for HTTP URI.
The Remote Access Applications setup for both is exactly the same except the callback uri's ( obviously )
The page requesting the user to grant access for HTTP callback uri is asking for 3 permissions ( see https://www.dropbox.com/s/62qzsgev3nidw9o/developersalesforce.tiff )
1. Access your basic information
2. Access and manage your data
3. Perform requests on your behalf at any time
While the same page for HTTPS callback uri is only asking the first two options and not the third one ( see https://www.dropbox.com/s/w0k92iu42wuudug/securesalesforce.tiff )
Because of this, I cannot refresh my access tokens and the request to refresh access token fails.
Any insights on this will be highly appreciated.
Regards,
Agraj
- Agraj
- April 30, 2013
- Like
- 0
- Continue reading or reply
Salesforce.com splitting records in bulk Activity Trigger
Hello,
We are trying to update some Task records using data loader or with Informatica. We have 4 triggers on Task Object which will be executed once the record set is updated.
In the past what used to happen is that when set of 50 task records got updated, they used to be batched up and sent as one set. All the Governor Limits are applied against this set.
Recently what we noticed is that, 50 record set is being split into 50 individual records and each of the triggers is run for this Individual task. This process is repeated until all the 50 records are finished. All these operations happen in one context and all the SOQLs and DMLs are added up cumulatively. This is resulting in our code crossing the governor limits which in turn is causing the failure of the update.
Is anyone else facing the same issue? Were you guys able to resolve this? and if yes how.
It would be great if any one can provide us with solution to your problem.
We really appreciate your help.
Thanks,
Girish Suravajhula
- sfdcdev.wordpress.com
- May 16, 2011
- Like
- 0
- Continue reading or reply
SOQL equivalent for NOT LIKE...
Trying to do the following but not having much luck... is there a way to do this?
SELECT Id, Name FROM Account WHERE BillingCity NOT LIKE '%Bentonville%'
Thanks.
- rrichard
- May 09, 2011
- Like
- 0
- Continue reading or reply
unit test error - standard price not defined
I'm writing a unit test on the opportunity and opportunity line item. I am getting the error "No standard price is defined".
Here is my test method:
public static testMethod void test3() { Pricebook2 pb = new Pricebook2(Name = 'Standard Price Book 2009', Description = 'Price Book 2009 Products', IsActive = true); insert pb; Product2 prod = new Product2(Name = 'Anti-infectives 2007', Family = 'Best Practices', Practice__c = 'GP/BP', Service_Level__c = 'Partial Service', Product_Abbrev__c = 'CMR_Antiinfect', Sales_Unit__c = 'Each', Standard_Unit__c = 'Each', Product_Year__c = '07', Item_Type__c = 'Non-Inventory (Sales only)', IsActive = true); insert prod; PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false); insert pbe; Opportunity opp = new Opportunity(Name = 'Test Syndicated 2010', Type = 'Syndicated - New', StageName = 'Planning', CloseDate = system.today()); insert opp; OpportunityLineItem oli = new OpportunityLineItem(opportunityId = opp.Id, pricebookentryId = pbe.Id, Quantity = 1, UnitPrice = 7500, Description = '2007 CMR #4 - Anti-Infectives'); insert oli; List<OpportunityLineItem> olis = [Select Id From OpportunityLineItem Where OpportunityId =: opp.Id]; update olis[0]; }
The error is thrown on the line where I try and insert the PricebookEntry record:
PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true, UseStandardPrice = false); insert pbe;
I'm not sure what I'm missing.
Thanks for any help.
Regards.
- bohemianguy100
- March 31, 2011
- Like
- 1
- Continue reading or reply
Button override not working in the customer portal site
Hi everyone,
I have a custom object called WorkItem which I have made visible through customer portal. In my org, I have overridden the "Create New WorkItem" button with a VF page and it is working perfectly fine. But, when I try to access it through my customer portal, I am facing some problems and am not be redirected to the overriden page. rather, I am getting the standard edit page.
What do I need to do in order to fix this?
Thanks in advance.
SGM
- sgm_force
- March 21, 2011
- Like
- 0
- Continue reading or reply
passing a list from apex controller to javascript..
Hi everyone i have a list in my Apex class which has soql query result..
String query = 'SELECT City,Latitude__c FROM Lead WHERE City LIKE \''+city+'%\'';
leadrecords = Database.query(query);
Eg :in the above line leadrecords is alist of lead type
private List<Lead> leadrecords;
So now iam trying to pass this list to ajavascript variable so dat javascript variable should have query output...but when i have done like this iam able to pass the list but when iam tryong to display that it is displaying the ids but i want to display the field city and latitude which are storesd in that list how to do it please someone help me with the solution... to javascript variable so how to pass this list to javascript variable
- anu_karthi
- March 31, 2010
- Like
- 0
- Continue reading or reply
Batch Insert of Records in CSV file
Hello,
I am planning to do a insert of a large number of records that are inside of a CSV file. In the past we have provided the client a solution of using a Java program that reads the CSV file and makes the Insert by making use of Salesforce API.
However, now that the batch mode is available I was wondering if we can make use of it in this perticular scenario. Is there a way that we can can parse a large CSV file and insert records into Salesforce using salesforce batch mode.
Right now it appears that the batch mode can only run on records that are already inserted into Salesforce. I want the other way round, I want batch mode to be operational on records that are yet to be inserted into Salesforce.
It some one already did this, please post the code and I guess it woud be helpfull for lot of people who are running in this issue.
- sfdcdev.wordpress.com
- June 08, 2009
- Like
- 0
- Continue reading or reply
Problem with wsdl2Apex code generation - class relationship extension
Wsdl2java (Axis 2.0) generates class extension is properly. But in Apex, generate Apex from WSDL feature is not giving appropriate class relationship.
e.g. I have following xsd in wsdl
<xsd:complexType name="Profile">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="lang" type="xsd:string" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="UserProfile">
<xsd:simpleContent>
<xsd:extension base="Profile">
<xsd:attribute name="code" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
WSDL2Apex generates UserProfile and Profile classes, but dont have any relationship. In java Profile class has String _value containment. But Apex class does not have that containment too.
Any help would be appreciate.
Thanks.
Ankur
- patelankurb
- February 25, 2009
- Like
- 0
- Continue reading or reply
Problems with running applets in Visual Force
Exception in thread "AWT-EventQueue-4" java.lang.ClassFormatError: Incompatible magic value 168430090 in class file javax/servlet/ServletConfig
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at org.apache.commons.discovery.tools.ClassUtils.findPublicStaticMethod(ClassUtils.java:116)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:178)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.access$200(EngineConfigurationFactoryFinder.java:46)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineConfigurationFactoryFinder.java:128)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:113)
at org.apache.axis.configuration.EngineConfigurationFactoryFinder.newFactory(EngineConfigurationFactoryFinder.java:160)
at org.apache.axis.client.Service.getEngineConfiguration(Service.java:813)
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at SforceServiceLocator.<init>(SforceServiceLocator.java:8)
at UploadingPDF.login(UploadingPDF.java:78)
at UploadingPDF.actionPerformed(UploadingPDF.java:224)
at javax.swing.JTextField.fireActionPerformed(Unknown Source)
at javax.swing.JTextField.postActionEvent(Unknown Source)
at javax.swing.JTextField$NotifyAction.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
What can I do??Do i need to do the login and other such commands in this java file heres the whole java fileI have used this function as well.The error starts immediately after printing"Creating the binding to the web service":->
public boolean login() {
un = ****;
if (un.length() == 0) {
return false;
}
pw = ******;
if (pw.length() == 0) {
return false;
}
// Provide feed back while we create the web service binding
System.out.println("Creating the binding to the web service...");
/*
* There are 2 ways to get the binding, one by passing a url to the
* getSoap() method of the SforceServiceLocator, the other by not
* passing a url. In the second case the binding will use the url
* contained in the wsdl file when the proxy was generated.
*/
try {
binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
System.out
.println("The login url is: "
+ binding
._getProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY));
} catch (ServiceException ex) {
System.out
.println("ERROR: creating binding to soap service, error was: \n"
+ ex.getMessage());
System.out.print("Hit return to continue...");
return false;
}
// Time out after a minute
binding.setTimeout(60000);
// Attempt the login giving the user feedback
System.out.println("LOGGING IN NOW....");
try {
loginResult = binding.login(un, pw);
} catch (LoginFault lf) {
System.out.println(lf.getExceptionMessage());
// lf.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
} catch (UnexpectedErrorFault uef) {
System.out.println(uef.getExceptionMessage());
uef.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
} catch (RemoteException re) {
System.out.println(re.getMessage());
re.printStackTrace();
// getUserInput("\nHit return to continue...");
return false;
}
System.out
.println("\nThe session id is: " + loginResult.getSessionId());
System.out.println("\nThe new server url is: "
+ loginResult.getServerUrl());
// set the session header for subsequent call authentication
binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
loginResult.getServerUrl());
// Create a new session header object and set the session id to that
// returned by the login
SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResult.getSessionId());
binding.setHeader(new SforceServiceLocator().getServiceName()
.getNamespaceURI(), "SessionHeader", sh);
loggedIn = true;
// call the getServerTimestamp method
getServerTimestampSample();
// call the getUserInfo method
getUserInfoSample();
return true;
}
- iceberg4u
- October 23, 2008
- Like
- 0
- Continue reading or reply
Invalid Session ID found in SessionHeader: Illegal Session
Firstly I login the Salesforce through web and after I got API.SessionId and API.ServerUrl on VF page, I invoke web service method "loginBySessionID" to login Salesforce on the JAVA side.
But now it doesn't work.
Any Idea about it?
Thanks,
Kunpeng
- stepheny
- October 14, 2008
- Like
- 0
- Continue reading or reply
pageRef.setRedirect(false) not working suddenly
This is so frightening when something like this happens.
We had the following code
pageRef = new PageReference(url); pageRef.setRedirect(false); return pageRef;
It was working just fine up until two days ago. Suddenly, it stops working and the Visual Force page sits in the intermediate page and nothing happens after the method executes in the controller. Is there any change recently that I am not aware of. Please respond.
Thanks,
Girish Suravajhula.
Message Edited by Girish989 on 09-11-2008 07:48 AM
- sfdcdev.wordpress.com
- September 11, 2008
- Like
- 0
- Continue reading or reply
Why can't I add the Assiged To field in Task to my visualforce page?
I am trying to override the edit page for "Log a Call" or task with a custom visualforce page. I am having trouble getting some of the fields like
When I add the following for the Assigned To, it throws the error "Assigned To ID: owner cannot be blank". Basiaclly I want to display the Assigned To field as it appears in the standard Log a Call edit page. Is there some reference available somewhere for converting all these fields in the standard page into a VF page?
<apex:page standardController="Task" extensions="conTaskNew"> <apex:form > <apex:pageBlock id="mypageblock" title="Task Edit" mode="new"> <apex:pageBlockButtons > <apex:commandButton onclick="return lsave()" action="{!save}" value="Save"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Task Information" columns="2" id="theSection"> <apex:inputField id="vOwner" value="{!task.OwnerId}"/> <apex:inputField id="vActDate" value="{!task.ActivityDate}"/> <apex:inputField id="vsubject" value="{!task.Subject}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Appreciate all your valuable feedbacks.
- kgrasu
- September 04, 2008
- Like
- 0
- Continue reading or reply
Critical bug in Apex code: MIXED_DML_OPERATION prevents Users from having related objects
Our application adds an extra custom field to Users called "Other Emails". This is a string field where a User can enter a bunch of email aliases; whenever it's updated we normalize the information into a separate "EmailAddress" table and the Address then points back at the User.
As of yesterday, that worked great. I updated my User record to add an address to the "Other Emails" field. The trigger code executed perfectly, and the EmailAddress object was created & linked to my User record.
As of today, it is failing:
This is a critical part of an Apex-based application that we have been developing for over 8 months, and this section of code has always worked until today.
We've had to comment out unit tests to deal with this issue - which was lame, but acceptable - but actually changing our object relationships and code at this late date would be difficult.
- jhart
- June 19, 2008
- Like
- 0
- Continue reading or reply
Display of null values
I am trying to disply values in a table. When one of the value is empty, it removes the line below it. Exactly the same problem we would get , when you are coding in HTML and the value returned from the backend is null.
I tried
<apex:outputText value="{!IF(aBilldetail.Proration_Phone__c==null,'  ',aBilldetail.Proration_Phone__c)}"
style="display: block;" />
but this doesnt work becuase SF coverts   to &,nbsp and treats it as a string.
Thanks,
GirishS
- sfdcdev.wordpress.com
- May 30, 2008
- Like
- 0
- Continue reading or reply
Display CheckBox in Results
- sfdcdev.wordpress.com
- May 30, 2008
- Like
- 0
- Continue reading or reply
Does SOQL support "NOT LIKE" operator?
select Account__r.Id,Account__r.Name,Account__r.Account_Country__c from Card_UPC__c where Account__r.partner_relationship_status__c='Allow Relationships To Be Created' and Account__r.Name not like 'Test%'.
select Account__r.Id,Account__r.Name,Account__r.Account_Country__c from Card_UPC__c where Account__r.partner_relationship_status__c='Allow Relationships To Be Created' and Account__r.Name like 'Test%'
- arasu
- October 16, 2007
- Like
- 1
- Continue reading or reply