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
dlucia21dlucia21 

Is there an example of the layoutEditPage and layoutDetailPage methods?

It's hard to tell from the blog how to use these methods so if someone can provide me an example that would be great.
 
Thanks.
tyshocktyshock

Code:

function whatever() {

........init stuff omitted..........

var query = "Select ......your desired fields here..... " +

" From Opportunity " + 

" where Id = '" + OppID + "'";


sforceClient.query(query, layoutResults); 


} 


function layoutResults(queryResult) { 

if (queryResult.className == "Fault") { 

 alert("There was an error: " + queryResult.toString()); 

} else { 

 if (queryResult.size > 0) { 
  for (var i=0;i<queryResult.records.length;i++) {
   var dynaBean = queryResult.records[i];
   var layout = dynaBean.layoutDetailPage();
   document.body.appendChild(layout);
  }
 }
}


 

This should give you an idea.
DevAngelDevAngel
One caveat here is that the current layoutPage implementation does not use the new skins, and may be a bit buggy.  Try it, see if you like it, and if you need to change it, just go ahead and override it.  This function is more a proof of concept rather than a production ready feature.
dlucia21dlucia21
I followed the example but my browser hangs and eventually I would have to end the process.  Do these methods currently work?