cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cfoenki
Helper I
Helper I

My Flow seems to be stucked in a loop with Sharepoint updateitem

Hi everybody,

 

I'm struggling with an issue on my flow.

Basically my flow has for input a json table that I need to pass to a Sharepoint list either as an update when the element exists or a new item when the element is new.

As I cannot determine which items changed since the last call on my json table, I need to update all items each time.


It is working well when I have a loop of around 270 items (completed in 7 minutes)

cfoenki_0-1678985749667.png

When I look at my other loop for a little bit more than 1000 items it is taking forever (still ongoing)

cfoenki_1-1678985793608.png

I took a look on the associated sharepoint list and it seems that nothing is happening for the last 20 minutes (8 hours ago is my previous run)

cfoenki_2-1678985845639.png

I would be extremely greatful if you have a solution.

 

Thank you in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hopefully this will speed things up significantly. It checks if you have new items and adds them, and checks if any of the items were updated, and only updates those ones. So, it will only loop for new or updated items.

 

For this example, I've got the following Excel file with three worksheets. The ones highlighted in yellow are an item that's been updated, and a new item.

grantjenkins_1-1679195176975.png

grantjenkins_2-1679195210451.png

grantjenkins_3-1679195238072.png

 

And the following SharePoint Lists. Note that I've renamed the Title field to Reference in this example.

grantjenkins_4-1679195327215.png

 

grantjenkins_5-1679195351108.png

 

grantjenkins_6-1679195373546.png

 

See full flow below (for one parallel branch). I'll go into each of the actions. Note that this includes all the actions for Deviations branch. The other two branches would be essentially the same.

grantjenkins_0-1679195068187.png

grantjenkins_18-1679196673559.png

grantjenkins_19-1679196690807.png

 

Run script is the same as what you already have.

grantjenkins_7-1679195486764.png

 

Get items Deviation returns all the items from the list. I've set Top Count to 5000, Pagination On, and a Threshold of 10000. This will retrieve items in batches of 5000 (instead of the default 100 which is slower), up to 10000 items.

grantjenkins_8-1679195576831.png

 

Filter array Deviation is the same as what you have where it filters out the Deviation object from the Office Script results.

grantjenkins_9-1679195622909.png

 

Select Excel Deviation is the same as what you have to extract out the properties. The only change is that I'm stripping out the first row (headers) within the From expression.

//From
skip(first(body('Filter_array_Deviation'))?['data'], 1)

//Reference, Process, Service, Creator
item()[0]
item()[1]
item()[2]
item()[3]

grantjenkins_10-1679195724337.png

 

Parse JSON Deviation is the same as what you have. The Schema used is:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Reference": {
                "type": "string"
            },
            "Process": {
                "type": "string"
            },
            "Service": {
                "type": "string"
            },
            "Creator": {
                "type": "string"
            }
        },
        "required": [
            "Reference",
            "Process",
            "Service",
            "Creator"
        ]
    }
}

grantjenkins_11-1679195793829.png

 

Items to be added

Firstly, I work out what items need to be added (don't exist in the list). To do this, I get all the References from the list, then check what items in the Excel results are not contained within that - those are the new items we need to add.

 

Select Deviation References retrieves a simple array of all References from the list.

grantjenkins_12-1679195932879.png

 

Filter array Deviation To Be Added filters out the data so only items that need to be added are retrieved. From is using the output from Parse JSON Deviation. Output comes from Select Deviation References. Reference gets the Reference from the current item.

//From
body('Parse_JSON_Deviation')

//Output
body('Select_Deviation_References')

//Reference
item()['Reference']

grantjenkins_13-1679196137542.png

 

Items to be updated

Next, I work out what items have been updated (difference in either Process, Service or Creator). I'm using some XPath expressions here.

 

XML Deviation converts our data from Select Excel Deviation to XML so we can use XPath.

xml(json(concat('{"root": { value:', body('Select_Excel_Deviation'), '}}')))

grantjenkins_14-1679196270321.png

 

Select Combined Deviation combines the existing data in our SharePoint List Items with the corresponding data from Excel based on the Reference (Title field in my example). It uses the following XPath expressions.

//ProcessXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Process/text())'))

//ServiceXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Service/text())'))

//CreatorXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Creator/text())'))

grantjenkins_15-1679196391006.png

 

Filter array Deviation To Be Updated uses the output from Select Combined Deviation and the following filter expression, which will check if any of the values have been updated in Excel.

@OR(
    not(equals(item()?['Process'], item()?['ProcessXL'])),
    not(equals(item()?['Service'], item()?['ServiceXL'])),
    not(equals(item()?['Creator'], item()?['CreatorXL']))
)

grantjenkins_16-1679196478420.png

 

Parse JSON Deviation To Be Updated uses the output from Filter array Deviation To Be Updated, and the following Schema.

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "ID": {
                "type": "integer"
            },
            "Reference": {
                "type": "string"
            },
            "Process": {
                "type": "string"
            },
            "Service": {
                "type": "string"
            },
            "Creator": {
                "type": "string"
            },
            "ProcessXL": {
                "type": "string"
            },
            "ServiceXL": {
                "type": "string"
            },
            "CreatorXL": {
                "type": "string"
            }
        },
        "required": [
            "ID",
            "Reference",
            "Process",
            "Service",
            "Creator",
            "ProcessXL",
            "ServiceXL",
            "CreatorXL"
        ]
    }
}

