Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Add Workflow Item to Workflow List

  • Last UpdatedJun 10, 2024
  • 1 minute read

The list internally uses Form engine infrastructure. During list creation, the list columns are defined as form fields. When adding an item, values have to be set for these fields. The following code example demonstrates how to add a new work flow item to workflow list.

PROCEDURE

Dll REFERENCE

Workflow.NET.NET2

Skelta.forms.core

NAMESPACE USED

Workflow.NET

Skelta.forms.core

Try the following code in a console application by adding the above references and name spaces:

//Creating ListDefinition for specified Repository and List

//Here Repository="Repo1" and ListName="Workflow"

ListDefinition _listDef = ListDefinition.GetList(new Skelta.Core.ApplicationObject(_applicationName), _listName);


//Here specify your repository name and retain the second parameter "Workflow"  

//Creating a new listItem for the given list definition.

Skelta.Repository.List.ListItem newListItem = new Skelta.Repository.List.ListItem(listdef);

 

//Assigning the Title and Description value for the list item. ((ListTextDataItem)newListItem.ListForm.Records[0].FindControlByID("_sys_wf_title")).Value = "Workflow Name";


((ListTextDataItem)newListItem.ListForm.Records[0].FindControlByID("_sys_wf_desc")).Value = "Description text";


//Accessing the ListTableForm in the Workflow list definition

ListTableForm listTableForm = ((ListTableForm)newListItem.ListForm.Records[0].FindControlByID("_sys_wfdef_form"));


//Setting the version value

((ListTextDataItem)listTableForm.Records[0].FindControlByID("_sys_wfdef_filename")).Value = "1";


//For Workflow item, the Itemtype should be 1

newListItem.ItemType = 1;


//Accessing User context object created while logging in to Enterprise Console site

UserContext UserCtx = new UserContext();


newListItem.LoggedInUserId = UserCtx.LoggedInUserId;


// Note:User context will be available only when the user logins in the  enterprise console.Otherwise // the LoggedInUserID has to be set manually

//Example: newListItem.LoggedInUserId = "activedirectory::John"


//For saving the item under a folder or workflow set the following property

//[ newListItem.ParentItemId = Guid of the Parent workflow folder/item ]


//Saving the list item

newListItem.Save();

Note: To create a workflow the itemtype should be 1 and to create a folder the itemtype should be 0.

Related Links
TitleResults for “How to create a CRG?”Also Available in