• kito kid
  • NEWBIE
  • 150 Points
  • Member since 2013

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 27
    Questions
  • 19
    Replies

I am using search conditions in 1st page.

but when 2nd page is exported as Excel sheet, the data are not filtered out by search conditions in 1st page. All the data are showing in Excel sheet.


all the conditions are same in 1st and 2nd page. Only button , calander are moved out from 2nd page.

 

PageReference OpenNewPage = New Pagereference('/apex'+'/mysecondpage');

OpenNewPage.setRedirect(false);
return OpenNewPage;

I am using secondary page, which serves as Excel page.

 

This second page will be called from frist page with command button , start end date (search criteira) etc.

 

The problem is when I download the second page (which has purely dataTable), showing calander like object. (Today(), Monday, ... etc) on excel sheet.

 

I am cofused as I don't put any calander object in second page. Only frist page has search criteira and when click download button, will download the excel sheet.

 

Any idea for that issue?

 

Thanks ahead for useful input.

In my main VF page, there is drop down menu which allows to choose different pages.

and command button 'Export Excel'.

<apex:include pageName="{!selectedPageName}"/>

 

Each Included Differnt VF page will show data according to the search criteira on the its page itself.

 

My requirement is when Export Excel command button is clicked, the selected Page will be downloded with criteria as Excel sheet (but exclude command button other criteria objects).

 

Currently my approach is I created second page (without command button or other criteria objects), only data which need to display in excel.

 

Code is as following.

PageReference OpenNewPage = New Pagereference('/apex'+'/PageA_SecondPageAsExcel');

OpenNewPage.setRedirect(false);
return OpenNewPage;

 

The issue is when Export Excel command button is clicked, the page go from PageA_Main to PageA_SecondPageAsExcel and show blank.

 

I want to avoid going to the Second page and showing blank page. But I want to export Excel too.

 

What kind of approach should I take? (any input will be so helpful for me).

 

Thanks ahead.

Integer a = 123;

Integer b = 300;

Dobule result = 0.0;

result = (a/b) * 100;

 

For that above method, whenever I make division always getting 0.

Any idea?

As I am using a lot of columns in Page block table, the width of page block table overflow the Page block width.

It looks quite bad as the width of page block is smaller and it appears on behind.

 

How can make Page block width also adjusted with page block table width?

I am using JS like below,

 

function DynamicDatePicker(d_id)
{
    DatePicker.pickDate(false,d_id.id,false);
}

 

 

 <apex:inputText id="startDate" value="{!startDate}" onfocus="DynamicDatePicker(this);"
                     size="20" disabled="false" style="width:80px;"/>

 

 

At inital , when user select from picker, value displays as 04/07/2013 (DD/MM/YYYY).

But after user submits the form, the value from the picker changes as [Thu Jul 04 00:00:00 GMT 2013].

 

How I can force the date time picker only displayed as DD/MM/YYYY ?

How can I use the Time Frame section (defaul Report in SF search function)  VF?

I like to wrap the section with certain border like default Report Date Range function UI.

 

 

I am trying to show the date as calander on first page load. Then user can change the date.

After that, if button is pressed, that selected date value should be passed to controller.

Now I can't even display the initial value to VF page.

How I can set it up?

 

here is my apex

public Date startDate {get;set;}

 

//constructor

public Class_Test()
 {
        startDate = date.today();

}

 

 

 

here is my VF.

<apex:page controller="Class_Test" id="VF_Class_Test" cache="FALSE" showHeader="FALSE" sidebar="FALSE" tabStyle="blah">

...

<apex:inputField value="{!startDate}"/>

I want to ask everyone's advice on how they handle the codes,etc.

 

In Eclipse, Is there any way to package the related codes and pages,etc into one folder (project by project) like we always do in other development?

 

As there are increasing projects which have totally different purpose and codes, I am facing difficultity in managing all the codes and pages under same Folder like classes, pages, etc.

 