grantjenkins_17-1679196560444.png

 

Apply to each Add Deviation iterates over each of the items from Filter array Deviation To Be Added. And within the loop, it uses Create item Deviation to add each of the new items.

grantjenkins_21-1679196825241.png

 

Apply to each Update Deviation iterates over each of the items from Parse JSON Deviation To Be Updated. And within the loop, it uses Update item Deviation to update each of the items that have changed.

grantjenkins_22-1679196909352.png

 

In my example, both loops will only iterate once, since I've only got one item that was updated and one item that was added. I would hope the entire flow (with all your data) would complete within a couple of minutes all going well.

 

The output in my Deviations Table Dashboard List after the flow runs is below.

grantjenkins_23-1679197355714.png


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

View solution in original post

16 REPLIES 16
v-chengfen-msft
Microsoft
Microsoft

Hi @cfoenki ,

Maybe you can try to enable the concurrency function of [Apply to each]

This can improve the execution efficiency of [Apply to each] and reduce the execution time

vchengfenmsft_0-1679021222409.png

 

 

Best Regards

Cheng Feng

cfoenki
Helper I
Helper I

@v-chengfen-msft Thank you for the response. Unfortunately turning on Concurrency control made things worse 😞

grantjenkins
Super User
Super User

Are you able to show what you have in your Condition within the loop?

 

Also, does your List and JSON data have a unique property that you can match on (a way to identify which JSON object relates to which List item)?

 

If you could show a sample of your JSON data and the List item, that would help.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
cfoenki
Helper I
Helper I

Sure, here is what is inside my loop

cfoenki_0-1679043866683.png

I have 3 parrallel loops for 3 different sharepoint list could it cause the issue?

I tested to save my flow as a new one and keep only one branch and it is working fine

I'd suggest explaining exactly what your flow is trying to achieve (including the three SharePoint Lists), and provide a sample of the JSON data and the List data. This would help to perhaps redesign the flow so it's more efficient.

 

Also a screenshot(s) of the entire flow as you have it now.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
cfoenki
Helper I
Helper I

Thank you for taking the time to answer. I redesigned the flow and now it is working but maybe you could help me having a more efficient flow as mine is taking about half an hour.

 

I have an Excel table on a Sharepoint document library. There are 3 tables of interest in that Excel: Deviation, CAPA and Other CAPA Plan.

My excel file has no Table objects (and I cannot change that)

 

From the Excel file, I want to create 3 sharepoint lists that are mirror from the Excel Table data. I have then 3 lists:
- Deviation Table Dashboard --> Should contain data from "Deviation" tab of my Excel

- CAPA Plan Table Dashboard --> Should contain data from "Other CAPA Plan" tab of my Excel

- CAPA Table Dashboard --> Should contain data from "CAPA" tab of my Excel

 

I want that my Sharepoint lists are updated regularly with Excel file updates

 

My Sharepoint lists are linked to a PowerApps application.

 

I built an office script to extract data to power automate.

Here is the script:

 

/**
 * This script returns the values from the used ranges on each worksheet.
 */
function main(workbook: ExcelScript.Workbook): WorksheetData[] {
    // Create an object to return the data from each worksheet.
    let worksheetInformation: WorksheetData[] = [];

    // Get the data from every worksheet, one at a time.
  workbook.getWorksheets().forEach((sheet) => {
    // Check if the sheet name is different from "Audit Trail"
    if (sheet.getName() !== "Audit Trail") {
      let values = sheet.getUsedRange()?.getValues();
      worksheetInformation.push({
        name: sheet.getName(),
        data: values as string[][]
      });
    }
  });

  return worksheetInformation;
}

