Thanks Mauricio for your reply, I followed the blog and added those onEntry and onExit entries in the bpmn xml. I was trying to retrieve the taskID from the workItemID using the following codes.
long workItemId = ((org.jbpm.workflow.instance.node.WorkItemNodeInstance)kcontext.getNodeInstance()).getWorkItem());
JBPMUtil.getTaskByWorkItemID(workItemId).getId();
I am able to retrieve the workItemId only on the onExit actionscript and not in the onEntry script. From the logger, i understand that the Task is created only after the onEntry script runs. I am still worried how i can send an email with the link pointing to the TaskID. Is there any alternative way of accomplishing this?