Does anyone have a creative way to get a file's in...
# suiteql
b
Does anyone have a creative way to get a file's internal ID from its path? I'm limited to getting it client side.
r
With suiteQL, something like the below should work. Its a little hacky and will be slow. You could probably do something similar with search but I'm not sure the performance would be any better.
Copy code
select
  f.id,
  f.name,
  fo.appfolder,
  replace(fo.appfolder,' : ','/')||'/'||f.name as path
from
  File f
  join MediaItemFolder fo on fo.id = f.folder
where
  replace(fo.appfolder,' : ','/')||'/'||f.name=<PATH TO LOOKUP>
b
That's amazing. Thank you very much
r
You could probably also make a suitelet which uses the file module to look up the Id and then call it from the client.
b
Yes, I know how to do that, but this has to work client side only with no server side code at all.
I modified it a bit, so that I convert the path to the appfolder format in JS before passing it to the WHERE