As I am new to SF, I wonder how experienced SF developers are handling such kind of situations?

This question might be too general, but I want to know how other people are handling and want to learn from them.

 

I know there is Set Histroy Tracking for the changes of fields on Objects.

 

But the one I want to know is Tracking and Change Log of inserting new things(eg.fields,objects,workflows,apex classes etc), updating things and who did those and when. [ for developers, we can share a simple note txt file in eclipse share among the project, but there are also some users who are not developers and they can also make changes in Production Environment too].

 

Is there any useful way that you guys are using to manage the large projects acrocss multiple people?

 

Sometimes,I heard from previous devlelopers who lost track in who did the changes and when. 

 

How can I avoid those future troubles and handle that kind of situations? ( like enforcing people to log down the changes they have made to Production,etc).

 

Waiting for useful inputs.

I am new to salesforce.

Now I have been trying to deploy my part to the existing project in Production.

When I do validation before deploy my part(20 classes) , I hit the exception and failed.

 

The problem is the exception is hit from a existing class , I never used or call.

 

1) when perform validation, is SF run all the test classes (existing and new) ?

2) If that a case, is it too slow to re run all the test classes?

3) if that kind of exceptions from a class, you don't written... how we should handle it? (if the project is too big and too many codes)

 

Thanks ahead for any helpful inputs.

I am following the code below to grab the records which has been modified within last 1 hour.

 

Select a.Id From Account a
Where a.LastModifiedDate = TODAY AND HOUR_IN_DAY(a.LastModifiedDate) > 24

 

But , I can't get any records.

Any idea to get something like this.

Hi everyone,

I am new to apex and have some questions.

 

Below are my conditions.

I have class A_Class in which it calls the external end point in some methods.

To test this class, I have already written HTTP mock class and succesfully tested.


I have a schedular class, which calls A_Class to start to run its main method.

I want to test that schedular class.

But when I directly run the schedular with test class, it hits exception because of [TestMethod do not support Web service callouts].


I successfully tested A_Class with HTTP mock class, now I only want to test my schedular whether it is running at sepcific time correctly.

 

Do I need to comment out the calling of A_Class from schedular when I run test class? If I comment it out, just afraid it gives me problem when I deploy to Production.

 

How should I approach that kind of situation?

 

Thanks ahead. Any hints or ideas will be so useful for me.

 

As I am new to Apex and salesforce, someone told me that I need to write test class for each class that I have written and test them.

 

If I don't have test class, I can't move to production.

 

Is that correct?

 

Why do I need to write test class for each class I have written? Actually, sometimes it is so troublesome as I need to write even a new class to call to external end point. Even though my actual method has been working and already tested to call to end point, when I wirte test calss, it won't allow me to call http method directly and need to even create new class as Mock.

 

As someone scaring me , if I don't finish test class, I can't move my code to production.

 

Any helpful link or useful explanation will be so much appreaciated.

How can I reteive only the record created within last 12 hr?

 

I know I can reterive for last 1 day like using below.

datetime dt = System.now()-1;

 

a.CreatedDate >=: dt

 

How can I use dyamic hour to query the SOQL?

I set up my schedular to run start from 12:00 am per hourly.

When I set it up, the time is around 14:55 , and I run the code it debug console.

 

System.Schedule('MyPerHourScheduleTesting', '0 0 0/1 * * ?', new Schedular_MySchedular());

But when I check from [All Scheduled Jobs] , the time for [Next Scheduled Run] is 3:00 PM.

I wonder why. any set up mistake in my code?

I just want to start to run the program at 12:00 AM sharply next morning everyday.

Am I doing the right thing?

Below is my code.

 

companyList = [
            Select a.Id,a.Name, a.Phone, a.Website, etc... From Account a
            Where a.RecordType.Name = 'Blah'
            ];
