Skip to main content


 

Symptoms


Passing file to workflow be uploaded to a sharepoint Document Library with its own unique prefix.
 

Diagnoses


Scenario:

When you have a file input on a view. It can work in two ways.

Select a file from a dropdown which then reads the file from a SharePoint Document Library. This file is then loaded in the file input view.

Upload a file from local

Once you have selected a file you then kick off a workflow to create the file in a new Sharepoint Library. The file gets a prefix and then gets created.

This has been done for the dropdown itself by getting the file temp location and then doing the rest of the stuff. The file selected from the drop down will go to temp folder: program files...../GUID/Filename.docx. When this is the case it does not seem to function.

Once the file has been Uploaded a file the temp file gets renamed to GUID.docx which means the file location cannot be found.

Is it possible to get the file from the view to the Workflow and then saving it inside a document library with a prefix_DocName.docx
 

Resolution

A solution has been created that makes it possible to load a file into a sharepoint document library with its own unique prefix. You can see how this can be done below:

Step 1:Firstly create a sharepoint document library with one document already in it, as this is where the documents would be uploaded to.

Step 2: From there you can create a smart box smart object within smart forms that has a prefix, Filter ID and the file itself (which would be uploaded to sharepoint) The whole goal is once the button is clicked it will save the file with the prefix and then transfer after. So the prefix itself can be created within the smartform itself. The File would use the file attachment field and the transferred input property will be "Yes/No".

Step 3: Furthermore create a view whereby you have one button, file attachment control and a textbox as well. You can then set a rule for the button "When Button is clicked", then on select Smartobject , execute its Create method" Then upon the input properties pass in the text box as this will be where the prefix will derive from.

Step 4: In K2 studio create a process using a 'sharepoint document event' that uploads the document by passing through the smart box smart object content field (document record) itself.

Step 5: Once again navigate to smartforms and select another rule "Start a workflow" whereby you select the process that was created in the previous step which uploads the document to sharepoint. You then further add a data label and name it "Document ID". For input mappings of this you pass in the document ID field to the document label parameter as well. Within the process you can then pass this ID to the data field so that it is able to be saved correctly.

Final Step: After that you can upload a document via smartforms with its own name in the text box. Once you click submit, this then gets recorded within sharepoint itself with the doucment having its own unique prefix.




 
Be the first to reply!

Reply