workflow not updating form

  • 25 June 2018
  • 3 replies
  • 10 views

Hello,

I have created a workflow that converts a string into a base64 string.

it goes from a text field in a form ---> data field in workflow --> conversion --> base64 string in another datafield

when i execute the workflow it's supposed to send the resulting base64 to a text box in the form, but it does not. I know the conversion works because I added an email event to myself and it emails the base64 string, I just can't get it to send it to the form after its executed.


3 replies

Badge +9

It's timing. When you start a workflow, it will only wait for the workflow to finish initializing and it returns things like the process instance ID or whatever is found under the "Workflow" tree when you're configuring the output mappings. Your data conversion is done in the next activity after the workflow has started, which means the conversion has not taken place yet when you're trying to retrieve it.

Thank you for that explanation.

But in such situation, is there any way to retrieve the result of the workflow? Someone said in a post to check the status of Process Instance through the workflow ID and if it said Complete to query for result, however that object does not have a results method, or any other method than list. Is there any way to retrieve the results of a workflow?

Badge +9

Hi davidedpg10,

 

You can write a small piece of code to convert string input to bytes and then to base64 format inside start rule of start activity.

 

 

string dfInfo = _k2.ProcessInstance.DataFields["Info"].Value.ToString();  
//Info is datafield name containg data to convert to base64.
byte[] bytes = Encoding.UTF8.GetBytes(dfInfo);

string base64 = Convert.ToBase64String(bytes);

_k2.ProcessInstance.DataFields["EncodedString"].Value = base64;
//EncodedString is datafield name which will store the converted result.

 

This will return the result in datafield (for example in my case EncodedString) when workflow started.

 

Or you can also use smartforms inline functions to convert the string to base 64 format, return string data to form and then convert it to base64 .

Reply