0

I have a SharePoint list that captures employee details and the error types they have committed. In the same list, I would like a column to auto-capture the number of instances of each error type when we select from the error type column.

Example:

Emp ID: 123 error type : err1 Instance :1

Emp ID :234 error type : err1 Instance 1

Emp ID: 123 error type : err1 Instance :2

Emp ID :234 error type : err2 Instance 1

How could I achieve this using flow / power automate?

3
  • I don't understand how you would want that would work -- if EmpID:234 has two entries for err2, would both entries display that the Instance Count is 2? If not, what logic would you use to determine which one is "1" and which one is "2"? Wouldn't it be better to just have a grouped view that groups by EmpID, then secondarily groups by ErrorType, since that will automatically show you subtotals? – willman Mar 13 '20 at 14:18
  • currently we identify based on which item is added first. when first item gets added it should take as instance 1, then next time when the same employee repeats the same error, it should increment value by 1 from the previous instance – user89383 Mar 13 '20 at 14:22
  • Its important for us to know the instance, as we then have points given to each instance and then we sum them up to decide on an employee's performance rating – user89383 Mar 13 '20 at 14:25
0

-- NOTE: First be sure to determine the Internal Names of your fields, that is what you need to use in the filter parameter in Flow (e.g. if the display name is "Emp ID", then the internal name is likely either "EmpID" or something like "Emp_0x020_ID") -- for the purposes of the below steps, I will assume the internal names are "EmpID" and "ErrorType".

  • Create a Flow that is triggered only on Item Create.
  • Use a Get Items action, and use the 'Advanced Options' to set a Filter Query option on that action to filter where EmpID eq [InsertTriggeredEmpIDFromDynamicValues] and ErrorType eq [InsertTriggeredErrorTypeFromDynamicValues] (note that Filter Query follows the syntax rules of the REST ODATA filter)
  • Finally use an Update Item action, using the ID of the triggered item from Dynamic Values to choose which item
  • Set the Instance value to a Dynamic Expression length(body('Get_Items')?['value']) (adjust Get_Items if the name of your Get Items action is different).

Another --NOTE: Power Automate Flows do not always run immediately, it may take 5-10 minutes before your Flow executes after the item is created.

4
  • Thanks Willman. there is challenge. when i add first entry i correctly says Instane - 1, when I add second entry . the instance for both entries is changing to 2 - how to correct this – user89383 Mar 26 '20 at 11:14
  • Its looking like this now : Emp ID :123 error type : err1 Instance 2 Emp ID: 123 error type : err1 Instance :2 Emp ID :234 error type : err2 Instance 1 – user89383 Mar 26 '20 at 11:16
  • Make sure you have not accidentally added a apply to each action. The update item should not be nested in any kind of loop action. Make sure the ID parameter ofupdate action is using the ID from Trigger, not ID from get items. – willman Mar 26 '20 at 11:43
  • it worked well. cant thank you enough Willman ❤🙌 – user89383 Mar 30 '20 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.