// An interface to pass the worksheet name and cell values through a flow.
interface WorksheetData {
    name: string;
    data: string[][];
}

 

 

I use sheet.getUsedRange to detect the range of data in each sheet.

 

In Power Automate I use the Run script action to retrieve output

cfoenki_0-1679065791916.png

 

The array result has this kind of format (I trimmed data a lot so it is not too long):

 

 

{
	"body": [
		{
			"name": "Deviation",
			"data": [
				[
					"Reference",
					"Process",
					"Service",
					"Creator",
				],
				[
					"#####",
					"ZZZZ",
					"YYYYY",
					"XXXX"
				],
				[
					"#####2",
					"ZZZZ2",
					"YYYYY2",
					"XXXX3"
				]
			]
		},
		{
			"name": "CAPA",
			"data": [
				[
					"ReferenceCAPA",
					"ProcessCAPA",
					"ServiceCAPA",
					"CreatorCAPA",
				],
				[
					"#####",
					"ZZZZ",
					"YYYYY",
					"XXXX"
				],
				[
					"#####2",
					"ZZZZ2",
					"YYYYY2",
					"XXXX3"
				]
			]
		},
		{
			"name": "Other CAPA Plan",
			"data": [
				[
					"ReferenceCAPAPlan",
					"ProcessCAPAPlan",
					"ServiceCAPAPlan",
					"CreatorCAPAPlan",
				],
				[
					"#####",
					"ZZZZ",
					"YYYYY",
					"XXXX"
				],
				[
					"#####2",
					"ZZZZ2",
					"YYYYY2",
					"XXXX3"
				]
			]
		}
	]
}

 

 

As I cannot use it like this I use the filter action to first select deviation table results:

cfoenki_1-1679065862460.png

And then a Select action to convert the result to a JSON array

cfoenki_3-1679065953396.png

The output is like this (with my previous example):

 

 

{
	"body": [
		{
			"Reference": "Reference",
			"Process": "Process",
			"Service": "Service",
			"Creator": "Creator"
		},
		{
			"Reference": "#####",
			"Process": "ZZZZ",
			"Service": "YYYYY",
			"Creator": "XXXX"
		},
		{
			"Reference": "#####2",
			"Process": "ZZZZ2",
			"Service": "YYYYY2",
			"Creator": "XXXX2"
		},
		{
			"Reference": "#####3",
			"Process": "ZZZZ3",
			"Service": "YYYYY3",
			"Creator": "XXXX3"
		}
	]
}

 

 

To remove the header row I use a Compose action with skip function:

cfoenki_4-1679066271931.png

Then I use a Parse JSON action to easily retrieve my fields:

cfoenki_5-1679066323404.png

Then I retrive all the current items in the sharepoint list (using Pagination as I may have a lot of items)

cfoenki_6-1679066439066.png

And finally I have a loop through all items of my JSON table

 

cfoenki_7-1679066564495.png

 

In the loop I first make a filter on the output of get items to check if reference is foundin the existing list

cfoenki_8-1679066663527.png

If length is equal to 0, it means that the item is new, I used then a Create Item action to fill a new line, if it is >0 then I used an Update Item action to update the existing line

cfoenki_11-1679067034040.pngcfoenki_12-1679067041088.png

The formula inside the field is checking if the value of the field is N/A or with no text, if so field is filled with null value otherwise it is using the Current Item property corresponding

 

If(or(equals(items('Loop_through_all_deviation_lines')['Reference'],''),equals(items('Loop_through_all_deviation_lines')['Reference'],'N/A')),null,items('Loop_through_all_deviation_lines')['Reference'])

 

The formula in the Id field of Update Item is related to the previous filter function:

 

first(body('Filter_on_the_current_deviation_item'))?['ID']

 

 

And that is the end, except that this is repeated 3 times as I have 3 tables.

 

Here is the screenshot of the whole flow for 1 list:

cfoenki_13-1679067329257.png

cfoenki_14-1679067348078.png

 

 

 

If you have an idea on how to optimize this please let me know 🙂

 

Thank you in advance.

What you have is pretty well constructed given what you're working with (Excel file with three tables that aren't defined as Tables, etc.). I'm assuming the main bottleneck is the loops due to the Condition and Add/Update actions.

 

A few questions.

  1. How many items would be in the three tables (approximately).
  2. How many items would be in the existing SharePoint Lists?
  3. How many would be new items vs. existing items that needed to be updated (approximately)?
  4. Are the Reference values always unique (what you are using in your Condition)?
  5. Do you have access to Premium connectors?

