monday.execute

You can use the monday.execute software development kit (SDK) method to invoke an action on the parent monday client.

Parameters

ParameterDescription
typeWhich action to perform.
paramsOptional parameters for the action.

Actions

Open item card

Opens a modal with information from the selected item.

type openItemCard

ParameterTypeDescriptionRequiredDefault Value
itemIdIntegerThe ID of the item to open.Yes
kindStringOn which view to open the item card.
Can be "updates" / "columns"
No"columns"

Example

monday.execute('openItemCard', { itemId: item.id });

Here's what the open item card will look like:

Confirmation dialog

Opens a confirmation dialog to the user type confirm.

ParameterTypeDescriptionRequiredDefault Value
messageStringThe message to display in the dialogYes
confirmButtonStringThe text for the confirmation buttonNo"OK"
cancelButtonStringThe text for the cancel buttonNo"Cancel"
excludeCancelButtonBooleanEither to exclude the cancel buttonNofalse

Example

monday.execute("confirm", {
   message: "Are you sure?", 
   confirmButton: "Let's go!", 
   cancelButton: "No way", 
   excludeCancelButton: false
}).then((res) => {
    console.log(res.data);
    // {"confirm": true}
});

Here's what the confirmation dialog will look like:

Notice message

Display a message at the top of the user's page. Useful for success, error, and general messages.

type notice

ParameterTypeDescriptionRequiredDefault Value
messageStringThe message to display.Yes
typeStringThe type of message to display. Can be "success" (green), "error" (red) or "info" (blue).No"info"
timeoutIntegerThe number of milliseconds to show the message until it closes.No5000

Example

monday.execute("notice", { 
   message: "I'm a success message",
   type: "success", // or "error" (red), or "info" (blue)
   timeout: 10000,
});

This is what the success message will look like:

Open files preview dialog

Opens a modal with the preview of an asset.

type openFilesDialog

ParameterTypeDescriptionRequiredDefault Value
boardIdIntegerThe ID of the board.Yes
itemIdIntegerThe ID of the item, which contains an asset.Yes
columnIdStringThe ID of the column, which contains an asset.Yes
assetIdIntegerThe ID of the asset to open.Yes

Example

monday.execute('openFilesDialog', {
  boardId: 12345,
  itemId: 23456,
  columnId: 'files',
  assetId: 34567
})

Opening the file preview dialog will look like this:

Trigger file upload process

Opens a modal to let the current user upload a file to a specific file column.

Returns a promise. In case of error, the promise is rejected.

After the file is successfully uploaded, the change_column_value event will be triggered. Check out how to subscribe to these events <a href="https://developer.monday.com/apps/docs/mondaylisten#subscribe-to-interaction-based-events-on-the-board" target="_blank>here!

Requires boards:write scope

type triggerFilesUpload

ParameterTypeDescriptionRequiredDefault Value
boardIdIntegerThe ID of the board.Yes
itemIdIntegerThe ID of the item, which contains an asset.Yes
columnIdStringThe ID of the file column, where file should be uploaded.Yes

Example

monday.execute('triggerFilesUpload', {
  boardId: 12345,
  itemId: 23456,
  columnId: 'files'
})

Triggering the file upload process will look like this:

Open modal

Opens a new modal window as an iFrame.

type openAppFeatureModal

ParameterTypeDescriptionRequiredDefault Value
urlStringThe URL of the page displayed in the modal.No
urlPathStringSubdirectory or path of the URL to open.No
urlParamsObjectQuery parameters for the URL.No
widthStringThe width of the modal.No"0px"
heightStringThe height of the modal.No"0px"

Example

monday.execute('openAppFeatureModal', { urlPath, urlParams, height, width }).then((res) => {
   console.log(res.data);
   {"close": true}
   // The above is a callback to see if a user closed the modal from the inside. This is useful should you want to run some logic within the app window. 
});

Opening and closing a modal will look like this:

📘

Note

Make sure the urlPath you pass is a relative URL and not an absolute URL.

Close modal

Closes the modal window.

type closeAppFeatureModal

This method does not have any parameters.

Example

monday.execute('closeAppFeatureModal').then((res) => {
  console.log(res.data);
});

Value created for user

Notifies the monday platform that user gains a first value in an app. You can find more information about this method in the Value-created event best practices doc.

type valueCreatedForUser

This method does not have any parameters.

Example

monday.execute('valueCreatedForUser');

Open setting window

Opens view settings window.

type openSettings

This method does not have any parameters.

Example

monday.execute('openSettings').then((res) => {
  console.log(res.data);
  // note that method will open view settings, unless settings were already opened
});

This is what opening and closing settings looks like:

Close setting window

Closes view settings window.

type closeSettings

This method does not have any parameters.

Example

monday.execute('closeSettings').then((res) => {
  console.log(res.data);
  // note that method will close view settings, unless settings were already closed
});

Add document block

Adds a new block to a workdoc.

type addDocBlock

ParameterTypeDescriptionRequired
typeStringThe block type: normal text, large title, medium title, small title, bulleted list, numbered list, quote, check list, or code.Yes
afterBlockIdStringUsed to specify where in the doc the new block should go. Provide the block's ID that will be above the new block. Without this parameter, the new block will appear at the top of the doc.No
contentObjectThe block's content in Delta format.Yes

Each block's content is defined by a content JSON object containing multiple attributes, one of which is deltaFormat. Creating new blocks requires familiarity with the Delta format. We recommend using Quill's Delta library to format your content.

Example

const addToDoc = () => {
    const { focusedBlocks } = context;
    const afterBlockId = focusedBlocks[0].id;
    const data = {
      type: "normal text",
      content: {
        deltaFormat: [
          {
            insert: newText
          }
        ]
      },
      afterBlockId
    };


    monday.execute("addDocBlock", data);
    monday.execute("closeDocModal");
  };

Update document block

Updates a block's content.

type updateDocBlock

ParameterTypeDescriptionRequired
idStringThe block's unique identifier.Yes
contentJSONThe block's content you want to update in Delta format.Yes

Each block's content is defined by a content JSON object containing multiple attributes, one of which is deltaFormat. Creating updating blocks requires familiarity with the Delta format. We recommend using Quill's Delta library to format your content.

Example

const updateBlock = async () => {
    const { focusedBlocks, placement } = context;
    const { id } = focusedBlocks[0];
    const content = {
      deltaFormat: [
        {
          insert: "this is a random text"
        }
      ]
    };

    const res = await monday.execute("updateDocBlock", { id, content });
    await monday.execute("closeDocModal");

  };

Add multiple document blocks

Adds multiple blocks to a workdoc.

type addMultiBlocks

ParameterTypeDescriptionRequired
afterBlockIdStringUsed to specify where in the doc the new block should go. Provide the block's ID that will be above the new block. Without this parameter, the new block will appear at the top of the doc.No
blocksBlock[]The block's content in Delta format. We support the following block types: normal text, large title, medium title, small title, bulleted list, numbered list, quote, check list, or code.Yes
parentBlockIdStringThe parent block's unique identifier. Please note that you currently can only use this to add a block to a table.No

Each block's content is defined by a content JSON object containing multiple attributes, one of which is deltaFormat. Creating updating blocks requires familiarity with the Delta format. We recommend using Quill's Delta library to format your content.

Example

const contentForBlockOne = {
  deltaFormat: [
    {
      "alignment" : center
        "insert" : "Block one heading"
        "attributes" : {
            "bold" : true
    }
  ]
};

const contentForBlockTwo = {
  deltaFormat: [
    {
      "alignment" : left
      "insert" : "Block two heading",
      "attributes" : {
        "underline" : true
      }
    }
  ]
};

monday.execute('addMultiBlocks', {
  afterBlockId: "7f8c145-989f-48bb-b7f8-dc8f91690g42",
  blocks: [
    {
      type: "large title",
      content: contentForBlockOne
    },
    {
      type: "medium title",
      content: contentForBlockTwo
    }
  ]
})

Close document modal

Closes the document block modal. If you don't call this method, the modal will close when the user clicks outside of it.

type closeDocModal

This method does not have any parameters.

Example

monday.execute("closeDocModal");

Open app feature integrations

Opens a modal with integrations.

type openAppFeatureIntegrations

ParameterTypeDescriptionRequired
boardIdIntegerThe board's unique identifier.Yes