How to assign Process ID and user name to script task fields in camunda

963 views
Skip to first unread message

alan fernandez

unread,
Jun 16, 2014, 4:29:27 AM6/16/14
to camunda-...@googlegroups.com
Hi guys,

I am attempting to write a script task where I need to process ID and User name (Eg:John) to be automatically assigned to field names (Eg: John  must be assigned to field name:Loan_Identifier,
Process ID must be assigned to field name: Application_Identifier). Could anyone please advise me on what queries I must input to execute this?
I am working on Eclipse Kepler using Camunda Modeler plugin.

Kind regards,
Allan Fernandez

alan fernandez

unread,
Jun 16, 2014, 4:39:03 AM6/16/14
to camunda-...@googlegroups.com
I am running a groovy svript for the above tasks

webcyberrob

unread,
Jun 16, 2014, 5:24:12 AM6/16/14
to camunda-...@googlegroups.com
Hi Alan,

In your scrip task, you can use a 'special' variable called execution which gives you access to the engine API. Hence you could call execution.getVariable("name") to get the value of a process variable or execution.setVariable(name, value) to set a process variable. From the execution object you should be able to lookup the process instance id etc.

Im a bit puzzled what you meant by fields as I would normally associate fields with a form associated with a user task. hence do you mean you want to set process variables in a script task prior to displaying in a user task?

regards

Rob

alan fernandez

unread,
Jun 16, 2014, 8:06:06 AM6/16/14
to camunda-...@googlegroups.com
Hi Rob,

Sorry about the confusion, I meant process variables in a script task. What I want is am running a script task before a user task. As part of the requirements the script task must automatically fetch the process id and the user name who has logged into Camunda Tasklist.

Thanks&Regards,
Allan Fernandez

-Deeds count, not just words


--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/TsBO37Dbpz0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/70f3375f-4e47-4d33-955c-a2afda1ccb63%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

webcyberrob

unread,
Jun 16, 2014, 6:14:19 PM6/16/14
to camunda-...@googlegroups.com
Hi Allan,

with regard to your user task, you may want to refer to the links below;

Task lifecycle detail


Example using a task listener to extract user details...

regards

Rob
Reply all
Reply to author
Forward
0 new messages