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
BAGELBAGEL 

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?
SuperfellSuperfell
No. You should use the URL patterns returned by the describe call.
BAGELBAGEL
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;
}
SuperfellSuperfell
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.
BAGELBAGEL
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.


dhruvadhruva
Hi Simon,
Do you have an example of an object that does not follow this pattern?
 
Thanks.
SuperfellSuperfell
Profile
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