• rubel rana 6
  • NEWBIE
  • 10 Points
  • Member since 2021
  • Passionate Developer
  • Knowledgee

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies
Hello folks,

I have a date picker and it has a default placeholder. I want to change it to dd-mm-yyyy, I added placeholder, but in page, it is not showing. Showing the earlier default text. What can I do?
I added placeholder, like this
<apex:input value="{!fromDate }" type="date" html-placeholder="dd-mm-yyyy" style="width:140px" />


User-added image

Kind regards,
Rubel
I am beginner in Salesforce.
In other languages, I can debug easily, like in PHP , I can echo any variable, then I can understand, what is happening. 
In Salesforce class, I have many queries which contains some variable also. I wanted to system.debug the queries, but only first one is printing, other system.debug is not printing. Why it is happening?

And how to  efficiently, can debug in Salesforce?

Thank you guys.
Rubel
Hello folks, sorry for very beginner question.
I am using many queries in controller using some variables in the query. So, I want to see actually, what looks like my query. I wrote like
system.debug('Query : ' + Query);
How can I see the value of Query  now from controller?

Thanks.

I want to  run a query to fetch some data from opportunity on based of start date. So,I wrote a query like this.

select Id,Name from Opportunity where Start_Date__c = 03/01/2024

But, it's showing error in query editor. What is wrong in this code? 
Thanks.

Hello everyone !!

I can run a query , which gets value from date picker, and returns me values in date range. It works fine. But, now I want to get the value of SObject name from dropdown list and run the same query. But, my select value of drowpdown is not coming in controller. Can you please help me? Stuck in many days.
Please run the code, you can understand. 

Controller:
public class ContactsByDateController {
public List<Account> cts {get;set;}
public Date fromDate {get;set;}
public Date toDate {get;set;}
String[] countries = new String[]{};    
string c {get;set;}
string objName {get;set;}

String query;
public ContactsByDateController() {
    
}
    /* dropdown list start 
     * */
       public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('Account','Account'));
        options.add(new SelectOption('Contacts','Contacts'));
        options.add(new SelectOption('Jobs__c','JObs'));
        options.add(new SelectOption('My_leads__c','My Leads'));
        options.add(new SelectOption('My_Customers__c','My Customers'));
        
        return options;
    }
    
     public String[] getCountries() {
        return countries;
    }

    
    
    public void setCountries(String[] countries) {
        this.countries = countries;
    }
    
    /* dropdown list ends 
     * */

    /* variable assigning for selected list from dropdown*/
    
public void datepick1() {
Datetime fromDT = Datetime.newInstance(fromDate.year(), fromDate.month(), fromDate.day());
Datetime toDT = Datetime.newInstance(toDate.year(), toDate.month(), toDate.day());
objName = c;
String formattedFromDate = fromDT.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');
String formattedToDate = toDT.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');

if ( objName  == null ) {
 query = 'SELECT Name  FROM Account';
}
else {
 query = 'SELECT Name   FROM ' +objName;
}

query += ' WHERE CreatedDate >= ' + formattedFromDate;
query += ' AND CreatedDate <= ' + formattedToDate;
System.debug(query);
cts = Database.query(query);
}
public void clearResults() {
cts.clear();
}
}

Vsf page :

<apex:page docType="html-5.0" controller="ContactsByDateController" >
<apex:form >
<apex:input value="{! fromDate }" type="date" />
<apex:input value="{! toDate }" type="date" />
<apex:commandButton value="Search Contacts" action="{!datepick1}"/>
<apex:commandButton value="Clear Contacts" action="{!clearResults}"/>
<apex:selectList value="{!countries}" multiselect="false" size="3">
            <apex:selectOptions value="{!items}"/>
</apex:selectList><p/>
<apex:pageBlock title="Results in Range">
<apex:pageBlockTable value="{!cts}" var="ct">
<apex:column value="{!ct.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Hello everyone !
I am  newbie in Salesforce. 
I am facing problems to get value of dropdown list into controller. 
User-added imageMy goal is to use this value in a query. like

select * from variable_name
So that, I can select any object from dropdown list and I can see all the results of the object.
Below, I am adding my code sample that I am trying. But, it's not working. Can anyone help me to figure out what to do next or modify in this code?

Page :
<apex:page docType="html-5.0" controller="ContactsByDateController" >
    <apex:form >
        <apex:commandButton value="Search results" action="{!datepick1}"/>
        <apex:commandButton value="Clear results" action="{!clearResults}"/>
        <apex:selectList value="{!countries}" multiselect="true" size="3">
            <apex:selectOptions value="{!items}"/>
        </apex:selectList><p/> 
        <apex:pageBlock title="Results in Range">
            <apex:pageBlockTable value="{!cts}" var="ct">
                <apex:column value="{!ct.Name}"/>
                <apex:column value="{!ct.AccountNumber}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
    <!-- dropdown list starts -->
    <apex:outputPanel id="out">
        <apex:actionstatus id="status" startText="testing...">
            <apex:facet name="stop">
                <apex:outputPanel >
                    <p>You have selected:</p>
                    <apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
                </apex:outputPanel>
            </apex:facet>
        </apex:actionstatus>
    </apex:outputPanel>
    <!-- dropdown list ends -->
</apex:page>
Controller : 
public class ContactsByDateControllerr {
public List<Account> cts {get;set;}
    
String[] countries = new String[]{};    
public ContactsByDateControllerr() {
   	
}
    /* dropdown list start 
     * */
       public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('Account','Account'));
        options.add(new SelectOption('Contacts','Contacts'));
        options.add(new SelectOption('Jobs__c','JObs'));
        options.add(new SelectOption('My_leads__c','My Leads'));
		options.add(new SelectOption('My_Customers__c','My Customers'));
        
        return options;
    }
    
     public String[] getCountries() {
        return countries;
    }

    public void setCountries(String[] countries) {
        this.countries = countries;
    }
    /* dropdown list ends 
     * */

    /* variable assigning for selected list from dropdown*/
    
