We have a workflow where users may request access to various programs external to Activiti. The request must then be approved by that individual's manager, who is specified in the request using the "People" form item.
A manager should be able to request special permissions on behalf of someone else, and then not have to approve this request.
How do I compare the User selected in the "People" form item to the user produced by userInfoBean.getCurrentUser()?
This is my Java Code:
//Establish request_originator
var currentUser = userInfoBean.getCurrentUser()
execution.setVariable('request_originator', currentUser);//Compare to selected manager
var originatorIsManager = 'foobar'
if(currentUser.equals(execution.getVariable('manager_of_requested_for'))){
originatorIsManager = 'yes';
} else {
originatorIsManager = 'no';
}execution.setVariable('originator_is_manager', originatorIsManager);
See the attached image, where I display the values being returned by my Variable and the Form Field. They are identical, but my comparison is still being returned as "no."
Thank you.
Solved! Go to Solution.
Since you are comparing execution.getVariable('manager_of_requested_for') which will be the "ID" of manager_of_requested_for, you need to get currentUser's ID for the comparison. Set currentUser as below
var currentUser = userInfoBean.getCurrentUser().getId()
Since you are comparing execution.getVariable('manager_of_requested_for') which will be the "ID" of manager_of_requested_for, you need to get currentUser's ID for the comparison. Set currentUser as below
var currentUser = userInfoBean.getCurrentUser().getId()
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.