I have a Flow that runs once a year that worked the last two years but isn't this year.
It uses the Send an HTTP request to SharePoint to create a SharePoint List.
The variable in the Body is:
replace(replace(string(setProperty(body('Parse_JSON')?['actions'][0],'listName', variables('NewListName'))),'\','\\'),'"','\"')
The error I'm getting is:
Action 1 (createSPList) is invalid. Parameter addNavLink has an invalid value.
clientRequestId: 056a4386-e089-486d-b371-d3dade28de2f
serviceRequestId: 21c1fea0-609f-e000-3646-a16bd2aec37a
Here is the value of Body after it's ran:
{"script": "{\"actions\":[{\"verb\":\"createSPList\",\"templateType\":100,\"color\":\"[[LChipLogCurrent0001_color]]\",\"icon\":\"[[LChipLogCurrent0001_icon]]\",\"addNavLink\":\"[[LChipLogCurrent0001_addNavLink]]\",\"description\":\"[[LChipLogCurrent0001_description]]\",\"identity\":\"LChipLogCurrent0001\",\"subactions\":[{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field ID=\\\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\\\" Type=\\\"Text\\\" Name=\\\"Title\\\" DisplayName=\\\"Title\\\" Required=\\\"FALSE\\\" SourceID=\\\"http://schemas.microsoft.com/sharepoint/v3\\\" StaticName=\\\"Title\\\" FromBaseType=\\\"TRUE\\\" MaxLength=\\\"255\\\" Indexed=\\\"FALSE\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"EmployeeName \\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"EmployeeName\\\" Title=\\\"EmployeeName \\\" Type=\\\"Text\\\" ID=\\\"{dfec35ec-91e9-4591-a589-87c03e9830f3}\\\" StaticName=\\\"EmployeeName\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"EmployeeID\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"EmployeeID\\\" Title=\\\"EmployeeID\\\" Type=\\\"Text\\\" ID=\\\"{e956855f-9806-48e8-b2d1-5f88d4b2bfea}\\\" StaticName=\\\"EmployeeID\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"SafetyChips\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"SafetyChips\\\" Title=\\\"SafetyChips\\\" Type=\\\"Text\\\" ID=\\\"{9550692c-1c9c-49a4-b2ec-9dc7f61e004a}\\\" StaticName=\\\"SafetyChips\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"CultureChips\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"CultureChips\\\" Title=\\\"CultureChips\\\" Type=\\\"Text\\\" ID=\\\"{957945c8-f881-46cb-a940-f4e618beb500}\\\" StaticName=\\\"CultureChips\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"CultureValue\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"CultureValue\\\" Title=\\\"CultureValue\\\" Type=\\\"Text\\\" ID=\\\"{7083f020-3188-45b4-bd3a-cb946d349fe3}\\\" StaticName=\\\"CultureValue\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"SafetyValue\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"SafetyValue\\\" Title=\\\"SafetyValue\\\" Type=\\\"Text\\\" ID=\\\"{9895fe45-15a7-4b19-8879-32585c7f64fc}\\\" StaticName=\\\"SafetyValue\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"ItemChosen\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"ItemChosen\\\" Title=\\\"ItemChosen\\\" Type=\\\"Text\\\" ID=\\\"{a5f467fd-f959-4043-a720-16e238d6ab22}\\\" StaticName=\\\"ItemChosen\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field AppendOnly=\\\"FALSE\\\" DisplayName=\\\"Notes\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" IsolateStyles=\\\"FALSE\\\" Name=\\\"Notes\\\" RichText=\\\"FALSE\\\" RichTextMode=\\\"Compatible\\\" Title=\\\"Notes\\\" Type=\\\"Note\\\" ID=\\\"{da72e3ed-8a3f-4644-97b7-d3e77eddfdfa}\\\" StaticName=\\\"Notes\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field ClientSideComponentId=\\\"00000000-0000-0000-0000-000000000000\\\" DisplayName=\\\"LogDateTime\\\" FriendlyDisplayFormat=\\\"Disabled\\\" Format=\\\"DateTime\\\" Name=\\\"LogDateTime\\\" Title=\\\"LogDateTime\\\" Type=\\\"DateTime\\\" ID=\\\"{79ce58de-8b01-40c8-979a-ea931db1c207}\\\" StaticName=\\\"LogDateTime\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"GrantedBy\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"GrantedBy\\\" Title=\\\"GrantedBy\\\" Type=\\\"Text\\\" ID=\\\"{ed3c1cbf-b85d-4bfc-b614-c1adc08efaee}\\\" StaticName=\\\"GrantedBy\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field DisplayName=\\\"SubmittedBy\\\" Format=\\\"Dropdown\\\" IsModern=\\\"TRUE\\\" MaxLength=\\\"255\\\" Name=\\\"SubmittedBy\\\" Title=\\\"SubmittedBy\\\" Type=\\\"Text\\\" ID=\\\"{fd40e24a-6ac2-48e1-9435-a14f76334749}\\\" StaticName=\\\"SubmittedBy\\\" />\"},{\"verb\":\"addSPFieldXml\",\"schemaXml\":\"<Field ID=\\\"{82642ec8-ef9b-478f-acf9-31f7d45fbc31}\\\" ReadOnly=\\\"TRUE\\\" Type=\\\"Computed\\\" Name=\\\"LinkTitle\\\" DisplayName=\\\"Title\\\" DisplayNameSrcField=\\\"Title\\\" ClassInfo=\\\"Menu\\\" AuthoringInfo=\\\"(linked to item with edit menu)\\\" ListItemMenuAllowed=\\\"Required\\\" LinkToItemAllowed=\\\"Prohibited\\\" SourceID=\\\"http://schemas.microsoft.com/sharepoint/v3\\\" StaticName=\\\"LinkTitle\\\" FromBaseType=\\\"TRUE\\\"><FieldRefs><FieldRef Name=\\\"Title\\\" /><FieldRef Name=\\\"LinkTitleNoMenu\\\" /><FieldRef Name=\\\"_EditMenuTableStart2\\\" /><FieldRef Name=\\\"_EditMenuTableEnd\\\" /></FieldRefs><DisplayPattern><FieldSwitch><Expr><GetVar Name=\\\"FreeForm\\\" /></Expr><Case Value=\\\"TRUE\\\"><Field Name=\\\"LinkTitleNoMenu\\\" /></Case><Default><HTML><![CDATA[<div class=\\\"ms-vb itx\\\" onmouseover=\\\"OnItem(this)\\\" CTXName=\\\"ctx]]></HTML><Field Name=\\\"_EditMenuTableStart2\\\" /><HTML><![CDATA[\\\">]]></HTML><Field Name=\\\"LinkTitleNoMenu\\\" /><HTML><![CDATA[</div>]]></HTML><HTML><![CDATA[<div class=\\\"s4-ctx\\\" onmouseover=\\\"OnChildItem(this.parentNode); return false;\\\">]]></HTML><HTML><![CDATA[<span> </span>]]></HTML><HTML><![CDATA[<a onfocus=\\\"OnChildItem(this.parentNode.parentNode); return false;\\\" onclick=\\\"PopMenuFromChevron(event); return false;\\\" href=\\\"javascript:;\\\" title=\\\"Open Menu\\\"></a>]]></HTML><HTML><![CDATA[<span> </span>]]></HTML><HTML><![CDATA[</div>]]></HTML></Default></FieldSwitch></DisplayPattern></Field>\"},{\"verb\":\"addContentType\",\"name\":\"Item\",\"id\":\"0x01\",\"fieldRefsXml\":[\"<FieldRef ID=\\\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\\\" Name=\\\"Title\\\" DisplayName=\\\"Title\\\" Required=\\\"FALSE\\\" Hidden=\\\"TRUE\\\" ReadOnly=\\\"FALSE\\\" PITarget=\\\"\\\" PrimaryPITarget=\\\"\\\" PIAttribute=\\\"\\\" PrimaryPIAttribute=\\\"\\\" Aggregation=\\\"\\\" Node=\\\"\\\" />\",\"<FieldRef ID=\\\"{82642ec8-ef9b-478f-acf9-31f7d45fbc31}\\\" Name=\\\"LinkTitle\\\" DisplayName=\\\"Title\\\" ReadOnly=\\\"TRUE\\\" />\",\"<FieldRef ID=\\\"{dfec35ec-91e9-4591-a589-87c03e9830f3}\\\" Name=\\\"EmployeeName\\\" />\",\"<FieldRef ID=\\\"{e956855f-9806-48e8-b2d1-5f88d4b2bfea}\\\" Name=\\\"EmployeeID\\\" />\",\"<FieldRef ID=\\\"{9550692c-1c9c-49a4-b2ec-9dc7f61e004a}\\\" Name=\\\"SafetyChips\\\" />\",\"<FieldRef ID=\\\"{957945c8-f881-46cb-a940-f4e618beb500}\\\" Name=\\\"CultureChips\\\" />\",\"<FieldRef ID=\\\"{7083f020-3188-45b4-bd3a-cb946d349fe3}\\\" Name=\\\"CultureValue\\\" />\",\"<FieldRef ID=\\\"{9895fe45-15a7-4b19-8879-32585c7f64fc}\\\" Name=\\\"SafetyValue\\\" />\",\"<FieldRef ID=\\\"{a5f467fd-f959-4043-a720-16e238d6ab22}\\\" Name=\\\"ItemChosen\\\" />\",\"<FieldRef ID=\\\"{da72e3ed-8a3f-4644-97b7-d3e77eddfdfa}\\\" Name=\\\"Notes\\\" />\",\"<FieldRef ID=\\\"{79ce58de-8b01-40c8-979a-ea931db1c207}\\\" Name=\\\"LogDateTime\\\" DisplayName=\\\"LogDateTime\\\" Format=\\\"DateTime\\\" />\",\"<FieldRef ID=\\\"{ed3c1cbf-b85d-4bfc-b614-c1adc08efaee}\\\" Name=\\\"GrantedBy\\\" />\",\"<FieldRef ID=\\\"{fd40e24a-6ac2-48e1-9435-a14f76334749}\\\" Name=\\\"SubmittedBy\\\" />\"]},{\"verb\":\"addContentType\",\"name\":\"Folder\",\"id\":\"0x0120\"},{\"verb\":\"addSPView\",\"name\":\"All Items\",\"viewFields\":[\"EmployeeName\",\"EmployeeID\",\"CultureChips\",\"SafetyChips\",\"GrantedBy\",\"SubmittedBy\",\"LogDateTime\",\"CultureValue\",\"SafetyValue\",\"Notes\"],\"query\":\"<OrderBy><FieldRef Name=\\\"LogDateTime\\\" Ascending=\\\"FALSE\\\" /></OrderBy>\",\"rowLimit\":30,\"isPaged\":true,\"makeDefault\":true,\"formatterJSON\":\"\",\"replaceViewFields\":true,\"columnWidthXml\":\"<FieldRef Name=\\\"LogDateTime\\\" width=\\\"165\\\" /><FieldRef Name=\\\"ID\\\" width=\\\"90\\\" />\"}],\"listName\":\"ChipLog2023\"}]}"}
I can't tell what the issue is.
Thank you, @wskinnermctc the links within that thread eventually helped me land on a solution.
Send an HTTP request to SharePoint to get List structure to build new List
Parse JSON using the Body of the above Action
body('Send_an_HTTP_request_to_Get_List_Structure')?['body']?['d']?['GetSiteScriptFromList']
Send an HTTP request to SharePoint to create new List using below as the Body
{"script": "{\"actions\":[replace(replace(string(setProperty(setProperty(body('Parse_JSON')?['actions'][0],'listName',variables('NewListName')),'addNavLink',true)),'\','\\'),'"','\"')] }"}
This was the hardest part, formatting that long string
I searched the google and found some people having a similar issue earlier in 2023.
Their solution is below:
Do you have any more detailed instructions on how you resolved this? Trying to resolve this for a client and it's time sensitive.
EDIT: Thanks to your hint pointing me in the right direction, I figured it out. For anyone who finds this topic later:
Instead of a request body like this:
{"script": "{\"actions\":@{replace(replace(string(variables('GetSiteScriptFromList')?['actions']),'\','\\'),'"','\"')}}"}
It should now look like this:
{"script": "@{replace(replace(string(variables('GetSiteScriptFromList')),'\','\\'),'"','\"')}"}
Note that the entire getSiteScriptFromList object can now be referenced between the quotes in the script property, instead of referencing a specific property, and the {} are no longer needed as they are included in the object:
{"script": "YourFormattedGetSiteScriptFromListStringHere"}
I really don't know what any of this means, but maybe you can make sense of what they changed to get it to work.
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional