Getting error while assigning the value to Process parameter of type "FILE"
Hi Community,
I have created one Process parameter of type "FILE" as follows:
I am trying to assign the value in a script task. The script task contains the following code:
var recordId = Get<Guid>("FileID"); IFileFactory fileFactory = UserConnection.GetFileFactory(); var fileLocator = new EntityFileLocator("ContactFile", recordId); IFile file = fileFactory.Get(fileLocator); Set("FILE",file); return true;
After running the process I am getting the following error,
Request a help here to understand what am I doing wrong.
Thanks,
Sourav Kumar Samal
Like
Hi Sourav,
The problem here is that this parameter stores not the file itself, but the file locator. If you redesign the code as:
var recordId = Get<Guid>("FileID"); IFileFactory fileFactory = UserConnection.GetFileFactory(); var fileLocator = new EntityFileLocator("ContactFile", recordId); Set("FILE", fileLocator ); return true;
the process will be executed properly.
Best regards,
Oscar
Hi Sourav,
The problem here is that this parameter stores not the file itself, but the file locator. If you redesign the code as:
var recordId = Get<Guid>("FileID"); IFileFactory fileFactory = UserConnection.GetFileFactory(); var fileLocator = new EntityFileLocator("ContactFile", recordId); Set("FILE", fileLocator ); return true;
the process will be executed properly.
Best regards,
Oscar
Sourav Kumar Samal,
How did you add the Using for IFileFactory and GetFileFactory?
Regards,
Solem.
Solem Khan Abdusalam,
You can add the using under "Methods" tab of process settings as follows,
Thanks,
Sourav