----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
cfoenki
Helper I
Helper I

@grantjenkins Your are right the bottleneck is the update/createitem loop.

 

After some tests on my existing flow the flow takes 30-40 min to run when trigger is manuel but when it is a trigger Schedule with a récurrence of 1 per day, the flow is taking forever (when I write this it is still ongoing after 7 hours...)

 

Here are the answers to the questions:

  1. How many items would be in the three tables (approximately).

In Déviation I have roughly 300 items

In Other CAPA Plans 50 items

In CAPA 1000 items

 

  1. How many items would be in the existing SharePoint Lists?

Same as in Excel (mirror)

  1. How many would be new items vs. existing items that needed to be updated (approximately)?

New items for Deviation approximately 5 per week Updates 50 items per week

New items for Other CAPA Plan 2 per week Update 1 item per week

New items for CAPA 20 per week Update 200 per week

  1. Are the Reference values always unique (what you are using in your Condition)?

Yes all references are unique

  1. Do you have access to Premium connectors?

Yes

RADical
Resolver I
Resolver I

@cfoenki You might be hitting an infinite loop in the action. You can try changing that connection to use a different user or create a condition which updates the list when the flow is triggered.

 

Preventing Infinite Loop in MS Power Automate (MS Flow) - YouTube

Hopefully this will speed things up significantly. It checks if you have new items and adds them, and checks if any of the items were updated, and only updates those ones. So, it will only loop for new or updated items.

 

For this example, I've got the following Excel file with three worksheets. The ones highlighted in yellow are an item that's been updated, and a new item.

grantjenkins_1-1679195176975.png

grantjenkins_2-1679195210451.png

grantjenkins_3-1679195238072.png

 

And the following SharePoint Lists. Note that I've renamed the Title field to Reference in this example.

grantjenkins_4-1679195327215.png

 

grantjenkins_5-1679195351108.png

 

grantjenkins_6-1679195373546.png

 

See full flow below (for one parallel branch). I'll go into each of the actions. Note that this includes all the actions for Deviations branch. The other two branches would be essentially the same.

grantjenkins_0-1679195068187.png

grantjenkins_18-1679196673559.png

grantjenkins_19-1679196690807.png

 

Run script is the same as what you already have.

grantjenkins_7-1679195486764.png

 

Get items Deviation returns all the items from the list. I've set Top Count to 5000, Pagination On, and a Threshold of 10000. This will retrieve items in batches of 5000 (instead of the default 100 which is slower), up to 10000 items.

grantjenkins_8-1679195576831.png

 

Filter array Deviation is the same as what you have where it filters out the Deviation object from the Office Script results.

grantjenkins_9-1679195622909.png

 

Select Excel Deviation is the same as what you have to extract out the properties. The only change is that I'm stripping out the first row (headers) within the From expression.

//From
skip(first(body('Filter_array_Deviation'))?['data'], 1)

//Reference, Process, Service, Creator
item()[0]
item()[1]
item()[2]
item()[3]

grantjenkins_10-1679195724337.png

 

Parse JSON Deviation is the same as what you have. The Schema used is:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Reference": {
                "type": "string"
            },
            "Process": {
                "type": "string"
            },
            "Service": {
                "type": "string"
            },
            "Creator": {
                "type": "string"
            }
        },
        "required": [
            "Reference",
            "Process",
            "Service",
            "Creator"
        ]
    }
}

grantjenkins_11-1679195793829.png

 

Items to be added

Firstly, I work out what items need to be added (don't exist in the list). To do this, I get all the References from the list, then check what items in the Excel results are not contained within that - those are the new items we need to add.

 

Select Deviation References retrieves a simple array of all References from the list.

grantjenkins_12-1679195932879.png

 

Filter array Deviation To Be Added filters out the data so only items that need to be added are retrieved. From is using the output from Parse JSON Deviation. Output comes from Select Deviation References. Reference gets the Reference from the current item.

//From
body('Parse_JSON_Deviation')

//Output
body('Select_Deviation_References')

//Reference
item()['Reference']

grantjenkins_13-1679196137542.png

 

Items to be updated

Next, I work out what items have been updated (difference in either Process, Service or Creator). I'm using some XPath expressions here.

 

XML Deviation converts our data from Select Excel Deviation to XML so we can use XPath.

xml(json(concat('{"root": { value:', body('Select_Excel_Deviation'), '}}')))

grantjenkins_14-1679196270321.png

 

Select Combined Deviation combines the existing data in our SharePoint List Items with the corresponding data from Excel based on the Reference (Title field in my example). It uses the following XPath expressions.

//ProcessXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Process/text())'))

//ServiceXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Service/text())'))

//CreatorXL
xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference="', item()?['Title'], '"]/Creator/text())'))

grantjenkins_15-1679196391006.png

 

Filter array Deviation To Be Updated uses the output from Select Combined Deviation and the following filter expression, which will check if any of the values have been updated in Excel.

@OR(
    not(equals(item()?['Process'], item()?['ProcessXL'])),
    not(equals(item()?['Service'], item()?['ServiceXL'])),
    not(equals(item()?['Creator'], item()?['CreatorXL']))
)

grantjenkins_16-1679196478420.png

 

Parse JSON Deviation To Be Updated uses the output from Filter array Deviation To Be Updated, and the following Schema.

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "ID": {
                "type": "integer"
            },
            "Reference": {
                "type": "string"
            },
            "Process": {
                "type": "string"
            },
            "Service": {
                "type": "string"
            },
            "Creator": {
                "type": "string"
            },
            "ProcessXL": {
                "type": "string"
            },
            "ServiceXL": {
                "type": "string"
            },
            "CreatorXL": {
                "type": "string"
            }
        },
        "required": [
            "ID",
            "Reference",
            "Process",
            "Service",
            "Creator",
            "ProcessXL",
            "ServiceXL",
            "CreatorXL"
        ]
    }
}

grantjenkins_17-1679196560444.png

 

Apply to each Add Deviation iterates over each of the items from Filter array Deviation To Be Added. And within the loop, it uses Create item Deviation to add each of the new items.

grantjenkins_21-1679196825241.png

 

Apply to each Update Deviation iterates over each of the items from Parse JSON Deviation To Be Updated. And within the loop, it uses Update item Deviation to update each of the items that have changed.

grantjenkins_22-1679196909352.png

 

In my example, both loops will only iterate once, since I've only got one item that was updated and one item that was added. I would hope the entire flow (with all your data) would complete within a couple of minutes all going well.

 

The output in my Deviations Table Dashboard List after the flow runs is below.

grantjenkins_23-1679197355714.png


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
cfoenki
Helper I
Helper I

Hi @grantjenkins ,

 

Thank you for this step by step explanation.

I followed your explanation and scaled it to my real data model (48 columns).

I got an error on the step "Select Conbined Deviation":

