Base64 file attachment using service task

Hello,

Can we call the task engine fileattach service from a “ServiceTask” ?
Our scenarios is as follows,

  1. We have one bpm process to enable electronic gatepasses.
  2. One of the input field for the above process is base64 file content.
  3. We want to attach this file to “process instance scope” so that this attachment will be available to all users.

For the above scenario, can we introduce a “Service Task” step (just after the start step ) in our process so that it can invoke the task engine file attach service?

If it is possible, how can we find the task ID for that service task (TaskId is one of input field for attachment service)?

Thanks and Regards,
Anish