You need to sign in to do that
Don't have an account?
Creating Custom Link/S-Control
I need to create a dynamic link to our inhouse Sales Data Warehouse reports. For this dynamic link, I need the beginning of the link, which is static:
http://servername.maritz.com:7778/reports/rwservlet?maso&AUTHID=charts/display1&p1=
For the p1 parameter, I need it comprised of a custom field on the user object {!User.HR_ID__c}. HR_ID__c is a numeric custom field, but in the link, it includes the commas. How can I remove them?
Also in the p1 parameter, I need the current date. I tried using the code: {!TODAY()}, but it is not formatting correctly for the link (see details below).
Here is the full custom link code that I am using:
http://servername.maritz.com:7778/reports/rwservlet?maso&AUTHID=charts/display1&p1={!User.HR_ID__c}{!TODAY()}
Here is what it results in:
http://servername.maritz.com:7778/reports/rwservlet?maso&AUTHID=charts/display1&p1=150%2C2518%2F20%2F2009
I need it to be:
http://servername.maritz.com:7778/reports/rwservlet?maso&AUTHID=charts/display1&p1=15025108202009
So, 150251 for the HR ID, and 08202009 for the date.
Further, once I have this, they actually want the p1 parameter (so the 15025108202009) encrypted in a simple manner. The HR ID is always 6 digits, so they want it mixed up a bit (e.g. putting the last 3 digits of the HR ID, then putting the year from the date, then putting the 1st 3 digits of the HR ID, then putting the 2 digit day, then the 2 digit month - so, 25120091502008). To, do this, can I still use a custom link? Or do I need to switch to an s-control? Is there any kind of documentation regarding how to do something like this? I am new to force.com development, so I'm not sure of the syntax. Thanks so much for any help.
Hi Joanna,
I suggest building the string in a formula field first. This field does not need to be exposed on the page layout. It should be a formula field of type text with the following content:
SUBSTITUTE( TEXT( $User.HR_ID__c ), ",", "")& IF(MONTH(TODAY())<10,"0","")&TEXT(MONTH(TODAY()))& IF(DAY(TODAY())<10,"0","")&TEXT(DAY(TODAY()))& TEXT(YEAR(TODAY()) )
Then use this new field in the link.
I would advise never to use number fields for any kind of ID! There will always be issues with formatting, leading 0's, etc. Generally, unless you want to do calculations, I would use text fields.