Recently Varsha(another BPM Product Manager) approached me with a requirement where she wanted to reuse same Web Form for different task activity.We both knew this is easily achievable.The human task outcomes can differ to distinguish the submission based on roles.Her requirement was slightly more than this, she wanted to hide some data based on the logged in user. If you have worked on Web Form rules, dynamically showing and hiding data is common requirement and easily achievable using Form Rules. In this case the challenge was accessing BPM role inside the Web Form. Although, will be addressing this requirement in future release she wanted a immediate solution(Aha, after all customers are not the only one's who can not wait). Thankfully we managed to come-up with a solution and I hope this will be helpful to larger audience.
Solution has 3 steps :
Step 1: We added a hidden attribute in our form (Role). The purpose of this attribute is just to store the current logged in user's role and we pass the value during data association.
Step 2 : In your data association step, pass the role value based on the Swimlane
Step 3 : Now use this hidden attribute value in your Web Form rule for dynamic behavior
Detailed steps and sample can be downloaded from Java.net.