When people fill out a support or issue tracking ticket in a SharePoint list or form, they seldom know the name of the person who will take care of their request. What they know, on the other hand, is what kind of problem they have, and from that info we can let a flow assign the responsible for each ticket.
In the demos below Peter Kalmström, CEO and Systems Designer of kalmstrom.com Business Solutions, shows how to first create the two SharePoint lists we are going to use and then create the actual flow that sets the assignee.
"Ticket Category" site column
Peter creates a site column called "Ticket Category" with the options "Hardware", "Software" and "Users". There is no default value.
At first Peter uses CamelCase naming for this site column, to have a good URL and make it work better in the flow. When the column has been created, he adds a space in the name, but the internal name is still without the space.
The first list, where users enter new items directly or via a custom form, is built on the tasks template. Peter calls the list "Tickets", and he adds the site column "Ticket Category" to it.
As this list will be used in a flow, multiple selections in the 'Assigned To' field cannot be allowed. The 'Assigned To' column description has information that the assignee is set by a flow.
Ticket Rules List
The second list is a custom app called "Ticket Rules", and Peter adds the site column "Ticket Category" here also. He also adds a Person or Group list column, "Default Assignee" and renames the "Title" column into "Comment".
Create a blank flow and use the trigger 'SharePoint - when an item is created' for the "Tickets" list.
Add the action 'SharePoint - get items' for the "Ticket Rules" list. (Only one item will be fetched, but if we use 'get item' we need to know the item ID.)
At 'Filter Query' under advanced options, enter the internal name "TicketCategory" + eq + a string with the dynamic content 'Ticket Category Value'.
Add an 'apply to each' action and set the output value to the dynamic content 'value'.
Add the action 'SharePoint - Update item' for the Tickets list.
At 'Id', add the dynamic content 'ID' from under 'When an item is created'.
At 'Task Name', add the dynamic content 'Task Name'.
Remove any default values. Otherwise the flow will fail if someone sets another value in the item.
At 'Assigned To Claims', add the dynamic content 'Default Assignee Claims' from the 'get items' action as a custom value.