function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales4cesales4ce 

Home Page Component

Hi,

 

I am not sure it i am heading in the right direction. Any inputs are highly appreciated on this.

i am trying to design a tool called "Tip of the day" that would display on the Home Page with a scrolling text to the users.

 

I have created a custom object called Tip, which would hold all the tips. It contains the following columns, Tip, Start date, end date and a Link  column to the external system as well.

 

I would then display the tip based on the start date and end date.

 

Can any one help me how can i embed this page in the home component as a scrolling text?Do i need to use any fancy javascripting?

 

Thanks,

Sales4ce

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

You couldn't use "BETWEEN" in this case, because SOQL doesn't support that syntax. In SQL, it would be:

 

 

SELECT `Id`,`Tip_Of_The_Day__c` FROM `Tip__c` WHERE NOW() BETWEEN `Tip_Start_Date__c` AND `Tip_End_Date__c`

Since you can't use that syntax, you'll have to deal with the SOQL version:

 

 

 

... WHERE Tip_Start_Date__c <= TODAY AND Tip_End_Date__c >= TODAY

The reason why your query wouldn't work before is because your inequalities were backwards; the start date would have to be before today, and the end date would have to be after today.

 

 

You may want to change it to a List<Tip__c> variable so that you won't get the "no rows for assignment" error. Then, you can determine if the list is empty, and if so, tell the user that there is no current tip available.

All Answers

sfdcfoxsfdcfox

You can use the marquee tag if you want to trust a non-standard tag; this results in an easy way to make moving text. JavaScript is the correct way to make text move, since not all browsers support marquee, at least not as well as JavaScript. jQuery can make your life really easy in this case, as it has built-in animation code (might be overkill for your purpose, but I thought I'd throw that out there).

 

The real question is, how are you planning on loading those Tip of the Day entries? Will you use the AJAX Toolkit? A Visualforce page? There are a few ways to go about this, and your decision will ultimately impact how long it will take you to build this. Visualforce is likely easier to build, but not using Visualforce avoids an iframe tag, which means you can directly script the size of the frame dynamically, etc.

Pandey.ax996Pandey.ax996

The best way is to add the Visualforce in Iframe inside the home pagecomponent

 

And do whatever u want to do Inside that Visualforce Page . It will be displayed In Your Home Page Component

 

 <iframe height="0" src="/apex/YourPageName" frameborder="0" width="0" bgcolor="#CFEEF8"></iframe>

sales4cesales4ce

Thanks for you timely feedback.

I am planning to load these tips using a visualforce page. I have a roadblock on pulling out the Tips based on the criteria.

Every tip has a start date and end date and should display only during those dates.

My query is returning "No Rows" exception.

 

I know that we cannot use "between" keyword in SOQL query. How can i overcome this limitation?

 

Any ideas is greatly helpful.

 

todaysTip=[Select Id, Tip_of_Day__c From Tip__c Where Tip_Start_Date__c >= TODAY AND Tip_End_Date__c <= TODAY Limit 1 ]; //  This would certainly give no results, but how can i use something like a "Between" keyword used in traditional SQL queries.

 

 

Thanks,

Sales4ce

sfdcfoxsfdcfox

You couldn't use "BETWEEN" in this case, because SOQL doesn't support that syntax. In SQL, it would be:

 

 

SELECT `Id`,`Tip_Of_The_Day__c` FROM `Tip__c` WHERE NOW() BETWEEN `Tip_Start_Date__c` AND `Tip_End_Date__c`

Since you can't use that syntax, you'll have to deal with the SOQL version:

 

 

 

... WHERE Tip_Start_Date__c <= TODAY AND Tip_End_Date__c >= TODAY

The reason why your query wouldn't work before is because your inequalities were backwards; the start date would have to be before today, and the end date would have to be after today.

 

 

You may want to change it to a List<Tip__c> variable so that you won't get the "no rows for assignment" error. Then, you can determine if the list is empty, and if so, tell the user that there is no current tip available.

This was selected as the best answer