String csvString = '';
        for(Account company : companyList)
        {
            csvString += myUtil.formatCSVString(company.Id) + ','
                        + myUtil.formatCSVString(company.Name) + ','
                        + myUtil.formatCSVString(company.Phone) + ','
                        etc...
                        ;
                        
        }

 

How can I solve this error?

I am not doing any insert or update. I am just only select the data and want to do necessary thing.

 

Currently I am using the de organisation for developer account.But there is no Sandbox option for developer account and I couldn't find it.

 

As I want to familiarize myself with as we might face in real Enterprise version sandbox and production, I want to create free sandbox for my developer account. 

 

And want to learn the deployment between sandbox and production environment.

 

And suggesstion on how to create free sandbox environment for Developer account?

I set up to run the schedular by running the below statement in console. but when I check from ScheduledJob, it doesn't appear.

 

1) I want to run every 2 mintues between 5:30 - 5: 55 minutes.

 

System.Schedule('Testing', '0 30-55/2 17 * * ?', new Schedular_MySchedular());

 

If I don't set up per minutes, such as System.Schedule('Testing', '0 30 17 * * ?', new Schedular_MySchedular()); the job appears in ScheuledJob list.

 

What might be the issue?

 

2) If I want to run schedular for every hour, how can I configure it?

 

Thanks ahead.

I want to implement for the below flow.

 

I do post http request to the another end point url.

that end point system will do http posting to the return url that I have specified for more information.

 

In that case, How can I set up or make a Apex class which can process the http post from other system?

So that I can capture the information from the http post and proceess the necessary things.

 

In java, we can create servlet and get the information back to our system.

 

As I am new to Apex, how can I make the url that can be exposed to other system and allow to capture information from post request by other system?

 

IMPORTANT NOTE: No authentication should be needed. As I just want to get the result of other system.

 

I am starting with RestResource. I think I am on right track while waiting for answers.

 

Thanks ahead.

I am using search conditions in 1st page.

but when 2nd page is exported as Excel sheet, the data are not filtered out by search conditions in 1st page. All the data are showing in Excel sheet.


all the conditions are same in 1st and 2nd page. Only button , calander are moved out from 2nd page.

 

PageReference OpenNewPage = New Pagereference('/apex'+'/mysecondpage');

OpenNewPage.setRedirect(false);
return OpenNewPage;

I am using secondary page, which serves as Excel page.

 

This second page will be called from frist page with command button , start end date (search criteira) etc.

 

The problem is when I download the second page (which has purely dataTable), showing calander like object. (Today(), Monday, ... etc) on excel sheet.

 

I am cofused as I don't put any calander object in second page. Only frist page has search criteira and when click download button, will download the excel sheet.

 

Any idea for that issue?

 

Thanks ahead for useful input.

In my main VF page, there is drop down menu which allows to choose different pages.

and command button 'Export Excel'.

<apex:include pageName="{!selectedPageName}"/>

 

Each Included Differnt VF page will show data according to the search criteira on the its page itself.

 

My requirement is when Export Excel command button is clicked, the selected Page will be downloded with criteria as Excel sheet (but exclude command button other criteria objects).

 

Currently my approach is I created second page (without command button or other criteria objects), only data which need to display in excel.

 

Code is as following.

PageReference OpenNewPage = New Pagereference('/apex'+'/PageA_SecondPageAsExcel');

OpenNewPage.setRedirect(false);
return OpenNewPage;

 

The issue is when Export Excel command button is clicked, the page go from PageA_Main to PageA_SecondPageAsExcel and show blank.

 

I want to avoid going to the Second page and showing blank page. But I want to export Excel too.

 

What kind of approach should I take? (any input will be so helpful for me).

 

Thanks ahead.

I am using JS like below,

 

function DynamicDatePicker(d_id)
{
    DatePicker.pickDate(false,d_id.id,false);
}

 

 

 <apex:inputText id="startDate" value="{!startDate}" onfocus="DynamicDatePicker(this);"
                     size="20" disabled="false" style="width:80px;"/>

 

 

