20 Replies · Latest reply on May 22, 2017 6:01 AM by Christopher Johnson

    Script to filter out members of fulfillment group

      I'm trying to assign a task to a certain members of a  fulfillment group. How do I just assign my task to certain members of a "X" fulfillment group?

      For example, I have a fulfillment group called SUPPORT_SN, this team has 4 members : member1, member2, member3, and member 4.

      I only want to send the task to 2 members of the group.

      I am thinking in adding a script in my workflow.

      task.fulfillment_group  =  ???/

       

      Any ideas?

        • Re: Script to filter out members of fulfillment group
          Sachin Namjoshi

          The obvious answer would be "that's what Assignment Groups are for"...

           

          One way you could do this would be to add a new list-type field to your table that references the User table, name it something like "Assignment List" or "Assigned Individuals" to make it clear this is neither the Assigned_to or Assignment_group field.  This would allow you to add a list of users picked one-by-one.

           

          This would behave similar to the Watch List for comments that already exists on tasks.  It will take adding some structure on your part to include this field in notifications, your processes, etc.  But it's very possible.

           

          Regards,

          Sachin

          Please mark answer as Correct, helpful as appropriate.

          • Re: Script to filter out members of fulfillment group
            Madhusudana Golla

            Hello, who will fill the selected members from the group at task level? will you pass this information from catalog item ?

            • Re: Script to filter out members of fulfillment group
              Christopher Johnson

              Reading through this, it is unclear what the ask is.

               

              Are you wanting to assign a task to a given individual from a group?

              Are you wanting to assign a task to multiple individuals from a group?

              What application are you using? (Catalog Request, Change Request, something else?)

              What table is your workflow running on?

               

              If we can better understand your current environment and what the complete ask is we may be able to focus on the appropriate solution.

                • Re: Script to filter out members of fulfillment group
                  Claudia Cruz

                  Are you wanting to assign a task to a given individual from a group?

                  Are you wanting to assign a task to multiple individuals from a group? I want to assign a task to multiple individual within a group

                  What application are you using? (Catalog Request, Change Request, something else?) Catalog Request

                  What table is your workflow running on? I think it is sc_task. Not sure.

                   

                  If we can better understand your current environment and what the complete ask is we may be able to focus on the appropriate solution.

                   

                  Capture23.PNG

                    • Re: Script to filter out members of fulfillment group
                      Christopher Johnson

                      There is a field on the sc_task table called: additional_assignee_list

                       

                      This field can accept multiple users. However, it is typically not used for things like notifications and assignments. Depending upon if you want to assign one user to the Assigned to and the remainder to that field you can do so.

                       

                      My next question is how do we know who are the people who should be assigned from that group.

                      -  Is there some identifier that indicates that this user is to be used rather than the others.

                      -  Is this a custom workflow that is only used with one Request and is not used with anything else?

                        • Re: Script to filter out members of fulfillment group
                          Claudia Cruz

                          Where can i locate the field on the sc_table. I do not think it is activate it.

                           

                          Well, that's why I only need to assign 3 specific users to the catalog task. I was thinking maybe adding their sys_id so that way we know which users.

                          This workflow is only used with one request.

                            • Re: Script to filter out members of fulfillment group
                              Christopher Johnson

                              The field itself has a label called "Additional assignee list". You should be able to add it to your form through Configure > Form Layout on that table. I would suggest adding it below the Assigned to field.

                               

                              You have the right idea to use the sys_id. Since that field is a list field, using a comma delimited list of those users sys_id is what we want. I would suggest creating a system property to store the desired sys_id string so that you do not have to check out the workflow when your users change. I will leave it up to you as to what to call it. I would probably suggest using a naming convention that is easily understood as to what it stores. For example, let us say your company is called Acme and the catalog item this goes with is for Printers. For our example I will use acme.printer.request as the name of the System Property. Let me know if you need help creating the system property. I will store three sys_id in the field in that system property. For our example I will use 3 sys_id from sample users (Abel Tuter, Fred Luddy, and Joe Employee):

                               

                              62826bf03710200044e0bfc8bcbe5df1,5137153cc611227c000bbd1bd8cd2005,681ccaf9c0a8016400b98a06818d57c7

                               

                              Do not have spaces in between as this will cause the assignment to not work correctly. Here is the script that you would use to populate the field on the task.

                               

                              createTask();
                              
                              function createTask() {
                                  var assigneeList = gs.getProperty(acme.printer.request);
                                  task.additional_assignee_list = assigneeList.toString();
                              }
                              

                               

                              Let me know if this is helpful.

                      • Re: Script to filter out members of fulfillment group
                        Andrew Pilachowski

                        From a developer standpoint, I would like to extend the comments of the first response.

                         

                        Hard coding is bad....

                         

                        Seriously, hard coding is really bad from an administrative standpoint.  Consider this...

                        Script hard coded with user sys_id on dev

                        Are user sys_id same on test and prod?

                        Push update set to test, do you have to change user sys_id in script before testing? etc, on to prod

                         

                        Management requests a change, so you have to...

                        Update script on dev, test changes

                        Push update set to test, test changes

                        Push update set to prod, test changes

                        ...Every single time

                         

                        Consider some alternatives:

                        1. Create a group that fulfills your business need, once created and the script is tested, that's it no matter who you add or remove from the group on prod its going to work

                        2. Create a custom boolean field on one of the available tables to flag the users you want to notify, again once created and the script is tested, that's it no matter who is enabled or disabled on that custom field on prod its going to work

                        3. Create some other relationship/slush bucket and same idea

                         

                        Data administration is a whole lot easier in the long run than script administration.  Not saying you cannot create a script where you insert the sys_ids of 2 users, but as your requirements change, you will have to keep pushing changes which creates a whole lot of overhead.  What happens if one of the users gets replaced, or if they later want 3 users?