Solved

GetUsers method on users in Multiple Departments?

  • 27 September 2017
  • 3 replies
  • 1 view

Userlevel 3
Badge +16

Hi,

 

Say i have an Authorisers table (Smartobejct) with 5 Authorisers in it with a department

 

User 1 - Sales

User 2 - Finance

User 3 - PPI Insurance sellers

User 4 - Marketing

User 5 - Dispatch

 

I want to be able to say if a Requestor sends a request, the Authorisation will go to multiple Authorisers in different departments, based on a GroupID

 

I have a Department Lookup table, which i've added a GroupingID column, so that i can tie Sales and PPI with the number 1

 

1) So using K2,  i've created a form, added the fields and do an Initialize rule to get the AD attributes of the Locally logged in User (includes, name, userid, dept)

2) Then i added another rule: Smartobject get List method of my Lookup table to return the GroupID off the Requesters Department

3) Another Smartobject get list method on the Lookup with input as the GroupID, hoping to return all matches, but it's only returning the first Dept result... (output is a Data label on the form)

 

Any ideas how i return multiple results and then ?

 

1) A Requester (from Sales) submits a form.

2) Lookup the Requesters department in the Lookup table and find the Grouping ID (1 in this case)

3) Then do a reverse lookup on the Lookup table to find all Departments with the same Grouping ID (1 = Sales and PPI)

4) Send an Approval email to all members of an Authorisers group with a Department field which matches Sales or PPI

 

I know what i want to happen, but can this be done in K2 and passing variables, based on the GroupingID?

 

Thanks,

 

icon

Best answer by VJay 4 October 2017, 10:34

View original

3 replies

Userlevel 3
Badge +16

Hi,

 

Anyone able to advise?

 

I've tried to do this on a Destination Rule for a Client event but it results in the error "An activity with a client event should have at least one destination"

 

I created a Lookup table with 2 fields

 

DeptCode    Grouping ID

 

A                             1

B                             1

C                             2

 

Dest Rule options All at once

Destination set in AD User.Getusersbygroup - the groupname is an AD Group with 2 users in (for testing)

       Filter is Department = Lookup.table.Getlist method

       Input mapping is Groupingid (smartobject field from the lookup table) = Grouping_ID (passed in as variable, so 1 in this case)

       Return Property = Dept (should return both Dept A, Dept B based on Grouping ID = 1

       List option set to "Return all results"

Return Property is Name

List options is set to Return all results

 

This failed when run wih error "An activity with a client event should have at least one destination"

 

If i change the inner Getlist method to List Options set to "Return a Single item" it works, but only sends the approval to the first or last person you selected.

 

How do i get this to work and send to all Users based on the Grouping ID lookup to find all matching Departments, then send the Client Event to all users in that AD group with Department which matches the returned department codes????

 

Must be a way....

 

In theory i have it logically working, but K2 isn't playing ball.

 

Any ideas?

 

 

 

Badge +9

Hi Sharpharp1,

 

Check below link and see if this helps any thing in your requirement.

 

https://vijaydk2guy.wordpress.com/2017/10/04/handling-multiple-destination-users-dynamically-from-multiple-sources/

 

Regards,

VJay.

Userlevel 3
Badge +16

Massive thanks to Vijay for the help, all working now

Reply