At inital , when user select from picker, value displays as 04/07/2013 (DD/MM/YYYY).

But after user submits the form, the value from the picker changes as [Thu Jul 04 00:00:00 GMT 2013].

 

How I can force the date time picker only displayed as DD/MM/YYYY ?

I am trying to show the date as calander on first page load. Then user can change the date.

After that, if button is pressed, that selected date value should be passed to controller.

Now I can't even display the initial value to VF page.

How I can set it up?

 

here is my apex

public Date startDate {get;set;}

 

//constructor

public Class_Test()
 {
        startDate = date.today();

}

 

 

 

here is my VF.

<apex:page controller="Class_Test" id="VF_Class_Test" cache="FALSE" showHeader="FALSE" sidebar="FALSE" tabStyle="blah">

...

<apex:inputField value="{!startDate}"/>

I set up my schedular to run start from 12:00 am per hourly.

When I set it up, the time is around 14:55 , and I run the code it debug console.

 

System.Schedule('MyPerHourScheduleTesting', '0 0 0/1 * * ?', new Schedular_MySchedular());

But when I check from [All Scheduled Jobs] , the time for [Next Scheduled Run] is 3:00 PM.

I wonder why. any set up mistake in my code?

I just want to start to run the program at 12:00 AM sharply next morning everyday.

Am I doing the right thing?

Below is my code.

 

companyList = [
            Select a.Id,a.Name, a.Phone, a.Website, etc... From Account a
            Where a.RecordType.Name = 'Blah'
            ];
String csvString = '';
        for(Account company : companyList)
        {
            csvString += myUtil.formatCSVString(company.Id) + ','
                        + myUtil.formatCSVString(company.Name) + ','
                        + myUtil.formatCSVString(company.Phone) + ','
                        etc...
                        ;
                        
        }

 

How can I solve this error?

I am not doing any insert or update. I am just only select the data and want to do necessary thing.

 

I am trying to post the csv data through http post to end point url.

Below is my code.

 

          string test = 'test1,test1@gmail.com'; // which will be get from DB and make as CSV string


          String header = '--'+boundary+'\n';  //boundary is random string
          String footer = '\n'+boundary+'--';
          
          String bodyText = 'Content-Disposition: form-data; name="upload";'
                        + '\nfilename="test.csv"'
                        + '\nContent-Type: text/csv'
                        + '\n' + test;
           
          String body = header + bodyText + footer;
          req.setHeader('Content-Type','multipart/form-data; boundary='+boundary);
          req.setHeader('Content-Length',String.valueof(body.length()));
          req.setMethod('POST');
          req.setEndpoint(myendpoint);
          req.setBody(body);
          req.setTimeout(60000);

 

The problem is I couldn't able to post the data.

I make query from DB and make the data as CSV string.

Then put those CSV string in request body.

 

The requirement is I need to post the file.

Is it because the request can't be done successfully as I am making CSV string and put into request body?

 

Can anyone give me headstart?

I have been stuck on this problem quite long time now.

 

PS: I even tested whether my request header are right or not with posttestserver.com with REST client firefox plug in. Still can't post. Pls check out the test result. http://www.posttestserver.com/data/2013/07/01/01.18.49320686031

Below is the xml.

 

<item>
<title>
<![CDATA[ TESTING ]]>
</title>
<guid isPermaLink="false">https://www.test.com</guid>
<link>https://www.test.com/16</link>
</item>

 

I am using the followin code, but I couldn't get value of title.

In this case, I want TESTING insides title.

 

if(node.getName() == 'Item'){
       String data = node.getChildElement('title', null).getText()

}

As I am new bie to Salesforce platform, I have one question.

 

Can we just use plain Java Langauge in Apex class?

 

As I don't understand it clearly, it would be so helpful for me.

 

If not, in which cases Java Development is used in Salesforce?

 