The execution of template action 'Select_Combined_Deviation' failed: The evaluation of 'query' action 'where' expression '{
  "ID": "@item()?['ID']",
  "Reference": "@item()?['Title']",
  "Process": "@item()?['Process']",
  "Service": "@item()?['Service']",
  "Creator": "@item()?['DeviationCreator']",
  "Detection date": "@item()?['Detectiondate']",
  "Creation date": "@item()?['DeviationCreationdate']",
  "Responsible": "@item()?['DeviationResponsible']",
  "Type": "@item()?['DeviationType']",
  "Procedure Reference": "@item()?['ProcedureReference']",
  "Description": "@item()?['Description']",
  "Immediate actions": "@item()?['Immediateactions']",
  "Transmitted to Compliance on": "@item()?['TransmittedtoComplianceon']",
  "Initial Regulatory risk": "@item()?['InitialRegulatoryrisk']",
  "Initial Regulatory risk comment": "@item()?['InitialRegulatoryriskcomment']",
  "Initial Product/Patient risk": "@item()?['InitialProduct_x002f_Patientrisk']",
  "Initial Product/Patient risk comment": "@item()?['InitialProduct_x002f_Patientrisk0']",
  "Initial Deviation level": "@item()?['InitialDeviationlevel']",
  "Initial Justification": "@item()?['InitialJustification']",
  "Date PR (for critical)": "@item()?['DatePR_x0028_forcritical_x0029_']",
  "Date EUQPPV (for critical)": "@item()?['DateEUQPPV_x0028_forcritical_x00']",
  "Evaluation Date": "@item()?['EvaluationDate']",
  "Due Date": "@item()?['DueDate']",
  "Investigation Conclusion": "@item()?['InvestigationConclusion']",
  "Root cause identified": "@item()?['Rootcauseidentified']",
  "Root cause analysis": "@item()?['Rootcauseanalysis']",
  "Root cause category": "@item()?['Rootcausecategory']",
  "Recurrent Deviation": "@item()?['RecurrentDeviation']",
  "Recurrence analysis": "@item()?['Recurrenceanalysis']",
  "Perimeter extension": "@item()?['Perimeterextension']",
  "New Perimeter of impact": "@item()?['NewPerimeterofimpact']",
  "Perimeter extension comment": "@item()?['Perimeterextensioncomment']",
  "Investigation conclusion date": "@item()?['Investigationconclusiondate']",
  "Final Regulatory risk": "@item()?['FinalRegulatoryrisk']",
  "Final Regulatory risk comment": "@item()?['FinalRegulatoryriskcomment']",
  "Final Product/Patient risk": "@item()?['FinalProduct_x002f_Patientrisk']",
  "Final Product/Patient risk comment": "@item()?['FinalProduct_x002f_Patientriskco']",
  "Final Deviation level": "@item()?['FinalDeviationlevel']",
  "Final Justification": "@item()?['FinalJustification']",
  "Final PR Notification date": "@item()?['FinalPRNotificationdate']",
  "Final EUQPPV notification date": "@item()?['FinalEUQPPVnotificationdate']",
  "Deviation closure date": "@item()?['Deviationclosuredate']",
  "CAPA needed": "@item()?['CAPAneeded']",
  "CAPA Plan reference": "@item()?['CAPAPlanreference']",
  "CAPA Plan Creation Date": "@item()?['CAPAPlanCreationDate']",
  "CAPA Plan Objective": "@item()?['CAPAPlanObjective']",
  "CAPA Plan Responsible": "@item()?['CAPAPlanResponsible']",
  "CAPA Plan due date": "@item()?['CAPAPlanduedate']",
  "CAPA Plan closure date": "@item()?['CAPAPlanclosuredate']",
  "ProcessXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Process/text())'))",
  "ServiceXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Service/text())'))",
  "CreatorXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Creator/text())'))",
  "Detection dateXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Detection date/text())'))",
  "Creation dateXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Creation date/text())'))",
  "ResponsibleXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Responsible/text())'))",
  "TypeXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Type/text())'))",
  "Procedure ReferenceXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Procedure Reference/text())'))",
  "DescriptionXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Description/text())'))",
  "Immediate actionsXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Immediate actions/text())'))",
  "Transmitted to Compliance onXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Transmitted to Compliance on/text())'))",
  "Initial Regulatory riskXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Regulatory risk/text())'))",
  "Initial Regulatory risk commentXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Regulatory risk comment/text())'))",
  "Initial Product/Patient riskXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Product/Patient risk/text())'))",
  "Initial Product/Patient risk commentXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Product/Patient risk comment/text())'))",
  "Initial Deviation levelXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Deviation level/text())'))",
  "Initial JustificationXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Initial Justification/text())'))",
  "Date PR (for critical)XL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Date PR (for critical)/text())'))",
  "Date EUQPPV (for critical)XL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Date EUQPPV (for critical)/text())'))",
  "Evaluation DateXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Evaluation Date/text())'))",
  "Due DateXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Due Date/text())'))",
  "Investigation ConclusionXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Investigation Conclusion/text())'))",
  "Root cause identifiedXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Root cause identified/text())'))",
  "Root cause analysisXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Root cause analysis/text())'))",
  "Root cause categoryXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Root cause category/text())'))",
  "Recurrent DeviationXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Recurrent Deviation/text())'))",
  "Recurrence analysisXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Recurrence analysis/text())'))",
  "Perimeter extensionXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Perimeter extension/text())'))",
  "New Perimeter of impactXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/New Perimeter of impact/text())'))",
  "Perimeter extension commentXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Perimeter extension comment/text())'))",
  "Investigation conclusion dateXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Investigation conclusion date/text())'))",
  "Final Regulatory riskXL": "@xpath(ou

Are you able to help me on that one? I am wondering it it could not be a matter of space in my Initial JSON table column names

Yes, it looks like it's because you've got spaces in your Field Names that you're using in your XPath expressions. You'll need to use the converted field names for any that have spaces.

 

//If you had the following Field Name

First Name

//It would be converted to

First_x0020_Name

//Spaces will be replaced with

_x0020_ 

----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
cfoenki
Helper I
Helper I

Thanks I will test that

cfoenki
Helper I
Helper I

I ended up by removing all spaces in my columns but still get the error (here is the simplified select action for test):

 

 

