Process requires manager's manager as destination user


Badge +8

I have a process with three events. The first event is the initial event that starts the process, the second event must be approved by the originator's manager (no problem there), the third event must be approved by the originator's manager's manager. How do I get this user to be the destination user of the third event?


7 replies

Badge +13

You have to take into consideration the user might not have a manager's manager.

------------------ something like this

     Dim oDSH As New SourceCode.K2Utilities.DSHelper()
    Dim oDEManager As System.DirectoryServices.DirectoryEntry

oDEManager = oDSH.GetManager(k2.ProcessInstance.Originator.FQN)

sManagerFQN = oDSH.GetNetBiosNameFromDNS(oDEManager.Properties("distinguishedName")(0).ToString) & oDEManager.Properties("samAccountName")(0).ToString 

 
oSecondLevelManager = oDSH.GetManager(sManagerFQN)


 

Badge +8

That is what I was looking for.


 Thank you

Badge +8
Just looking back at your code. Isn't K2Utilities  from 2003? Is this still used in BP?
Badge +13
That was for K2 .Net 2003, you'll have to find the equiv. for BP, or I think they promised backward compatiblity so that should work.  :)
Badge +9

The codeless way would be to create a SmartObject to pull the manager of a specified user name.  I think this article done by Joseph (http://k2underground.com/forums/post/18783.aspx) is somewhat similar except for the fact that you need to map the manager property of the user (instead of ManagedUsers) to your SmartObject field.  Once you have this SmartObject, you can use it in your destination rule to pull the next user from the originator's manager.  It's pretty easy to get this working in a couple of minutes.


 

Badge +8
Allrighty, I decided to go the codeless way. But I am having trouble passing the Account Name to the SmartObject. It appears that the Smart Object is just looking for the username with no Domain. I am trying to pass the SO the Originator's --> Manager as it's input. The problem is that it is in the format K2:<my domain>pamanager. Is there a way to get just the username or have the SO accept the name in this format?
Badge +9

Arr yes, that is a current limitation.


This can probably be easily fixed by stripping out the user name using a few lines in server event or populated as a data field from the submission page depending on which way is easier.  I would think that taking the Web Page Identity and putting it into the Process data field would be the easiest way of doing it.


 I'll log an enhancement request to improve the AD service broker to take in different user name formats.

Reply