• iceberg4u
  • NEWBIE
  • 75 Points
  • Member since 2008

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 59
    Replies
Assuming the visualforce object (or element) is assigned an id (e.g. <apex:inputField id="someid" value="{!someval}" />), how would one go about referencing that object (inputField value) from apex?

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

Hi,
         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

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

 

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. 

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,

 

 Hi,

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.

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

 




 

 

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??

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??

 

 

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??

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??

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?? 

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'} );

 


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
Do I need to have the code coverage of all my classes to more than 75% or is it just that I need for the entire application(when i do run all tests!!).
The combo box fields in the MAC OS when viewed in Safari has no problems.The same when viewed in Firefox seems to have no style class applied.
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
Creating the binding to the web service...
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!!!
The applet starts successfully.Its purpose is to upload a pdf file.I have used the Salesforce APIs.And have included them in the JAR that I have prepared.The whole process works fine in HTML locally.The error that I am getting on Visual Force is :->

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;

    }


Here is the whole code:->
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.
I started with vf and apex for using custom controllers and hardly delved into the standard ones.For quite a while I have been seeing that many developers are using standard salesforce controllers and objects.Where could I get a downloadable pdf or tutorial on salesforce as a whole.I have with me the developers guide and the apex language reference.

Thanks.
This is the code soapbinding stub has been used with all of sforce packages.The IDE is Eclipse.

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??
my controller class
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>

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,

 

 Hi,

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.

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?

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

 

 

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;
}
}

 

 

 

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

  • April 12, 2009
  • Like
  • 0

Hello All,

 

Is it possible to call javascript function from "Rendered" attribute of pageblock section item..

 

 

 

 

 

 

 

Thanks,

Sandip

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??

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

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

 

 

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!

  • April 08, 2009
  • Like
  • 0
Assuming the visualforce object (or element) is assigned an id (e.g. <apex:inputField id="someid" value="{!someval}" />), how would one go about referencing that object (inputField value) from apex?

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

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

  • April 06, 2009
  • Like
  • 0

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.

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??

 

 

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.

  

  • February 16, 2009
  • Like
  • 0

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

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.