InvalidTemplate. The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{ "ID": "@item()?['ID']", "Reference": "@item()?['Title']", "Process": "@item()?['Process']", "ProcessXL": "@xpath(outputs('XML_Deviation'), concat('string(//root/value[Reference=\"', item()?['Title'], '\"]/Process/text())'))" }' failed: 'The template language function 'xpath' failed to parse the provided XML.'.

 

 

 

cfoenki_0-1679320294241.png

 

Edit: I saw that despite the checkmark, the step of XML creation is returning an error on the output:

cfoenki_0-1679322089609.png

 

After further investigation the above error is due to a special character

cfoenki_1-1679323486508.png

 

cfoenki
Helper I
Helper I

Hi @grantjenkins ,

 

I finally figured out what to do with my special characters embbed in the Excel text. I modified my office script to replace all special characters by a space and now after several attemps it is WORKING!! Using your method.


Now my flow takes only 20 minutes and moreover it is working with the same speed using recurrence trigger.

 

Thank you so much for the help!!

takolota
Super User
Super User

Could this all be done in a simpler & faster way using SharePoint batch updates?

https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Batch-Update-SharePoint-List/td-p/136541...

Helpful resources

Announcements

Power Platform Connections Ep 15 | L. Baybutt | Thursday, 1 June 2023

Episode Fifteen of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Lewis Baybutt aka Low Code Lewis, alongside the latest news and community blogs.   Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.        Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.  Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions. 

May 2023 Community Newsletter and Upcoming Events

Welcome to our May 2023 Community Newsletter, where we'll be highlighting the latest news, releases, upcoming events, and the great work of our members inside the Biz Apps communities. If you're new to this LinkedIn group, be sure to subscribe here in the News & Announcements to stay up to date with the latest news from our ever-growing membership network who "changed the way they thought about code".         LATEST NEWS "Mondays at Microsoft" LIVE on LinkedIn - 8am PST - Monday 15th May  - Grab your Monday morning coffee and come join Principal Program Managers Heather Cook and Karuana Gatimu for the premiere episode of "Mondays at Microsoft"! This show will kick off the launch of the new Microsoft Community LinkedIn channel and cover a whole host of hot topics from across the #PowerPlatform, #ModernWork, #Dynamics365, #AI, and everything in-between. Just click the image below to register and come join the team LIVE on Monday 15th May 2023 at 8am PST. Hope to see you there!     Executive Keynote | Microsoft Customer Success Day CVP for Business Applications & Platform, Charles Lamanna, shares the latest #BusinessApplications product enhancements and updates to help customers achieve their business outcomes.         S01E13 Power Platform Connections - 12pm PST - Thursday 11th May Episode Thirteen of Power Platform Connections sees Hugo Bernier take a deep dive into the mind of co-host David Warner II, alongside the reviewing the great work of Dennis Goedegebuure, Keith Atherton, Michael Megel, Cat Schneider, and more. Click below to subscribe and get notified, with David and Hugo LIVE in the YouTube chat from 12pm PST. And use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.         UPCOMING EVENTS   European Power Platform Conference - early bird ticket sale ends! The European Power Platform Conference early bird ticket sale ends on Friday 12th May 2023! #EPPC23 brings together the Microsoft Power Platform Communities for three days of unrivaled days in-person learning, connections and inspiration, featuring three inspirational keynotes, six expert full-day tutorials, and over eighty-five specialist sessions, with guest speakers including April Dunnam, Dona Sarkar, Ilya Fainberg, Janet Robb, Daniel Laskewitz, Rui Santos, Jens Christian Schrøder, Marco Rocca, and many more. Deep dive into the latest product advancements as you hear from some of the brightest minds in the #PowerApps space. Click here to book your ticket today and save!      DynamicMinds Conference - Slovenia - 22-24th May 2023 It's not long now until the DynamicsMinds Conference, which takes place in Slovenia on 22nd - 24th May, 2023 - where brilliant minds meet, mingle & share! This great Power Platform and Dynamics 365 Conference features a whole host of amazing speakers, including the likes of Georg Glantschnig, Dona Sarkar, Tommy Skaue, Monique Hayward, Aleksandar Totovic, Rachel Profitt, Aurélien CLERE, Ana Inés Urrutia de Souza, Luca Pellegrini, Bostjan Golob, Shannon Mullins, Elena Baeva, Ivan Ficko, Guro Faller, Vivian Voss, Andrew Bibby, Tricia Sinclair, Roger Gilchrist, Sara Lagerquist, Steve Mordue, and many more. Click here: DynamicsMinds Conference for more info on what is sure an amazing community conference covering all aspects of Power Platform and beyond.    Days of Knowledge Conference in Denmark - 1-2nd June 2023 Check out 'Days of Knowledge', a Directions 4 Partners conference on 1st-2nd June in Odense, Denmark, which focuses on educating employees, sharing knowledge and upgrading Business Central professionals. This fantastic two-day conference offers a combination of training sessions and workshops - all with Business Central and related products as the main topic. There's a great list of industry experts sharing their knowledge, including Iona V., Bert Verbeek, Liza Juhlin, Douglas Romão, Carolina Edvinsson, Kim Dalsgaard Christensen, Inga Sartauskaite, Peik Bech-Andersen, Shannon Mullins, James Crowter, Mona Borksted Nielsen, Renato Fajdiga, Vivian Voss, Sven Noomen, Paulien Buskens, Andri Már Helgason, Kayleen Hannigan, Freddy Kristiansen, Signe Agerbo, Luc van Vugt, and many more. If you want to meet industry experts, gain an advantage in the SMB-market, and acquire new knowledge about Microsoft Dynamics Business Central, click here Days of Knowledge Conference in Denmark to buy your ticket today!   COMMUNITY HIGHLIGHTS Check out our top Super and Community Users reaching new levels! These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities.   Power Apps:  Super Users: @WarrenBelz, @LaurensM  @BCBuizer  Community Users:  @Amik@ @mmollet, @Cr1t    Power Automate:  Super Users: @Expiscornovus , @grantjenkins, @abm  Community Users: @Nived_Nambiar, @ManishSolanki    Power Virtual Agents:  Super Users: @Pstork1, @Expiscornovus  Community Users: @JoseA, @fernandosilva, @angerfire1213    Power Pages: Super Users: @ragavanrajan  Community Users: @Fubar, @Madhankumar_L,@gospa  LATEST COMMUNITY BLOG ARTICLES  Power Apps Community Blog  Power Automate Community Blog  Power Virtual Agents Community Blog  Power Pages Community Blog  Check out 'Using the Community' for more helpful tips and information:  Power Apps , Power Automate, Power Virtual Agents, Power Pages 

