cancel
Showing results for 
Search instead for 
Did you mean: 

Unity Script + Workflow + Assigned User

Ryan_Evoniuk
Champ in-the-making
Champ in-the-making

Hello,

Does anyone have an example (preferably C#) of a Unity script initiated from the Workflow action "SYS - Run Unity Script" that access the assigned user (the user that the document is assigned to in a load balanced WF queue) and writes the value to a keyword? I can't seem to find the property that holds the assigned user value in the SDK.

Case:  I'm using an Ad-Hoc User Task to assign a document to another individual in a load balanced queue. Unfortunately the built-in action "Key - Set Keyword to User Name" passes the name of the person running the task list and not the assigned user. I want to use a Unity script to write the assigned user's name to a keyword after the "SYS - Assign to User" action is completed (within the same Task List) for notification purposes. I would think the assigned user property value is accessible somewhere through the Unity API? Hope that makes sense.

Thanks in advance.

6 REPLIES 6

Not applicable

Hello Ryan

First you can create the action that execute the "SYS - Run Unity Script" action and then you can executed using the following code. You need to iterate first the document list like  "foreach (Hyland.Unity.Document document in docList)" 

Hyland.Unity.Workflow.Queue queue = lifeCycle.Queues.Find("Queue Name");

TaskListList adHocTaskList = queue.GetAdHocUserTasks();

TaskList adHocTask = adHocTaskList.Find("Adhoc name");

adHocTask.Execute(queue, docListIdea);

Not applicable

hum sorry i think that you need the property bags

Ryan_Evoniuk
Champ in-the-making
Champ in-the-making

Hi Jayson,

I already have the current document object available via Hyland.Unity.WorkflowEventArgs.Document when using the IWorkflowScript interface so I don't think I need to do any search logic for the document? I just need to know where the assigned user property value (created by the "SYS - Assign to User" workflow action) is via the Unity API so I can use the KeywordModifer class to write the value to a keyword. Unless of course the property isn't attached to the document itself and is attached at the queue level somehow.

 

 

 

Scott_McLean
Elite Collaborator
Elite Collaborator

Hi Ryan,

I don't think the document's assigned load-balancing user is available from the API. However, there's an easy way to populate a keyword with the assigned user without using a Unity script. When you're configuring load-balancing for the queue, you have the option (when setting the load-balancing users) to configure a keyword that will receive the assigned user.

In the image below, note the item labeled "Keyword to Hold Assignee." If you set this to the keyword you want to populate, it should be handled without using a script.

Kind regards,

-Scott