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("/"));
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.
"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;
}
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.
Message Edited by Gareth Davies on 04-03-2006 12:17 PM