• Anand_agrawal@persistent.co.in
  • NEWBIE
  • 75 Points
  • Member since 2011

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 13
    Replies

Hi All,

 

I am new to VisualForce and I am still going through some testing with it to get more familiar. I am making a simple page where the user will enter a contact name and a list of all contacts that match the criteria will be displayed (in a dataTable). I setup my custom controller and wrote some VF markup for the page but I am getting the following error: 
Error: Could not resolve the entity from <apex:inputField> value binding '{!accountName}'. inputField can only be used with SObject fields.

 

I'm not sure what this means. My sample code is below. Does anyone have any suggestions?

 

 

Custom Controller

 

public class CardholderVfController {
    private String accountName;
    private List<String> accountList;
    private String contactName;
    private List<String> contactList;
    private final Case c;  
    
    //public CardholderVfController(ApexPages.StandardController stdController)
    //{
        //this.c = (Case)stdController.getRecord();
        //accountList = new List<String>(new String[] {'Test1', 'Test2'});
    //}
    
    public List<String> getAccounts()
    {
        accountList = new List<String>(new String[] {'TestAccountText1', 'TestAccountText2'});
        return this.accountList;
    }   
    
    public List<String> getContacts()
    {
        return this.contactList;
    }
    
    public void setAccountName(String s)
    {
        accountName = s;
    }
    
    public String getAccountName()
    {
        return this.accountName;
    }
    
    

}

 Page Markup

 

<apex:page controller="CardholderVfController">
<apex:form >
    <apex:pageBlock > 
    <apex:pageBlockSection >
        <apex:inputField id="accountNameField" value="{!accountName}"/>
        <apex:commandButton id="findAccount" title="Search"/>
    </apex:pageBlockSection>
    <apex:pageBlockSection >
            <apex:dataTable align="center" value="{!accounts}" var="a" >
                <apex:column value="{!a}"/>
            </apex:dataTable> 
    </apex:pageBlockSection>            
    </apex:pageBlock>
    {!accounts[0]}
</apex:form>
</apex:page>

 

 

 

Hello,

 

I've created few fieldsets in the USER object. However when I try to retrieve them using the migration tool (ant script), I see only custom fields and few std fields in the user object file. I've used the same script for custom objects and it worked for me and I could access the fieldsets from the custom objects.

 

Can somebody help me to get the fieldset retrieved through ant script for USER object?

 

Thanks in advance!


Anand Agrawal.


Hi,

 

I'm trying to import the users details through data loader. I've all the details and user's details in a CSV files.

 

My requirement is to send the user's login crendetials/information to the respective users in their email id.

 

I'm importing all the active users with proper licencing. However it is not sending any emails.

 

Can someone suggest me anyway out of it ?

 

Thanks,

Anand Agrawal.

Hi,

 

I am writing the apex logic to get the recent account modified.

 

So I came up with this query :

 

List<Account> accList = [Select name,lastmodifieddate from Account  where lastmodifieddate = :datetime.valueOf([select max(createddate) from account][0].get('expr0') + '')];
System.debug('--------------------------------------------------------- >>> ' + accList);

 

