Skip to main content
Question

Mobile App version of kRid, Record ID

  • September 10, 2019
  • 0 replies
  • 37 views

Good Afternoon,

I know in JavaScript on the desktop browsers there is a global variable kRid which will give the Record ID of the current page... However global variables are not the same in the app.

I've been getting around this with implementing buttons and passing the [Record ID#] as a dataset in the button url...

I'm trying to do a true "onload" execution, and it needs to work via app. Has anyone been able to figure it out how to accomplish this?

My usecase is I want to take the record ID, and query to see if there's a related child record.

------------------------------
Ryan Stanford
------------------------------

EverettPatterso
Forum|alt.badge.img+10
Ryan,

For IOL mobile, use this in a rich text field and change moduleone.js to your code page name. I'm not sure yet if there is a global variable on mobile that we can grab and use, I'll keep poking around. 

"<img qbu=\"module\" src=\"/i/clear2x2.gif\" " &
"onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" &
URLRoot() &
"db/" &
Dbid() &
"?a=dbpage&pagename=moduleone.js&rand='+Math.random())}\">"​

Read Dan's post, he does a good job explaining
Mobile IOL

------------------------------
Everett Patterson
------------------------------

  • Author
  • Quickbase Alumni
  • September 12, 2019
I have a, what I think, to be a clunky solution, but it does work... Basically it checks for the global variable on desktop, gets the formContainer like you suggested, and I also have where it can be in the URL....

var RecID
try{RecID = kRid;}catch{}
if(!(RecID)){
try{RecID = parseInt( new URLSearchParams(window.location.search).get('rid'))}catch{}
}
if(!(RecID)){
try{RecID = parseInt(document.getElementsByClassName('formContainer')[0].getAttribute('data-rid'))}catch{}
}

------------------------------
Ryan Stanford
------------------------------