How to get the current process id in a connector
From within a custom connector implementation you can get the process id through the Bonita engine ExecutionContext: getExecutionContext().getProcessDefinitionId();
If by process id you were referring to process instance id just call getExecutionContext().getProcessInstanceId();
If you simply want to get the current process instance id in a [Groovy] Script connector, there is a dropdown menu where you can access useful variables. "processInstanceId" is one of them.
Even if you're not specifically using the Script Connector, most of the other connectors will let you use the Groovy script editor and you can access the process variables through there. For example, if you wanted to use the the MySQL database query connector, you can use the script editor to create your query and you can reference your process' processInstanceId within the script.