+ Start a Discussion
Deepak PansariDeepak Pansari 

How do i get Step Number or Step name from a approval process via apex code?

Hi,

 

Does any one know how do i get Step Number or Step name from a approval process via apex code?

 

Regards,

Deepak

Shashikant SharmaShashikant Sharma

i think You want to get any record in approval is in which step of approval process. There is no direct way for this, but I can suggest you this

 

1)Create a Number field ApprovalStepNo 

2)Add field update in your approval process steps to update it. 

3)In the final approval action set it to 0 again

This way you can achieve it.

Similarly you can track the StepName also.

 

Let me know if any issue in it.

Deepak PansariDeepak Pansari

Hi Shashikant,

 

I have created dynamic approval proess, means out of 12 steps , 6 are called on the basis of a filed value , and this 6 are very frst stpes , and they will call any of 0ne for any record and remaining 6 are nornal step -by step.

 

So for this Q my problem is same , I can not put filed update for first 6 , as i dont knwo which one is get executed.

 

-Deepak

Shashikant SharmaShashikant Sharma

My suggestion is you put field update in all 12 . First six as well in last 6. And provide step number appropriately. If any of first six means Step1 in that case you can use one field update in all of first six. So whichever step will be picked will use that field update set step no as 1.

 

Please le me know if it works for you or not. If I will get time surely I will try out in my org.