2 Replies Latest reply on Jul 25, 2014 10:38 AM by RobKeys

    Insert File/Picture/PDF/etc. Script Step with Interactive Content

    RobKeys

      Title

      Insert File/Picture/PDF/etc. Script Step with Interactive Content

      Post

           In a solution I am working on I am trying to insert a number of files a user has been working with in a global field into interactive container fields in records. The file that is active is stored as a reference in a Global Container field, and additional files are kept as paths in a value list. All of this works as expected. The trouble comes when I am scripting the saving of the files to records. 

           I have tried it two ways now. The first by using the Insert File script step. I don't want to show the user the file selection dialog again to have them select the same files that they have already been working with. This means I cannot use 'Dialog options' to 'display content when possible,' and the script step inserts the file as an 'Icon with filename' by default.

           I have also tried to use the Insert Picture/PDF/Etc. script steps by comparing the file type to value lists containing the appropriate file types for the appropriate script step (.png will use Insert Picture while .pdf will use Insert PDF). This throws an error that the file cannot be found even though when I step through the script to examine the path that is being passed it is the same as the one that I would have passed to the Insert File Script Step that inserts the File just fine (albeit not in an interactive format).

           The attached image shows the script using the second method I describe, the Insert File script step as in the first method, and two paths in a value list as described above.

           Any insight? I can provide more detail and examples if this is not clear.

            

            

      Screen_Shot_2014-07-24_at_1.43.03_PM.png

        • 1. Re: Insert File/Picture/PDF/etc. Script Step with Interactive Content
          philmodjunk

               ValuePosition appears to be a custom function. Perhaps it is not working as expected. Have you checked to see that the correct branch of the If - Else IF tree is executing with each selected file type?

               I'd use this expression to check and see if $FileType is a member of a particular value list's list of values:

               Not IsEmpty ( FilterValues ( ValueListItems ( Get ( FileName ) ; "ValueListNameInQuotes" ) ) )

               No custom function needed.

          • 2. Re: Insert File/Picture/PDF/etc. Script Step with Interactive Content
            RobKeys

                 My problem is not with the logic of my If statement, but with inserting files into a container field. I mentioned above that it was throwing an error that the file cannot be found. This is happening on the Insert Picture/PDF/Etc. steps. I have included the error below to illustrate. Thank you for taking the time to try to help, however.