Check if File Attachment is empty before saving

  • 15 February 2022
  • 0 replies
  • 229 views

Badge +5

Topic

When a file is in the middle of being uploaded to a File Attachment control and a user clicks on Save/Create before the upload completes, this can result to the file being saved as NULL or SCNULL.

 

While you can add a condition and/or a validation on the File Attachment control to check if it is empty before saving it to your SmartObject, as long as you have chosen a file to upload, it will meet this condition even though the file has not finished uploading:

19307i71E89043011C0E4A.png 

Instructions

 As a workaround, you may add a Text Area control that will hold the xml value of the file uploaded. Here is an example:

 

<collection><object><fields><field name='FileName'><value>sample_image.jpg</value></field><field name='FilePath'><value>695BBDF3FFC1C64EAA297EC825856AA9sample_image.jpg</value></field><field name='FileRequestData'><value></value></field><field name='FileDataURL'><value></value></field></fields></object></collection>

 

This will be the xml value of the File Attachment control when the file is uploaded. You can then transfer this value to the Text Area control when the File Attachment control is changed:

19308iCA3B9E2FD7C5FC4D.png19309iC65FBFE27E4FC3DC.png

 

 Before you call your SmartObject to save this file, please add an advanced condition to ensure that both the File Attachment and Text Area controls are not empty:

19310i412A01BBDCEAF41D.png

 

 

 

Additional Information

This workaround may not be necessary on K2 Five 5.4 and 5.5 as a simple validation on the File Attachment control should suffice.

 

Related Links


0 replies

Be the first to reply!

Reply