Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Access Task details from Flex App. ??

_Nith_
Level 10
Level 10

I have created a custom flex form to render on the workspace.

I have configured and its working in the workspace properly.

Now i need to access the task details (for e.g the Assigned Id of the user) from the flex form using which I can display the logged in user name.

I saw a component named "TaskDetails" under Workspace category but i dono how to use that.

Can someone help me how to fetch the task details from flex?

Thanks,

Nith

13 Replies
vu_tuan_anh
Level 4
Level 4

Hi Nith,

I think you can write custom component to do that.

Please refer to LCES Java API:

http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/javadoc/index.html

And how to write a custom component:

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000934.html

Alternatively, you can refer to LCES Actionscript API:

http://livedocs.adobe.com/livecycle/8.2/programLC/common/langref/

For my current project, if you need to interact directly with Task, like save or submit, you should use LCES Action script API. If you want to retrieve additional information of task to display somewhere in your custom workspace then write separate Java component to retrieve task details and send it back to Flex via XML.

Hope it helps,

Regards,

Tuan Anh

Jasmin_Charbonn
Level 10
Level 10

Tuan is correct.

In the next version of LiveCycle, you'll have access to the task information right from the "connector" object. This should simplify the use case a lot.

Jasmin

The_Flex_Viking
Level 4
Level 4

But, from within the Flex form, how do you know the task ID given to the user assigned task?  Most methods require a task id parameter.

_Nith_
Level 10
Level 10

The flex form is not running as a stand-alone applications, rather it is running within workspace.

So there should be a way to catch the ASSIGNED_ID parameter from task info.

Nith

vu_tuan_anh
Level 4
Level 4

Hi Viking,

Whenever a task is created, it will be inserted in tb_task table.

From workflow, you can set the processId to the form.

In the form after initial data, you call a webservice query to table tb_task:

Select max (id) from tb_task where process_instance_id = <id>

Now you have the task id of current assigned task already.

Regards,

Anh

_Nith_
Level 10
Level 10

Hi Tuan,

Could you please elaborate the statement "From workflow, you can set the processId to the form"?

I need to do something within flex with the use of workflow.

Thanks,

Nith

vu_tuan_anh
Level 4
Level 4

Hi Nith,

Assume workflow is : A -> B -> Task User -> C -> D

Assume your XML data model in Flex form has type <data><processId/>...</data>

Your workflow should have attribute id already, which is process id.

In B you can use setValue component to set /xml//processId = /process_data@id

So when Task User is created, you should have had the processId in the form data already.

Let me know if you are not clear.

Regards,

Tuan Anh

_Nith_
Level 10
Level 10

Your explanation is clear. Thanks.

My workflow template is like this:

Flex(task manager endpoint) -> A-> B-> ....

In this case, my flex form is the initial form (i.e task manager end point of my workflow)

So I need to set the data model of flex from workflow now. Is this possible?

Thanks & Regards,

Nith

The_Flex_Viking
Level 4
Level 4

Right.  That's what I have done in the past.  Injected the process id into the XML passed into the Flex form as simply a "tracking" value.  Works great.  Of course, the process ID won't be known until the initial Flex form is submitted, which is OK.

I always worry about bypassing an API and retrieving data directly from the database though.  Schema changes can have potentially disasterous effects.

I like the idea of grabbing the MAX(ID).  That makes sense.

vu_tuan_anh
Level 4
Level 4

Hi Nith,

If your end point is Task Manager then you will have the task Id before process id.  Process id exists only after you complete the first task. I think i will get the process Id A and inject in the XML form.

What information that you need right from the task manager end point?

@Viking: I'm glad to see you like my idea 🙂

Regards,

Tuan Anh

GilbertYu
Level 3
Level 3

You should now be able to get this information from LiveCycle ES2 when you create a Flex application (Flex Form) using the SwfConnector class.

You can get task information and even information about the user that is logged in to Workspace. You can find an example form that gets the name of the task but you can also get information by handling the setWorkspaceData event.

Also available in LiveCycle ES2 is the ability to control the Workspace chrome (Workspace interface). For example, you can make tabs disappear, display the Flex form in full screen mode. Lots of goodness. Check it out at http://www.adobe.com/go/learn_lc_createflexapps_9.

_Nith_
Level 10
Level 10

The answer is much simple than expected:

// the following function returns the user id of the currently logged in user.

// all other properties can also fetched in the same way.

private function getUserId():String

{

var session:SessionMap = SessionMap(Application.application.session);

var sessionManager:ISessionManager = ISessionManager (session.getObject("lc.foundation.ISessionManager"));

return sessionManager.authenticatedUser.userid;

}

Thanks for all your opinions.

Nith

vu_tuan_anh
Level 4
Level 4

Hi,

In my project with LCES, there is a case when user claim & open the flex form directly. And the form must display the user name inside.

The flex form is not able to get the session of workspace so I need a separate webservice to get the userid.

By the way, in LCES 2, with pre process data (or sth similar) before mapping xml to form template, this problem is resolved.

Regards,

Anh