+ Start a Discussion

Is it safe to assume this?

Hi all,

I am wondering if the following is safe to assume always true.

http://*.salesforce.com/{Id} to reference a particular record in the database?
No. You should use the URL patterns returned by the describe call.
I am sorry, but I don't understand exactly what you mean by
"use the URL patterns returned by the describe call"?

I wrote the following function to get the reference of my previous record from my s-control. Is this good or ok or really bad idea?

function getIDFromURL(){
    var url = window.parent.parent.document.referrer;
    var id = url.substr(url.indexOf(".com/") + 5);
    if(id.indexOf("/") != -1)
        id = id.substr(0, id.indexOf("/"));
    return id;
the describeSObject call returns a number of URLs that can be used to build URLs to that type of object.

not every object in the system uses the *.salesforce.com/{id} format for its urls. wouldn't you be better off having the Id explicitly passed via a merge field ? your code will fail if the user bookmarks your scontrol.
merge field method doesn't necessary work for me, because user might not access my s-control directly from custom links from the associated record.

Hi Simon,
Do you have an example of an object that does not follow this pattern?
Gareth DaviesGareth Davies
Have a look at: Message 3354 Hope that helps. Gareth.

Message Edited by Gareth Davies on 04-03-2006 12:17 PM