any other requirements to use Java in Apex classes?

If I want to get the value "https://www.test.com/1234" as below. How I can get it using XMLStreamReader.

 

<item>

....

<guid isPermaLink="false">https://www.test.com</guid>
<link>https://www.test.com/1234</link>

...

</item>

 

I am using the code below. how should I  get the value insides <link> tag.

I used getText(), but get errors.

 

if(reader.getEventType() == XmlTag.START_ELEMENT && reader.getLocalName() == 'link'){

//get link value

}

During the development of apex classes, I found it is difficult for me to trace the classes according to their related purpose.

In Eclipse force IDE, I want to create a folder (package) which I meant to put some classes such as


1) Bean classes

2) Action classes

3) Other purpose classes, etc.

 

But even I create folder, I can't put or create new apex classes under certain folder.

 

So It is hard for me to search if I want to find certain class.

If I can create new folder and put certain classes under that folder, I can easily organize and manage my classes.

 

Any better approaches to share for a new learner like me?

 

 

I am new to Apex.

 

I want to generate CSV with apex from DB records with certain criteria.

And make it CSV avaliable as Link on the page to the user.

So that user can able to download it.

 

How can I achieve it? Any input will be helpful :D

 

Below are my current code for the step until getting recrod from DB.

 

 contactList = [
            Select c.AccountId,c.Email  From Contact c
        ];
        
        System.Debug('contactList: ' + contactList.size());
        
        //generate csv
        string header = 'AccountId, Email \n';
        string finalstr = header ;
        
        for(Contact c : contactList){
            string recordString = c.AccountId + ',' + c.Email + '\n';
            finalstr = finalstr + recordString;
        }

Hi,   I came across the following functuon for generating a random password.  I require that the password is alphanumeric.

 

I note the function does seem to return alphanumeric characters.  Does this seem correct or is it just a coincidence in the passwords I've generated so far?   I need to confirm if alphanumeric will always be returned. If so, what is the logic (explanation) for it?

 

public String generator(Integer len){
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
return key.substring(0,len);
}

 

Thanks in advance for any help!

I have some tests running for a Trigger (before insert), where I set some lookup fields (based on some logic from other fields).

 

Through debugging, I can see that the fields are set properly within my Trigger (let's call this field LookupField__c).

 

However, in my test class, if I query the inserted records [select Id, LookupField__c from Sobject where Id = :insertedRecord.Id], the LookupField__c is null (even though in the Trigger, I can see it was set).

 

The field is not touched anywhere else.  Is there a reason I can't query on this in the Test Class?  I could have sworn I used to be able to do this.

 

Hi all

I have used a pageblocktable in my visualforce page and applied a scrollbar for that by using ouputpanel styleClass but this applies a scroll for the entire table where as i whant to freeze my table header and apply scroll for only the data part how can i do that.

here is my code:

<apex:page Controller="mycontroller">
<style>
.container
{
   overflow:auto;  
   height:50px;  
   align:bottom;
}
</style>
     <apex:form >
        <apex:pageBlock title="My Content" mode="edit">
           <apex:pageBlockSection title="My Content Section" columns="1"   > 
               <apex:outputPanel layout="block" styleClass="container"  >           
                <apex:pageBlockTable value="{!temp}" var="item" align="top" width="100%" columns="10" >
                    <apex:column value="{!item.password__c}" ></apex:column>
                    <apex:column value="{!item.password__c}"></apex:column>  
                    <apex:column value="{!item.password__c}"></apex:column> 
                    <apex:column value="{!item.password__c}"></apex:column> 
                    <apex:column value="{!item.password__c}"></apex:column> 
                    <apex:column value="{!item.password__c}"></apex:column>
                    <apex:column value="{!item.password__c}"></apex:column>                      
                </apex:pageBlockTable>
             </apex:outputPanel>           
            </apex:pageBlockSection>
         </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

 

  • September 21, 2010
  • Like
  • 1