Forum Discussion

Jenli's avatar
Jenli
Creator I
5 years ago

"client_ZipSelectedRelatedFiles" method Error.

Hi All,

I have an issue about client_ZipSelectedRelatedFiles method that I got from Aras GitHub lab which is useful for mutiple download functionality,once  I added a line " fileItem.setProperty("locked_by_id", "30B991F927274FA3829655F50C99472E");" then It pops up error that said ARAS object:"undefined" which confused me, any ideas? Thanks!

7 Replies

  • Hi,

    getItemById is not intended to be used with additional filter properties. It´s a simply way to make a get query that returns the complete item. I personally prefer the regular get queries due to performance reasons.

    When you want to add an additional filter, make a normal get, e.g. like:

    var filteItem = inn.newItem("File","get");
    [...your additional code...]

    • Jenli's avatar
      Jenli
      Creator I

      Hi Angelalp,

      I did updated the a piece of code as you suggested, using regular get queries instead of getItemById.

      it looks fine until the code runs to the red line I marked which downloading files as Zip file then shows the same error again. Is that "fileItem" should  not be a item object or something else? Appreciate it.

       

      • angela's avatar
        angela
        Catalyst II

        Hi Jenli,

        my tip was not completely correct.

        aras.downloadFile always require the full item, so according to my knowledge, you may have to use it with getItemById. I never used in another way, e.g. this one is my variant (custom properties). 

        var fileItem = aras.getItemById("File", dom.firstChild.getAttribute("id"));
        aras.downloadFile(fileItem, zipFileName + ".zip");

        Does downloading the zip file work when you just the sample "as is"? I wonder why you wanted to add the "locked_by_id" filter. "File" items are normally not locked/unlocked. 
        The downloadFile function will download you the final zip result. Each filter you want to add you have to provide before so the used id list for the involved Files is correct.

        When you use one of the newer Innovator Versions (late Innovator 11 or Innovator 12) I would also recommend to remove all "top." prefixes. You will not need them and sometimes they can lead to trouble.