best way to determine what params a page asks for?

  • 2
  • Question
  • Updated 3 years ago
  • (Edited)
I have a custom object with a lookup field to skuid__Page__c. What is the best way to access the url params that the page looks for? From the pagelist, when we preview a page that has params, it shows a nice popup with lookup fields for the params. Any way I can replicate just that popup? Or even better, just get the names of the params and dump them into a field?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Well, this may not be the most efficient, and it is certainly risk-prone if someone starts hacking XML, but've successfully used this inline script to update a ui-only field with the value of the first url param on a page:

(function(skuid){
var $ = skuid.$;
$(document.body).one('pageload',function(){
var docsModel = skuid.model.getModel('Documents');
$.each(docsModel.getRows(),function(i,row){
   var layout = row.Page__r.skuid__Layout__c;
   var startIndex = layout.indexOf('<condition type="param" value=') + 31;
   var endIndex = layout.indexOf(" ", startIndex) - 1;
   var param1 = layout.substring(startIndex,endIndex);
   docsModel.updateRow(row,{'Param1': param1});
});
});
})(skuid);

Anyone have a better way?