Can anyone tell me why is this not working ? :(

 

Howeven if I use '<' in place of '=' it works and lists down all the records.

 

Please help me to run this code.

 

Thanks in advance.

 

Anand Agrawal.

 

Hello,


I am working on a tool, in which I am using TASK (Activity) standard object as the task assigned to a particular user, so that it can be appeared on the home page when user login.


It has one parent object (let’s suppose ParentTask object). Users can see the task assigned to them either by going to ParentTask records and find out the associated task records in related list or on home page where the tasks will appeared when the users login.


My requirement is when users go to parentTask record they can see all the task’s records (Open & Completed). However on the home page they find only the open tasks.


Can anyone please suggest me the way to get this requirement ?


Thanks & Regards,

Anand Agrawal.

Hi,

 

We have a requirement of overriding the lookup functionality in which we open a popup window which displays the records in table view and selecting any record on that list will display the name field on the parent form and stores the respective ID field on a hidden component bound with the object's reference field.

 

However there are few standard object in the salesforce (service cloud based objects) which doesn't have the name fields available. So it breaks my code and throws the runtime exception name field not found.

 

Is there any way by which I can find out the field name used to identify the record's uniqueness ? (e.g. caseNumber field available in CASE object).

 

I was wondering if we could access the search layout fields information throught apex code. Can we ?

 

Thanks & Regards,

Anand Agrawal.

 

 

Hi,

 

I've created 2 FORMULA fields in my custom object. One of which is of TEXT AREA field and another is TEXT FIELD.

 

Now I want to perform some operation that will based on the field types (i.e. TEXT AREA or TEXT FIELD). However using the describe call I don't get such information of the formula field. When I try to fetch the field type for FORMULA FIELD every time it returns the STRING type.

 

So how can I differentiate between FORMULA TEXT AREA and FORMULA TEXT FIELD ?

 

Thanks & Regards,

Anand Agrawal.

Hi,

 

I am using the spring 11 fieldset feature to display the fields in a pageblock using dynamic binding. based on the fieldset size I am hiding/displaying the pageBlock. if fieldset size is 0 (zero) then pageblock will not be rendered otherwise it will.

 

However if fieldset is having any field which is not accessible to loggedin user then fieldset returns the size as no. of fields in fieldset irrespective of whether those fields are accessible or not.

 

My requirement is to hide the pageBlock if none of the fields in fieldset are accessible to logged user.

 

Can you please give me some pointer how can I archive this ?

 

Thanks,

Anand Agrawal.

Hi All,

 

I am facing some problem on new RTF field feature provided on Spring 11 upgrade.

 

So I created a Text Area (Rich) field on one of our custom objects. Lets say object name is cusomtObject__c and field name is RTFTest__c,

 

I tried binding this text area field on the visual force page with input field tag. However whatever I am entering on it, while submitting the form that value doesn't get passed to the server and on the record empty string ("") gets saved as value of RTFTest__c field.

 

Does anyone have any idea why is this happening ?

 

Thanks & Regards,

Anand Agrawal.

Hi,

 

I have got one requirement, In which I list down all  the fields of a particular object on the page and If user selects any field among the field names available in the list so he/she should be able to see the respective inputField (e.g is user selects the DOB from the list respective inputField of date time should be seen), accordingly for rest of the field types.

 

At the last I am going to store the value in a Key value pair as a record. However this dynamically rendering of inputFields are required for validation stuff at the client (on page) side.

 

Can you please help me to find how can we archive this ?

 

Thanks & Regards,

Anand Agrawal.

 

Hello,

 

I've created few fieldsets in the USER object. However when I try to retrieve them using the migration tool (ant script), I see only custom fields and few std fields in the user object file. I've used the same script for custom objects and it worked for me and I could access the fieldsets from the custom objects.

 

Can somebody help me to get the fieldset retrieved through ant script for USER object?

 

Thanks in advance!


Anand Agrawal.


Hi,

 

I am writing the apex logic to get the recent account modified.

 

So I came up with this query :

 

List<Account> accList = [Select name,lastmodifieddate from Account  where lastmodifieddate = :datetime.valueOf([select max(createddate) from account][0].get('expr0') + '')];
System.debug('--------------------------------------------------------- >>> ' + accList);

 

Can anyone tell me why is this not working ? :(

 

Howeven if I use '<' in place of '=' it works and lists down all the records.

 

Please help me to run this code.

 

Thanks in advance.

 

Anand Agrawal.

 

Hi,

 

We have a requirement of overriding the lookup functionality in which we open a popup window which displays the records in table view and selecting any record on that list will display the name field on the parent form and stores the respective ID field on a hidden component bound with the object's reference field.

 

However there are few standard object in the salesforce (service cloud based objects) which doesn't have the name fields available. So it breaks my code and throws the runtime exception name field not found.

 

Is there any way by which I can find out the field name used to identify the record's uniqueness ? (e.g. caseNumber field available in CASE object).

 

I was wondering if we could access the search layout fields information throught apex code. Can we ?

 

Thanks & Regards,

Anand Agrawal.

 

 

Hi,

 

I've created 2 FORMULA fields in my custom object. One of which is of TEXT AREA field and another is TEXT FIELD.

 

Now I want to perform some operation that will based on the field types (i.e. TEXT AREA or TEXT FIELD). However using the describe call I don't get such information of the formula field. When I try to fetch the field type for FORMULA FIELD every time it returns the STRING type.

 

So how can I differentiate between FORMULA TEXT AREA and FORMULA TEXT FIELD ?

 

Thanks & Regards,

Anand Agrawal.

Hi,

 

I am using the spring 11 fieldset feature to display the fields in a pageblock using dynamic binding. based on the fieldset size I am hiding/displaying the pageBlock. if fieldset size is 0 (zero) then pageblock will not be rendered otherwise it will.

 

However if fieldset is having any field which is not accessible to loggedin user then fieldset returns the size as no. of fields in fieldset irrespective of whether those fields are accessible or not.

 

My requirement is to hide the pageBlock if none of the fields in fieldset are accessible to logged user.

 

Can you please give me some pointer how can I archive this ?

 

Thanks,

Anand Agrawal.

Hi All,

 

I am facing some problem on new RTF field feature provided on Spring 11 upgrade.

 

So I created a Text Area (Rich) field on one of our custom objects. Lets say object name is cusomtObject__c and field name is RTFTest__c,

 

I tried binding this text area field on the visual force page with input field tag. However whatever I am entering on it, while submitting the form that value doesn't get passed to the server and on the record empty string ("") gets saved as value of RTFTest__c field.

 

Does anyone have any idea why is this happening ?

 

Thanks & Regards,

Anand Agrawal.

Hi All,

 

I am new to VisualForce and I am still going through some testing with it to get more familiar. I am making a simple page where the user will enter a contact name and a list of all contacts that match the criteria will be displayed (in a dataTable). I setup my custom controller and wrote some VF markup for the page but I am getting the following error: 
Error: Could not resolve the entity from <apex:inputField> value binding '{!accountName}'. inputField can only be used with SObject fields.

 

I'm not sure what this means. My sample code is below. Does anyone have any suggestions?

 

 

Custom Controller

 

public class CardholderVfController {
    private String accountName;
    private List<String> accountList;
    private String contactName;
    private List<String> contactList;
    private final Case c;  
    
    //public CardholderVfController(ApexPages.StandardController stdController)
    //{
        //this.c = (Case)stdController.getRecord();
        //accountList = new List<String>(new String[] {'Test1', 'Test2'});
    //}
    
    public List<String> getAccounts()
    {
        accountList = new List<String>(new String[] {'TestAccountText1', 'TestAccountText2'});
        return this.accountList;
    }   
    
    public List<String> getContacts()
    {
        return this.contactList;
    }
    
    public void setAccountName(String s)
    {
        accountName = s;
    }
    
    public String getAccountName()
    {
        return this.accountName;
    }
    
    

}

 Page Markup

 

<apex:page controller="CardholderVfController">
<apex:form >
    <apex:pageBlock > 
    <apex:pageBlockSection >
        <apex:inputField id="accountNameField" value="{!accountName}"/>
        <apex:commandButton id="findAccount" title="Search"/>
    </apex:pageBlockSection>
    <apex:pageBlockSection >
            <apex:dataTable align="center" value="{!accounts}" var="a" >
                <apex:column value="{!a}"/>
            </apex:dataTable> 
    </apex:pageBlockSection>            
    </apex:pageBlock>
    {!accounts[0]}
</apex:form>
</apex:page>

 

 

 

Hi,

 

I have a requirement in which I need to instantiate an object (Custom or standard) by the objectName (A String).


for example : If I send the "Account" string as parameter, I want an object (Account object) of this type should be instantiate and get assigned to SObject variable.

 

 

Is there any way we can archive this ?

 

Thanks & Regards,

Anand Agrawal.

Hi,

 

I have got one requirement, In which I list down all  the fields of a particular object on the page and If user selects any field among the field names available in the list so he/she should be able to see the respective inputField (e.g is user selects the DOB from the list respective inputField of date time should be seen), accordingly for rest of the field types.

 

At the last I am going to store the value in a Key value pair as a record. However this dynamically rendering of inputFields are required for validation stuff at the client (on page) side.

 

Can you please help me to find how can we archive this ?

 

Thanks & Regards,

Anand Agrawal.