cannot download/open file attached to the file attachment control

  • 25 November 2015
  • 3 replies
  • 21 views

Badge +7

Hey guys,

 

This one is bit odd and driving me insane. scenario stated below;

 

I have a requirement that i need to store files/attachments into the Database table, these attachments are available inthe UNC Path (for instance here i have network shared folder). Im using "Get Files from Location" inline funciton to fetch the atachment details from the UNC path bind it into the my SmartObjcect File property to store it. Everything looks fine up until file gets stored in the DB table.  Now i need to bind the stored attachment on to the File attachment control on the smartForms where i need to display this attachment to the end user, where user can click and download the file for his/her reference. 

 

My Form deisgn to achive this:

after i store the file present in the Network shared folder in to the Database table in the process level, i get File ID value of the SmartObject, now on the form initialization rule, i have configured calling smartObject Load method by passing the FileID as input and at the output i map File property to to File attachment control. 

 

Now when i open the form, the file is loaded on to the file attachment control box. but here comes the miserable one, upon i click on the file attachment control box(file is present) form redirects me to different URL and stops and eventually you ended up neither file downloading nor opening.

 

Anybody have any hints or thoughts do let me know!

 

Cheers,

Prajwal


3 replies

Userlevel 5
Badge +18

1.  I believe you should also be able to execute this Load method in the Smartobject Service Tester tool; and it should prompt a dialog for downloading:


 


13616iEF79D723823E7A28.png


 


Is this the behavior in your case?


 


2.  Also what does the redirect look like?  Perhaps using fiddler and attaching some details if possible.

Userlevel 3
Badge +8

Dear ,

I have tried the scenario and it worked , let me give u the steps i used , if i got the scenario correct 

u need to save files/attachments into database , and retreive it inside an  attachment control 

try to test it urself to find wt wrong have u done in ur own scenario 

1- Create a smartbox , ID auto number and add Field for attachments , but u need to change its type into "File" like this

16617i7CA8BE2A96535FAE.png

 

4-Go to ur Item View and Add 1 rule to it , When the View executes initialize method , then

Execute a view method " Load " then , configure ur load method and give it the ID for ur attachment u just added on editable list .

16053iD829E0B212DDD6DB.png

 

 

Correct me if am wrong with ur scenario , hope this helps 

 

Best regards .

 

Badge +7

Ahmed,

 

I have an issue when i save file from K2 process using inline fucntion "Get File from Location" by passing the UNC Path for location and store the file into Database. i meant calling the inline function which gets File from UNC path directly on the File property of the SmartObject to store in the Database.  You are saving the attachment directly from the SmartForms level which is not my scenario here.

 

Apparently it turns out to be a product bug.

 

Root cause:

when you assign the inline function directly to the SmartObject File.Content property, the file isn't saved in the correct format in the database and due to this the file control on the SmartForm does not work.

 

To fix this issue, you can make use of the below work around;

 

Workaround steps:

 

  • I have attached the xml file, copy this file too your machine.
  • In the process, create an XML field
    1. Supply a name
    2. Click on XML Schema
    3. Browse and select the xml file saved in number 1
    4. Click OK
      The XML field will now have the same structure as the XML returned by the inline function.  
  • Add a Data Event before the event that executes the SmartObject
    1. Add a Transfer Data action
    2. Assign the inline function to the Source textbox
    3. Assign the entire XML file created in number 2 to the Destination textbox
  • On the SmartObject mappings, assign the xml field's content property to the file property's content property.

 

Cheers,

Prajwal Shambhu

 

 


15091iD8EA59EA48743C8E.png
15296i41861D7AFC861A4F.png

Reply