I am trying to automate Workflow. Below code start the workflow and everything goes fine and I get current processinstanceid
ProcessInstanceData pid = _CoreServiceClient.StartWorkflow(publicationURI, instruction, _ReadOptions);
However the pid object is not found when the workflow completed and Read method gives exception
IdentifiableObjectData processInstanceObj = _CoreServiceClient.Read(pid.Id, _ReadOptions);
Is there anyway to get processhistoryinstance id of the processinstancedata (without any hardcoding in code/config file)?