Skip to main content

Not sure if that is the correct way to phrase this question, so let me explain what I'm trying to do...BTW, I'm using ASP.NET for all of my front end interface.


In my process I want to allow an approver to select a radio button "Rework needed" which will send the process back to the originator to make changes to their form.  All parts of this work fine except when it comes to the originator uploading documents.


If they originally did not upload any documents, the process works fine when it's redirected to them and allows them to upload documents.  The process also works fine if it's redirected to the originator and they do not try to upload any documents on this pass.  The only problem comes when they uploaded a document(s) initially, then it's redirected back to them, and then they try to upload documents again.


In my K2 process, I use a binary field to hold the uploaded document, then use a Sharepoint Document event to upload it to Sharepoint, then set the field equal to Nothing to clear it out and not bloat the process with this information.


When I try to debug my ASP code through Visual Studio, everything goes fine until I hit the procInst.Update() line.  The error given is "4129 A database error occured : Data is Null. This method or property cannot be called on Null values.


Can anyone help?


 

Just a thought, when you clean out the binary field in the process, instead setting it to Nothing (NULL) set it to an empty string (String.Empty or "").

Let us know if that changes anything.


Thanks Bob...already tried that  😞

OK, I figured out a solution this morning! 


 I knew it was the binary field and the way I was trying to clear it using either NULL or ""...I created an extra field in my process called "deleteAttachmentField" (or whatever you want) and then instead of re-setting binary fields to "" or NULL, I set it equal to K2.ProcessInstance.DataFields.Item("deleteAttachmentField").Value which is always an empty binary.


 Worked perfectly.


Glad to hear you're sorted.  Thanks for posting the solution.

Did you try to set it to Nothing?

K2.ProcessInstance.DataFields.Item("AttachmentField").Value = Nothing

Also I thought the best practices document cautioned storing binary
attachments in the Datafield...  are you not running into performance
issues?

What are the sizes of the attachments you are storing?


I tried setting it to nothing and it did not work - it would not let me reuse that field again to upload another file the next pass through on the process.


 I do not store the attachments in datafield permanently.  The datafield is used as a temporary store only to get the file from my ASP.NET forms into K2 to make use of the Sharepoint document upload events, and then the fields are cleared out.  I was previously setting the datafield = "", which was fine for the process when it was a one-way process only.  When I needed the process to route back and reuse a piece of itself to allow for editing and uploading documents again, that binary datafield was now set to an empty string and could not accept binary data.


 The only solution that worked (and has been working perfectly for me in all processes since) is to have one extra binary datafield that I set other binary fields equal to in order to clear them after upload.


Reply