Announcing | Super Users - 2023 Season 1

Super Users – 2023 Season 1    We are excited to kick off the Power Users Super User Program for 2023 - Season 1.  The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts.      Super User Season 1 | Contributions July 1, 2022 – December 31, 2022  Super User Season 2 | Contributions January 1, 2023 – June 30, 2023    Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile.  Power Apps  Power Automate  Power Virtual Agents  Power Pages  Pstork1*  Pstork1*  Pstork1*  OliverRodrigues  BCBuizer  Expiscornovus*  Expiscornovus*  ragavanrajan  AhmedSalih  grantjenkins  renatoromao    Mira_Ghaly*  Mira_Ghaly*      Sundeep_Malik*  Sundeep_Malik*      SudeepGhatakNZ*  SudeepGhatakNZ*      StretchFredrik*  StretchFredrik*      365-Assist*  365-Assist*      cha_cha  ekarim2020      timl  Hardesh15      iAm_ManCat  annajhaveri      SebS  Rhiassuring      LaurensM  abm      TheRobRush  Ankesh_49      WiZey  lbendlin      Nogueira1306  Kaif_Siddique      victorcp  RobElliott      dpoggemann  srduval      SBax  CFernandes      Roverandom  schwibach      Akser  CraigStewart      PowerRanger  MichaelAnnis      subsguts  David_MA      EricRegnier  edgonzales      zmansuri  GeorgiosG      ChrisPiasecki  ryule      AmDev  fchopo      phipps0218  tom_riha      theapurva  takolota     Akash17  momlo     BCLS776  Shuvam-rpa     rampprakash  ScottShearer     Rusk  ChristianAbata     cchannon  Koen5     a33ik  Heartholme     AaronKnox  okeks      Matren  David_MA     Alex_10        Jeff_Thorpe        poweractivate        Ramole        DianaBirkelbach        DavidZoon        AJ_Z        PriyankaGeethik        BrianS        StalinPonnusamy        HamidBee        CNT        Anonymous_Hippo        Anchov        KeithAtherton        alaabitar        Tolu_Victor        KRider        sperry1625        IPC_ahaas      zuurg    rubin_boer   cwebb365   Dorrinda   G1124   Gabibalaban   Manan-Malhotra   jcfDaniel   WarrenBelz   Waegemma   drrickryp   GuidoPreite   metsshan    If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances.  Once they are received the list will be updated. 

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.   Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.      Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/   

Users online (4,153)