Question

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 0

Like

4 comments
Best reply

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&lt;Guid&gt;("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&lt;Guid&gt;("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

Oscar Dylan,

Thanks for the Input, It is working now

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

Show all comments