public void datepick1() {
String query = 'SELECT * FROM'+ countries;

System.debug(query);
cts = Database.query(query);
}
public void clearResults() {
cts.clear();
}
}

Thanks
Kind regards,
Rubel

 

 

Hi folks !!

I want something like,  From date - To date. User can select the dates, and I will show the results between the dates.
I can do something like this :User-added image
Date from_date = Date.newInstance(2021,10,10);
Date to_date = Date.newInstance(2019,3,20);
list<contact> a = [select name from contact where
(CreatedDate >=: from_date) AND CreatedDate <=: to_date) ];

Here, I put the values of the dates manually. I want to know that, when I will click on the submit button, how can I get the values from the date pickers and put them into a variable manually?

[ In PHP I did something like this task, I am new in Salesforce. I collected the values of the variables from the date picker using jquery. In Salesforce, don't know how to do it?]

Thanks in advance.
Hello folks,

I have a date picker and it has a default placeholder. I want to change it to dd-mm-yyyy, I added placeholder, but in page, it is not showing. Showing the earlier default text. What can I do?
I added placeholder, like this
<apex:input value="{!fromDate }" type="date" html-placeholder="dd-mm-yyyy" style="width:140px" />


User-added image

Kind regards,
Rubel
I am beginner in Salesforce.
In other languages, I can debug easily, like in PHP , I can echo any variable, then I can understand, what is happening. 
In Salesforce class, I have many queries which contains some variable also. I wanted to system.debug the queries, but only first one is printing, other system.debug is not printing. Why it is happening?

And how to  efficiently, can debug in Salesforce?

Thank you guys.
Rubel
Hello folks, sorry for very beginner question.
I am using many queries in controller using some variables in the query. So, I want to see actually, what looks like my query. I wrote like
system.debug('Query : ' + Query);
How can I see the value of Query  now from controller?

Thanks.

I want to  run a query to fetch some data from opportunity on based of start date. So,I wrote a query like this.

select Id,Name from Opportunity where Start_Date__c = 03/01/2024

But, it's showing error in query editor. What is wrong in this code? 
Thanks.

Hello everyone !!

I can run a query , which gets value from date picker, and returns me values in date range. It works fine. But, now I want to get the value of SObject name from dropdown list and run the same query. But, my select value of drowpdown is not coming in controller. Can you please help me? Stuck in many days.
Please run the code, you can understand. 

Controller:
public class ContactsByDateController {
public List<Account> cts {get;set;}
public Date fromDate {get;set;}
public Date toDate {get;set;}
String[] countries = new String[]{};    
string c {get;set;}
string objName {get;set;}

String query;
public ContactsByDateController() {
    
}
    /* dropdown list start 
     * */
       public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('Account','Account'));
        options.add(new SelectOption('Contacts','Contacts'));
        options.add(new SelectOption('Jobs__c','JObs'));
        options.add(new SelectOption('My_leads__c','My Leads'));
        options.add(new SelectOption('My_Customers__c','My Customers'));
        
        return options;
    }
    
     public String[] getCountries() {
        return countries;
    }

    
    
    public void setCountries(String[] countries) {
        this.countries = countries;
    }
    
    /* dropdown list ends 
     * */

    /* variable assigning for selected list from dropdown*/
    
public void datepick1() {
Datetime fromDT = Datetime.newInstance(fromDate.year(), fromDate.month(), fromDate.day());
Datetime toDT = Datetime.newInstance(toDate.year(), toDate.month(), toDate.day());
objName = c;
String formattedFromDate = fromDT.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');
String formattedToDate = toDT.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');

if ( objName  == null ) {
 query = 'SELECT Name  FROM Account';
}
else {
 query = 'SELECT Name   FROM ' +objName;
}

query += ' WHERE CreatedDate >= ' + formattedFromDate;
query += ' AND CreatedDate <= ' + formattedToDate;
System.debug(query);
cts = Database.query(query);
}
public void clearResults() {
cts.clear();
}
}

Vsf page :

<apex:page docType="html-5.0" controller="ContactsByDateController" >
<apex:form >
<apex:input value="{! fromDate }" type="date" />
<apex:input value="{! toDate }" type="date" />
<apex:commandButton value="Search Contacts" action="{!datepick1}"/>
<apex:commandButton value="Clear Contacts" action="{!clearResults}"/>
<apex:selectList value="{!countries}" multiselect="false" size="3">
            <apex:selectOptions value="{!items}"/>
</apex:selectList><p/>
<apex:pageBlock title="Results in Range">
<apex:pageBlockTable value="{!cts}" var="ct">
<apex:column value="{!ct.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi folks !!

I want something like,  From date - To date. User can select the dates, and I will show the results between the dates.
I can do something like this :User-added image
Date from_date = Date.newInstance(2021,10,10);
Date to_date = Date.newInstance(2019,3,20);
list<contact> a = [select name from contact where
(CreatedDate >=: from_date) AND CreatedDate <=: to_date) ];

Here, I put the values of the dates manually. I want to know that, when I will click on the submit button, how can I get the values from the date pickers and put them into a variable manually?

[ In PHP I did something like this task, I am new in Salesforce. I collected the values of the variables from the date picker using jquery. In Salesforce, don't know how to do it?]

Thanks in advance.
I am investigating some failing unit tests, and added some debugging in place.  However, the problem is the System.debug messages do not print to the Debug Logs.

What configuration do I need in my Debug Level to see these? I've currently got Apex Code, System and Apex Profiling set to Finest, Finest and Fine, respectively, and the System.debug messages just aren't being printed.