Table of contents


Official Content

Below is a description of how you can get a list of Workitmes from a user using the Workflow API.

Define and execute the following code in a Web Panel object that contains a grid:

workitemsgrid_png

Event Start
    &WorkflowServer.Connect(&UserName, &UserPassword)
Endevent

Event Grid.Refresh
    &WorkflowUser = &WorkflowServer.ConnectedUser
    &WorkflowWorkitems=&WorkflowUser.GetWorklistOrderBy(&WorkflowFilter, WorkflowOrder.CREATED_ASC)
EndEvent

Event Grid.Load
    For &WorkflowWorkitem in &WorkflowWorkitems
        &WorkflowWorkitemId = &WorkflowWorkitem.Id
        &WorkflowActivityName = &WorkflowWorkitem.Activity.Name
        &WorkflowWorkitemState = Lower(&WorkflowWorkitem.State.Substring(&WorkflowWorkitem.State.LastIndexOf(!".")+1, 10))
        Do Case
            Case &WorkflowWorkitemState = !'ready'
                &WorkflowWorkitemState = 'Ready'
                &WorkflowWorkitemState.Class = styleclass:badge-success
            Case &WorkflowWorkitemState = !'in_process'
                &WorkflowWorkitemState = 'Working'
                &WorkflowWorkitemState.Class = styleclass:badge-warning
            Case &WorkflowWorkitemState = !'assigned'
                &WorkflowWorkitemState = 'Assigned'
                &WorkflowWorkitemState.Class = styleclass:badge-info
        Endcase    
        &WorkflowSubject = &WorkflowWorkitem.ProcessInstance.Subject
        &Created = &WorkflowWorkitem.Created
        Grid.Load()
    Endfor
EndEvent

Where the data types variables are the following:

&WorkflowServer – WorkflowServer
&WorkflowOrganizationalModel – WorkflowOrganizationalModel
&WorkflowUser – WorkflowUser
&WorkflowWorkitem – WorkflowWorkitem
&WorkflowWorkitems – WorkflowWorkitem (collection)
&WorkflowFilter – WorkflowFilter
&WorkflowWorkitemId – WorkflowWorkitemId
&WorkflowActivityName – WorkflowActivityName
&WorkflowWorkitemState – Character(20)
&WorkflowSubject – WorkflowSubject
&Created – DateTime
&UserName – Character(100)
&UserPassword – Character(30)

For further information about the Workflow API, go to API.

Last update: November 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant