SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1k forks source link

Cannot add new item to ECB Menu - SharePoint 2019 #7287

Open cortatn opened 3 years ago

cortatn commented 3 years ago

Target SharePoint environment

SharePoint Server 2019 (on-premise)

What SharePoint development model, framework, SDK or API is this about?

Site designs & site scripts

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Internet Explorer

Describe the bug / error

Hello,

We just migrated from SharePoint 2013 to 2016, then 2019.

We create items in the menu in JavaScript via the CAMOpt () function. In 2013 and 2016, everything is working perfectly, but not in 2019.

The "m" parameter in the function CAMOpt is constantly null and the item is not added.

CAMOpt(m,"Add to...","AddTo('"+listName + "'," + currentItemID +");");

The issue is identical to the following topic (which has been closed and reported as a bug): Can't add element to ECB menu in Sharepoint 2019

I cannot use JSOM to add to the menu permanently because I want the item only appear on a particular page and "SP Callout actions" is not working for custom list / generic list

Do you know a solution or a workaround ?

Thanks in advance Nathan

Steps to reproduce

  1. Create a JavaScript file with the Custom_AddListMenuItems function function Custom_AddListMenuItems(m, ctx) {CAMOpt(m, "Hello World", "alert('Hello World')", "");}
  2. Edit a page and link the JS file to a new Content Editor Web Part
  3. Add a web part from any list to the page and check that in the webpart view the column "Title (linked to item with edit menu)" is displayed.
  4. The "m" parameter is set to null and them item is not added.

Expected behavior

A new item "Hello World" in the edit menu > "..." is added.

ghost commented 3 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.