Using the Workflow Web Service, anyone know how to put multiple values into an InstanceParameterData object and have it populate a multivalue input parameter correctly? I tried throwing a string[] into the value since it's an object, but I got a serialization error. I also tried passing multiple values in a string, guessing what the delimiting character might be. I tried a comma, semicolon, and pipe. I'm ultimately trying to find a way to avoid having to parse the string on the workflow server to get all the values.
Question
Question
Multivalue Parameter with Workflow Web Service
asked on February 28, 2015
0
0
Replies
replied on March 1, 2015
I figured out a work-around, but if you have a better suggestion, let me know.
1. Passed the string delimited with a semi-colon.
2. Parsed that input parameter, and put a object[] into another token.
3. Used an Assign Field Values activity, and assigned the field to the new token - and it populated the multi-valued field correctly.
0
0
replied on March 2, 2015
Hi Rich. Which version of Workflow are you using? This code seems to work for me in 9.2:
class Program
{
static void Main(string[] args)
{
using (WorkflowAPIBaseClient WorkflowService = new WorkflowAPIBaseClient())
{
InstanceCreationData creationData = new InstanceCreationData();
creationData.StartingEntry = new InstanceEntryData();
creationData.Initiator = new InstanceUserData();
//Specify the parameters you want to pass to Workflow
InstanceParameterData parameter1 = new InstanceParameterData();
parameter1.Name = "My MV param";
parameter1.Value = new string[] { "val 1", "val 2", "val 3" };
InstanceParameterData parameter2 = new InstanceParameterData();
parameter2.Name = "My SV param";
parameter2.Value = "val a";
creationData.ParameterCollection = new InstanceParameterCollection();
creationData.ParameterCollection.Add(parameter1);
creationData.ParameterCollection.Add(parameter2);
InstanceCreationResultData results = WorkflowService.CreateWorkflowInstance("Workflow 1", creationData);
}
}
}
Make sure that your input parameter is marked as Multi-value:
0
0
You are not allowed to follow up in this post.