Query Current Step Number for Approval process
I don't think that there is field that will tell you exact step number. But if we extend the approach provided by Santanu Boral then we can get calculate the step number.
Data model info:
ProcessInstance : This table store the data about which record is undergoing which (approval)process.
ProcessInstanceStep : This table store the information about the all steps which user took on particulate Approved, Rejected etc
Here is the algorithm that i am proposing:
1) Find if any approval process is "Pending" for your record.
SELECT CompletedDate, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes, Id, ProcessDefinitionId, Status, SubmittedById, TargetObjectId FROM ProcessInstance WHERE TargetObjectId = '0069000000kSaNE' And Status ='Pending'
2) Then grab the ProcessInstance->ID and use it in following query
SELECT ActorId,Comments,CreatedById,CreatedDate, ElapsedTimeInDays, ElapsedTimeInHours, ElapsedTimeInMinutes,Id, OriginalActorId, ProcessInstanceId, StepNodeId,StepStatus, SystemModstamp FROM ProcessInstanceStep where ProcessInstanceId='04g90000009uPK0AAM'
This will give all the steps performed for that target object.
Now you can count the number of 'approved' records in above query and get the current step number.
PS: If you may need to do addition/subtraction if there are recjection record to get the current step number
The another way could be just add the step number in your Step name so that you can extract that directly from ProcessInstance
So, for ex. if your steps are named as :
PM approval
DM approval
VP Approval
Then it can be renamed to :
PM approval (Step 1)
DM approval (Step 2)
VP Approval (Step 3)
Now you can just grab the name parse the last part in bracket and find out the step number without doing any calculations.