Wednesday, 7 January 2015

Relative Date Values for Salesforce List Views

We know that you can use 'Relative Date Values' as report filter criteria - e.g. TODAY. But did you know that you can also do it when creating a list view?




Full list of values here:
https://help.salesforce.com/HTViewHelpDoc?id=custom_dates.htm&language=en_US


This is very useful for creating things like This month's view, this week's view, Today's view etc.

Wednesday, 16 February 2011

Changing CSS on an already published page

Implenting CSS changes could be a pain if the user doesn't refresh - which they will not know to do.
One quick way to force a client to load the latest css is to rename it. The problem here is that you need to update your pages to point to the CSS (not a big problem if you use a modular design.)
 
You could also keep the same filename and pass a query param:
e.g.
href="styles.css?v=1000"

Simply update the parameter value when you change the CSS file.

Rather than having to update the parameter, you can use a server side function:
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen, projection" />

Friday, 19 November 2010

Mailto special characters

If a form is not available, the next best thing is to pre-populate and email with a template of the data you want to collect.  Mailto can be used with a subject and/or a short body.  If forced down the mailto route, it can be tricky to customise the resulting email, especially as each mail client can display the email in whatever way they like.  HTML can't be used so here some useful character codes that will be needed:
Character ASCII Escape Value
Carriage return %0D
Line feed %0A
New line %0D%0A
Tab %09
Space %20
Quotes (") %22
Apostrophe (') %27
Ampersand (&) %26
Percent sign (%) %25

Example (will open in your default email client):
 Test Mail to Link...
<a href="mailto:test@mail.com?subject=This is a test?body=This is one line.%0D%0AThis is another.%0D%0A%09Padded%0D%0A%09Padded%0D%0A%09Padded%0D%0A">Test mail to link...</a>

Monday, 23 August 2010

getElementById(ID)

Sometimes you want to be able to select a particular element from a web page. The getElementById(ID) JavaScript document object function returns the element whose ID is specified.

This simply lets you select any element from a document providing the means to perform an operation on that element. 

Some example JavaScript:
document.getElementById('div1').style.color = 'blue';
document.getElementById('input1').value = newvalue;

The id on the tag must be set:
<div id="div1"></div>
<input id="input1" type="text" />

Friday, 6 August 2010

MS Excel Alternate Row formatting

Colour alternate rows in MS Excel. Select the whole area choose Format > Conditional Formatting... and Add a new conditional formula, selecting the desired colour.

=MOD(ROW(),2)

Easy and if you add new rows it updates the colours automatically.

Sunday, 18 July 2010

What is this blog all about?

I've set up this blog to give me access to things I've learned that I would otherwise forget again.

Things I'll be adding will be related to my work as a web and software developer that I'd like to reuse without having to go back to the source code.

I'll also post some links to those other pages that have helped me.