-
ChatterFeed
-
3Best Answers
-
1Likes Received
-
0Likes Given
-
30Questions
-
59Replies
How to access a visualforce object / element from apex
-
- DrawloopSupport
- April 07, 2009
- Like
- 0
- Continue reading or reply
Eclipse Force.com Refresh From Server not working
Hello,
I use both online editor and eclipse to work on Apex and Visualforce code. For some reason when I do Refresh From Server, my local files are still old version.
I am using
Force.com version 15.0.1.200903241010
Eclipse 3.4.2 build M20090211-1700
In order to get correct version I have to delete the project and re-create it.
With best regards,
Pavel
-
- pvassiliev
- April 07, 2009
- Like
- 0
- Continue reading or reply
Type casting a Date variable into String type?
I tried to convert a Date variable into String type using toString() but getting an error. Can any one please mention how to convert a Date variable into String type.
Thanks in adv,
-Vissu
-
- crocodile
- December 22, 2008
- Like
- 0
- Continue reading or reply
Getting null in XMLStreamReader while reading attribute
public void parseXML(XmlStreamReader xsr)
{
while(xsr.hasNext())
{
if (xsr.getEventType() == XmlTag.START_ELEMENT)
{
if ('body' == xsr.getLocalName())
{
m_xmlValue += '-' + ' ' + parseRoot(xsr);
// parseRoot(xsr);
}
}
xsr.next();
}
}
public String parseRoot(XmlStreamReader xsr)
{
String value ='';
value += '---> ' + xsr.getAttributeValue('', 'chapter');
System.debug('The value of chapter is ::'+value);
while(xsr.hasNext())
{
if (xsr.getEventType() == XmlTag.END_ELEMENT)
{
break;
}
else if (xsr.getEventType() == XmlTag.CHARACTERS)
{
value += xsr.getText();
}
xsr.next();
}
return value;
}
public TestGoogleAppController()
{
try
{
//TestGoogleAppController tstGoogleApp = new TestGoogleAppController();
m_xmlValue = '';
//Playing with XML
//String xml = '<root><body chapter="1">Hello Peace</body><body chapter="2">Sumiran</body><body chapter="3">How</body></root>';
String xml = '<body chapter="1">Hello Peace</body>';
XmlStreamReader xsr = new XmlStreamReader(xml);
parseXML(xsr);
}
}
Guys, I have been stuck on this problem since morning.So please help out.
I am try to read the xml.I can read the values present between tags but I get "null" while reading attributes.Please could you point me in the right direction
-
- iceberg4u
- June 18, 2009
- Like
- 0
- Continue reading or reply
Problem with exporting excel documents
I am trying to export documents in excel format.
<apex:page controller="ExportController" cache="true"
title="Export" contenttype="application/vnd.ms-excel#Data.xls">
If any value consists of hyphen for eg: 12-12-56 it is displayed as 12/12/56 in the excel file.
Is this a bug or an error from my side?
Thanks.
-
- iceberg4u
- May 11, 2009
- Like
- 0
- Continue reading or reply
Redirecting users after login
Hi we have users with profiles cloned from Partner Portal.All of them login though the Sites.Now I have a need of redirecting these users to different pages after successful login on the basis of their profiles.
I have performed it like this:->
In the SiteLoginController I have done something like this:->
public PageReference login() {
Id profileId = UserInfo.getProfileId();
if(profileId == x)
startURL = '/asd';
else if(profileId == y)
startURL ='/asdwer';
return Site.login(username, password, startUrl) ;
}
Now the problem is a usability issue.When a first time user is made ,he or she would be changing his/her password when he logs into the first time.This changing password page or module is bypassed by my code.
Is there a method of achieving this?
Thanks,
-
- iceberg4u
- April 30, 2009
- Like
- 1
- Continue reading or reply
INSUFFICIENT_ACCESS_OR_READONLY error when all permissions have been provided
We have a profile cloned from "Partner User" named "CashRelease User". i have provided Custom Object Permissions to the custom object UserRoles.I have checked all the boxes present(Read,Create,Edit,Delete).There were no check boxes for View all and Modify All.
Now when I run a piece of code as a "CashRelease User" I get the below error:-
first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id.
and when I run it as system administrator it runs fine.
After giving all permissions it still does'nt work.
Please suggest a solution or an alternative approach to perform the action.
-
- iceberg4u
- April 30, 2009
- Like
- 0
- Continue reading or reply
Problems with creating partner portal users
I have a requirement that a user with a profile cloned from Partner User should be able to create new users with the same profile.
I am unable to do this through the Apex Code and get an exception :-
System.DmlException: Insert failed. First exception on
row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient
access rights on cross-reference id
-
- iceberg4u
- April 29, 2009
- Like
- 0
- Continue reading or reply
Converting String to Double.
Hi,
I have started facing problems with Double.valueOf(<String>) method.Whenever I send in a String value, the value becomes <smthn>E<smthn>.
Suppose I take a value of "11111111111" I get value as <smthn>E9.I get an error as "unexpected token: E9".
Suppose I take a value of "1111111111" I get value as <smthn>E8.I get an error as "unexpected token: E8".
What modification do I need to do for this??
-
- iceberg4u
- April 08, 2009
- Like
- 0
- Continue reading or reply
Problems with accessing history table.
Hi I have checked the trak history option for an object that I have.But I am not able to understand how to access the old values and new values.
For exaple I track the history of an object Customer.It has a field "Status" which is a Double.
How am I able to access this field status when the record in this object is updated??
my query would be
List<Customer__c> customerObj = [select oldValue,newValue from Customer__c where Parentid =: <some id over here >] ;
How would I access the newValue of the Status field ?
how do I get to see what the new status is??
-
- iceberg4u
- March 25, 2009
- Like
- 0
- Continue reading or reply
Salesforce to Salesforce problem
I tried to use the Salesforce to Salesforce functionality in my Apex code.for this I used two sandboxed organizations,each activated their Salesforce to Salesforce and a connection has alos been implemented.I then published a record->"CurrencyMaster" and some fields similarly on the other environment I subscribed to the same record and added it to "CurrencyMaster1" record.Now how can I access some of the values in the table"CurrencyMaster" in my other environment?
My Apex code:->
List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>([select Id, accountId, ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted']);
for(PartnerNetworkConnection network : connMap) {
PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();
newrecord.ConnectionId = network.Id;
newrecord.LocalRecordId = [select id from CurrencyMaster1__c limit 1].Id;
//newrecord.RelatedRecords = 'Contact,Opportunity,Orders__c';
//newrecord.SendClosedTasks = true;
//newrecord.SendOpenTasks = true;
//newrecord.SendEmails = true;
insert newrecord;
}
Please advise.The documentation was less on the same.Where am I going wrong??
-
- iceberg4u
- February 27, 2009
- Like
- 0
- Continue reading or reply
production license parameters
Hi
We have used an applet and a Web service in our app.If we get a production license , do we need to still get a digital signer(from Verisign,Thwate) on top of everything or does SalesForce provide us is with a signer certificate.
Also for the webseervice do we need to get an SSL certificate??
-
- iceberg4u
- February 16, 2009
- Like
- 0
- Continue reading or reply
Problems in exporting Excel documents in MAC
I have used the same code as provided for exporting in my application.In Windows the excel gets exported in a proper manner but when I try to export in MAC OS I get the code written inside the script tag from Salesforce's side.Here is the gibberish code that I get
if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'isAccessibleMode':false,'ampm':['AM','PM'],'locale':'en_US','dateTimeFormat':'M/d/yyyy h:mm a','today':'1/28/2009 2:37 AM','dateFormat':'M/d/yyyy','language':'en_US','siteUrlPrefix':'','userPreferences':[{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':112,'name':'HideInlineEditSplash'}
],'startOfWeek':'1'}
);
Is this a SalesForce bug or an error from our side.If it is an error do I need to log a bug??
-
- iceberg4u
- January 28, 2009
- Like
- 0
- Continue reading or reply
Error while exporting documents in MAC OS.
I am exporting an Excel document on a button click The document gets exported to Excel in proper format in Windows.
But when I try to do the same in MAC OS I get a top mline on the excel sheet with a jumble of computer code in the top.The document I want is produced fine after that.
My VF page code:->
<apex:page controller="InvoiceDataExportController" contenttype="application/vnd.ms-excel"
title="Invoice Export"
>
<apex:pageBlock title="Invoice Details">
<apex:pageBlockTable value="{!InvoiceDetails}" var="invDetail" border="1">
<apex:column headerValue="Invoice Number" value="{!invDetail.First}" />
<apex:column headerValue="Supplier" value="{!invDetail.Fifteenth}" />
<apex:column headerValue="Purchaser" value="{!invDetail.Twelth}" />
<apex:column headerValue="Invoice Date" value="{!invDetail.Sixteenth}" />
<apex:column headerValue="Confirmed at Purchaser" value="{!invDetail.Seventh}" />
<apex:column headerValue="Confirmed at Supplier" value="{!invDetail.Eighth}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
The gibbersih code that I have at the top is :->
if(!window.sfdcPage){window.sfdcPage = new ApexPage();} UserContext.initialize({'isAccessibleMode':false,'ampm':['AM','PM'],'locale':'en_US','dateTimeFormat':'M/d/yyyy h:mm a','today':'1/16/2009 1:31 AM','dateFormat':'M/d/yyyy','language':'en_US','siteUrlPrefix':'','userPreferences':[{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'} ,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'} ,{'value':false,'index':116,'name':'HideRPPWarning'} ,{'value':false,'index':115,'name':'DefaultTaskSendNotification'} ,{'value':false,'index':114,'name':'OverrideTaskSendNotification'} ,{'value':false,'index':112,'name':'HideInlineEditSplash'} ],'startOfWeek':'1'} );
-
- iceberg4u
- January 28, 2009
- Like
- 0
- Continue reading or reply
Problems with data binding.
I have a list on whose columns I have applied sorting.The functionality works perfectly well.The problem arises when I try to sort on the columns regularly sometimes they loose values and sometimes they work well without any problems.
I had logged a case in Salesforce but,the reply was:->
"
Currently Salesforce does not support the VisualForce. For assistance with this you would need to go to www.Salesforce.com/Developers for assistance with this issue.
"
Please advise.
Message Edited by iceberg4u on 01-20-2009 10:29 PM
-
- iceberg4u
- January 21, 2009
- Like
- 0
- Continue reading or reply
question regarding test code coverage?
-
- iceberg4u
- January 02, 2009
- Like
- 0
- Continue reading or reply
combo box in MAC OS viewed in Firefox browser
How do I put in the styles for the same.
When viewed on Windows XP all the 3 browsers showed the styles applied ->IE,FIREFOX and Safari
-
- iceberg4u
- December 22, 2008
- Like
- 0
- Continue reading or reply
Please have a look at this error:->
Exception in thread "AWT-EventQueue-2" 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.(Service.java:113)
at SforceServiceLocator.(SforceServiceLocator.java:8)
at UploadingPDF.login(UploadingPDF.java:80)
at UploadingPDF.actionPerformed(UploadingPDF.java:227)
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)
This is the error that I get when I try to use an applet to upload a pdf document in salesforce platform.While I try this in html environment,it works perfectly.Thinking that the version of the jre is different I checked it out with both class files of 1.5 and 1.6.Do i need to look for jre 1.4 too???
My general problem is that I need to get files uploaded from a VF page that I have prepared.All the apis from Salesforce have been used.I package it in a signed jar.Then when I integrate it with my VF page I get this error!!!
-
- iceberg4u
- October 23, 2008
- 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
I am facing problems with uploading pdf
private String createDocument(String content)
{
try {
// getUserInput("Hit enter to upload file......");
System.out.println(content);
//Retrieve Folder for file upload
Folder folder = null;
QueryResult qr = binding.query("Select Id, Name from Folder Where Name = 'CRDocuments'"); //the folder name where you would like the text file to be saved.
if (qr.getSize() > 0)
{
System.out.println("The folder size is greater than zero");
folder = (Folder) qr.getRecords(0);
}
System.out.println("folder name id:" + folder.getName());
System.out.println("folder id is:"+folder.getId());
//Create document object
if(folder != null)
{
com.sforce.soap.enterprise.sobject.Document document = new com.sforce.soap.enterprise.sobject.Document();
document.setName("InvoiceData"); //the name of the file
document.setBody(content.getBytes());
document.setFolderId(folder.getId());
document.setContentType("application/x-pdf");
documents = new com.sforce.soap.enterprise.sobject.Document[1];
documents[0] = document;
// create the object(s) by sending the array to the web service
SaveResult[] sr = binding.create(documents);
System.out.println("The number of the document is:"+sr.length);
System.out.println();
System.out.println("The body length is:"+document.getBodyLength());
System.out.println("The text in the body is:"+document.getBody());
for (int j = 0; j <sr.length; j++)
{
if (sr[j].isSuccess())
{
System.out.println("A document was created with an id of: " + sr[j].getId());
return sr[j].getId();
}
else
{
for (int i = 0; i < sr[j].getErrors().length; i++)
{
com.sforce.soap.enterprise.Error err = sr[j].getErrors()[i];
System.out.println("Errors were found on item " + new Integer(j).toString());
System.out.println("Error code is: " + err.getStatusCode().toString());
System.out.println("Error message: " + err.getMessage());
}
return null;
}
}
// getUserInput("\nHit return to continue...");
}
} catch (ApiFault af) {
System.out
.println("\nFailed to create account, error message was: \n"
+ af.getExceptionMessage());
//getUserInput("\nHit return to continue...");
} catch (Exception ex) {
System.out
.println("\nFailed to create account, error message was: \n"
+ ex.getMessage());
//getUserInput("\nHit return to continue...");
}
return null;
}
Is it because of the content in the body that the error is generated.The mime type is set as application/pdf what more do i need to do???In the case of jpeg files too I am facing the same problem.A document with no contents gets made.I am pretty sure its related to the content in the body.Kindly could you point out my mistakes.
-
- iceberg4u
- October 21, 2008
- Like
- 0
- Continue reading or reply
A quick question
Thanks.
-
- iceberg4u
- September 23, 2008
- Like
- 0
- Continue reading or reply
Having problems with uploading files using APIs
The BASE64 CODE is working fine.Whenever i try to upload files into my Documents I get an error message:
folder name id:CRDocuments
Folder was not null
The number of the document is:1
The body length is:22
The text in the body is:[B@1989b5
Errors were found on item 0
Error code is: INVALID_FIELD_FOR_INSERT_UPDATE
Error message: Unable to create/update fields: BodyLength. Please check the security settings of this field and verify that it is read/write for your profile.
The class file that I have used is:
com.sforce.soap.enterprise.sobject.Document document = new com.sforce.soap.enterprise.sobject.Document();
document.setName("Test");
document.setBody(Base64.base64Encode(strDoc).getBytes());
document.setBodyLength(Base64.base64Encode(strDoc).getBytes().length);
document.setFolder(folder);
document.setContentType("txt");
documents = new com.sforce.soap.enterprise.sobject.Document[1];
documents[0] = document;
Can anyone suggest what I am doing wrong??
-
- iceberg4u
- September 12, 2008
- Like
- 0
- Continue reading or reply
how do i make a query statement dynamic
public class NewOne
{
List<ContactUs__c> a=new List<ContactUs__c>();
public NewOne()
{
a=[select name,lastName__c from ContactUs__c];
}
public void sort1()
{
String val=System.currentPageReference().getParameters().get('st'); //m trying to pass the name of the custom field
System.debug('-------------------------------------------------------------');
System.debug('the value that i have is:'+val);
System.debug('-------------------------------------------------------------');
a=[select name,lastName__c from ContactUs__c order by val asc];
}
public List<ContactUs__c> getDataValue()
{
return a;
}
}
how do i use this "val" that stores a custom field like name,lastname__c in querying or for that matter just accessing data.
smthn like:- ContactUs__c a1=new ContactUs__c();
a."val"=XXX;
how do i use this val ??
from my page i have passed
<apex:outputText value="firstname"/>
<apex:actionSupport event="onclick" action="{!sort1}" rerender="tb">
<apex:param name="st" value="name"/>
</apex:actionSupport>
-
- iceberg4u
- September 08, 2008
- Like
- 0
- Continue reading or reply
Redirecting users after login
Hi we have users with profiles cloned from Partner Portal.All of them login though the Sites.Now I have a need of redirecting these users to different pages after successful login on the basis of their profiles.
I have performed it like this:->
In the SiteLoginController I have done something like this:->
public PageReference login() {
Id profileId = UserInfo.getProfileId();
if(profileId == x)
startURL = '/asd';
else if(profileId == y)
startURL ='/asdwer';
return Site.login(username, password, startUrl) ;
}
Now the problem is a usability issue.When a first time user is made ,he or she would be changing his/her password when he logs into the first time.This changing password page or module is bypassed by my code.
Is there a method of achieving this?
Thanks,
-
- iceberg4u
- April 30, 2009
- Like
- 1
- Continue reading or reply
INSUFFICIENT_ACCESS_OR_READONLY error when all permissions have been provided
We have a profile cloned from "Partner User" named "CashRelease User". i have provided Custom Object Permissions to the custom object UserRoles.I have checked all the boxes present(Read,Create,Edit,Delete).There were no check boxes for View all and Modify All.
Now when I run a piece of code as a "CashRelease User" I get the below error:-
first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id.
and when I run it as system administrator it runs fine.
After giving all permissions it still does'nt work.
Please suggest a solution or an alternative approach to perform the action.
- iceberg4u
- April 30, 2009
- Like
- 0
- Continue reading or reply
capture selection
I'm using selectCheckboxes in combination with selectOptions tag to display a list of options to be selected. When the user selects these options, how do I capture those selections?
Say it displays check boxes
Option 1
Option 2
Option 3
If a user selects Option 1, how does the controller know this? is there a variable associated with each checkbox displayed?
My end goal is: depending on the selections, the wizard will display the appropriate pages. Is this possible?
- withoutme
- April 15, 2009
- Like
- 0
- Continue reading or reply
How to remove date which gets display ...
Hello All,
I am using <apex:inputfield id="dt" value="{!User.Date__c}" /> through which I am collecting the date from
use.While displayig the calendar I am also able to see the todays date which gets display just near to textbox
how to remove that?
Thanks ,
Sandip
- Sandip458
- April 13, 2009
- Like
- 0
- Continue reading or reply
VisualForce JavasScript issue
Hi, In my visualforce page, I want to call apex method through javascript. Following is the code for the same. Code is working fine for Save1 button but not for Save button. Both the button call the same javascript method.
Please guide.
VisualForce Page
<apex:page controller="apexVFJavascript" tabStyle="Opportunity" >
<apex:form >
<apex:actionFunction name="customAction" action="{!customAction}" rendered="true" rerender="myStatus" >
<apex:param name="firstParam" value="" assignTo="{!first}"/>
<apex:param name="secondParam" value="" assignTo="{!second}"/>
</apex:actionFunction>
</apex:form>
<apex:form >
<apex:pageBlock >
<apex:commandButton onclick="doAction()" id="Save" title="Save" value="Save"/> <!-- not working for this button -->
<apex:outputPanel onclick="doAction()" styleClass="btn">Save</apex:outputPanel> <!-- working for this -->
</apex:pageBlock>
<script>
function doAction() {
customAction('1','2');
}
</script>
</apex:form>
<apex:outputPanel id="out">
<apex:outputText value="Hello "/>
<apex:actionStatus startText="requesting..." id="myStatus">
<apex:facet name="stop">{!first} - {!second}</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
Component Class
public class apexVFJavascript {
private String first='one',second='two';
public void setFirst(String s) {
this.first = s;
}
public String getFirst() {
return first;
}
public void setSecond(String s) {
this.second = s;
}
public String getSecond() {
return this.second;
}
public PageReference customAction() {
Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.FATAL,'Error Message'));
System.debug(first);
System.debug(second);
return null;
}
}
- Naishadh
- April 13, 2009
- Like
- 0
- Continue reading or reply
custom component updating main controller?
Hi,
If I create a custom component, is there any way to update a value on the parent controller? Let's say as a parameter passed into the custom component, I gave a value like {!value}. Can the controller behind the custom component modify that variable that's on the main page's custom controller? In java you might do this with a shared bean or session variable. What about in apex?
I have several VF tabs on my page. Each tab is a different business function. I end up re-using code on multiple VF pages so it would be great to make each tab a component so I can re-use thm elsewhere. Right now it's monolithic. But a link on one tab may cause the VF page to jump you to another tab and use a commandlink parameter.
So if we were to break this up into custom components, we would need to somehow pass data between them. Is that possible somehow? It looks like variables only flow one way or maybe we just don't know how to do it?
Any thoughts?
Thank you,
DSL
- DSL
- April 12, 2009
- Like
- 0
- Continue reading or reply
Is it possible to call javascript function from "Rendered" attribute
Hello All,
Is it possible to call javascript function from "Rendered" attribute of pageblock section item..
Thanks,
Sandip
- Sandip458
- April 09, 2009
- Like
- 0
- Continue reading or reply
Converting String to Double.
Hi,
I have started facing problems with Double.valueOf(<String>) method.Whenever I send in a String value, the value becomes <smthn>E<smthn>.
Suppose I take a value of "11111111111" I get value as <smthn>E9.I get an error as "unexpected token: E9".
Suppose I take a value of "1111111111" I get value as <smthn>E8.I get an error as "unexpected token: E8".
What modification do I need to do for this??
- iceberg4u
- April 08, 2009
- Like
- 0
- Continue reading or reply
Disabling selected checkboxes within SelectCheckBoxes component
Hello Friends,
I have a very generic requirement which i am unable to achieve. This is regarding the "SelectCheckboxes" VF component.
Below is the code which i am using:-
<apex:selectcheckboxes value="{!Values}" layout="PageDirection" > <apex:selectOptions value="{!ValueOptions}" /> </apex:selectcheckboxes>
The requirement is that i want to disable some of the checkboxes within this component depending on some criteria.
I tried using the "Disabled" attribute but it disables all the checkboxes instead of disabling selected ones. Is there a way i can achieve this??
Please let me know.
Many Thanks,
Cool_D
- Cool_Devloper
- April 08, 2009
- Like
- 0
- Continue reading or reply
Rendered Select Option list on select of first Select option list value
Hello All,
I am facing one problem while rendering the select option list.
What I am trying to acomplish is I have one select option list called Visa status shich is having
two options (values) "Yes" & "No" . Initially there is only on selectoption list i.e Visa Status on my page.
Now when I will select "Yes" the Other selectoption list i.e Visa Type should be rendered n populated with three values H1B,L1
and B1 just below the Visa Status slect option list.When I will select "No" the rendered Visa Type list should
be disappear from the page.
Please guide me how i will achive this ...
I hope somebody must be having the solution for this.....
Thanks ,
Sandip
- Sandip458
- April 08, 2009
- Like
- 0
- Continue reading or reply
rerender one part of a pageBlockTable?
Is it possible, using one of the action components like actionFunction or actionSupport, to rerender just one piece of a table? (in this case a pageBlockTable)
My table is listing Leads. (Leads contained in a wrapper obj defined in the controller, to be exact.) One of the columns contains a select control (so we've got a separate select control for each row). When onchange fires for the select, I'd like to rerender the contents of another column in the same row. Or it would be OK to rerender the entire other column. But I don't want to rerender the whole table, or the whole row.
I don't seem to be able to do this. If I put the column id in the rerender attribute, nothing seems to happen. Same if I use the id of the outputPanel that's contained inside that column (which would be repeated for each row, so not sure how to refer to the outputPanel contained in a particular row.)
Is this possible? Or is it only possible to refresh the table as a whole?
Thanks much!
- sparky
- April 08, 2009
- Like
- 0
- Continue reading or reply
How to access a visualforce object / element from apex
- DrawloopSupport
- April 07, 2009
- Like
- 0
- Continue reading or reply
Eclipse Force.com Refresh From Server not working
Hello,
I use both online editor and eclipse to work on Apex and Visualforce code. For some reason when I do Refresh From Server, my local files are still old version.
I am using
Force.com version 15.0.1.200903241010
Eclipse 3.4.2 build M20090211-1700
In order to get correct version I have to delete the project and re-create it.
With best regards,
Pavel
- pvassiliev
- April 07, 2009
- Like
- 0
- Continue reading or reply
browser Issue
In IE6 and IE7 the output text value is not getting populated but in Morzilla it is getting populated correctly
Based on the picklist value only this output text is getting populated.Give me a solution for this.How can I make it compactable on IE7 and IE6
Thanks
Ani
- ani
- April 06, 2009
- Like
- 0
- Continue reading or reply
how to upload a file in salesforce.com
Hi ,
I have developed a web service using apex code and succesful to invoke it using soap Client.
Now I have one new requirement to upload a file to the custom object. how do I upload a pdf/text file to the custom object from my local file system.Is there any way to do this ? Help Appreciated.
Thanks
Chandra.
- chandraYeruvaRe
- April 03, 2009
- Like
- 0
- Continue reading or reply
Problems with accessing history table.
Hi I have checked the trak history option for an object that I have.But I am not able to understand how to access the old values and new values.
For exaple I track the history of an object Customer.It has a field "Status" which is a Double.
How am I able to access this field status when the record in this object is updated??
my query would be
List<Customer__c> customerObj = [select oldValue,newValue from Customer__c where Parentid =: <some id over here >] ;
How would I access the newValue of the Status field ?
how do I get to see what the new status is??
- iceberg4u
- March 25, 2009
- Like
- 0
- Continue reading or reply
System.debug() output
I am invoking Apex methods from JavaScript using sforce.apex.exeute()
How do I see the debug output from the Apex code?The SOAP invocation returns an error. The system log window does not show anything.
When I look at the debug logs under Setup->Monitoring->Debug Logs, the log shows up with a large time lag.
Any pointers will be much appreciated.
- radan
- February 16, 2009
- Like
- 0
- Continue reading or reply
How to write test class for my search apex controller method
Folks,
I am writing a test class for my search function. In VF page it has three criteria i.e. Name, Start date and End Date to summarize the results and I am using command button method “rerender” to render the results in a data table.
In my Apex controller, the selected criteria’s will be checked for ‘null’ or ‘not null’ before querying the result. I need to pass values for these criteria satisfying both ‘null’ and ‘not null’ for testing.
How to write a test method to pass values for these criteria’s?.
Seemati
- SSoftsquare
- February 12, 2009
- Like
- 0
- Continue reading or reply
Setting up of From address in Email.Urgent
Hi,
We have an email messaging class Messaging.SingleEmailMessage for sending custom emailsWe need to configure the From email Address,and we are not able to find any such property that we can set the "From" address in Messaging.SingleEmailMessage object.
Kindly provide the solution as soon as possible!!
Thanks.
- sumiran123
- February 05, 2009
- Like
- 0
- Continue reading or reply