Monday execute API openItemCard

Hi, I am trying to use below command to open item card on dashboard widget but it doesn’t seem to work . Is it supposed to work on dashboard or not ?
monday.execute('openItemCard', { itemId: item.id });
I am getting below error
Uncaught TypeError: Cannot read property ‘board_id’ of undefined
at main-632ae7001070dd532a18.js:formatted:39221
at vendors-fe8637f4cddd6cf108b2.js:formatted:85878
at dispatch (vendors-fe8637f4cddd6cf108b2.js:formatted:1116)
at main-632ae7001070dd532a18.js:formatted:39258
at vendors-fe8637f4cddd6cf108b2.js:formatted:85878
at vendors-fe8637f4cddd6cf108b2.js:formatted:1045
at n.value (main-632ae7001070dd532a18.js:formatted:146198)
at a.receiveMessage (main-632ae7001070dd532a18.js:formatted:146028)

1 Like

@vishwajeets

Looking at that error message, the issue isn’t with the execute command. There is another line that is through an error where you are trying to access the board_id property of an undefined variable.

Are you able to share some more of your code?

Hi @mitchell.hudson , that exception is not coming from my code it’s coming from Monday js libraries which is internally being called by execute. Some function which actually opens the pulse .

Updates seems to work just fine ,below call opens updates view
monday.execute('openItemCard', { itemId: parseInt(itemId), kind: 'updates' });

@dipro Can you help with this ? It’s kind of a blocker for app I am trying to build . @AlexSavchuk

Hey there @vishwajeets :wave:

Sorry for our delay in handling this! I’ll take a further look at this specific function on dashboard widgets and get back to you as soon as I can with an update :slight_smile:

@mitchell.hudson thanks for jumping in here! I appreciate the help.

-Alex

1 Like

I got this same exact issue. Like @vishwajeets the ‘columns’ kind didn’t work but the ‘updates’ did. I really don’t want to make my own column when there’s already one implemented (but seemingly broken). Did anyone find a fix?

I am having the same issue. I even tried hard coding an item id into the function and it still throws this error:

main-a5c376beeb5e01ec6ed0.js:2 Uncaught TypeError: Cannot read property 'board_id' of undefined
    at main-a5c376beeb5e01ec6ed0.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at dispatch (vendors-0225b23a005365ed2ede.js:2)
    at main-a5c376beeb5e01ec6ed0.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at n.value (main-a5c376beeb5e01ec6ed0.js:2)
    at e.receiveMessage (main-a5c376beeb5e01ec6ed0.js:2)

but I am not using board_id anywhere.
This throws the error:
monday.execute('openItemCard', {itemId: id, kind: 'columns'})
This throws the error:
monday.execute('openItemCard', {itemId: id});
This does not throw the error:
monday.execute('openItemCard', {itemId: id, kind: 'updates'})

I would love to use this feature as it’s relevant for the app I’m building. Any chance for a fix this week?

1 Like

+1, also having this issue when trying to open a card in the default view. A fix on this would be a huge help! :grinning:

Can’t say that this is a clear fix but I did manage to get it working. I think the problem is that the board that you connect to the View Setup does not register correctly. I have been able to replicate this 3 days in a row now.
After logging in and going to my Developers > “My App Name” > Features > Board View > View Setup > Put in ngrok URL in Edit Mode > View Preview
My app will then load along with the data from the board I selected. If I click on an item which will execute monday.execute("openItemCard", {itemId: parseInt(itemId)}) I get the error

main-a5c376beeb5e01ec6ed0.js:2 Uncaught TypeError: Cannot read property 'board_id' of undefined
    at main-a5c376beeb5e01ec6ed0.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at dispatch (vendors-0225b23a005365ed2ede.js:2)
    at main-a5c376beeb5e01ec6ed0.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at vendors-0225b23a005365ed2ede.js:2
    at n.value (main-a5c376beeb5e01ec6ed0.js:2)
    at e.receiveMessage (main-a5c376beeb5e01ec6ed0.js:2)

Even though I did not use board_id and openItemCard does not accept this param. Then after going to an actual monday board and switching views around then going back into my app board view, it works. It is almost as if the connected board id does not register until you go change an actual monday view for some reason. Oddly enough though, I noticed that when I open a monday board on the frontend of my monday dashboard I do not even have to have that board connected to my app for it to show in the dev view as the connected board.
It is all very odd indeed but my advice is to go to the dashboard and just start clicking around between boards and view then go back to developer view and try to openItemCard again. Hope this helps others.

Also, wanted to say thanks to @thusitha, the developer behind 1View app and winner of the last hackathon as I reached out to him via email for help and he told me that it was not opening the card because the board was not connected which is what gave me the idea to fiddle with this.

I have also encountered this problem, it’s a blocker for me.

I was able to reproduce this error. I’ve reported this to our dev team and I’ll circle back when I have an update.

Hey folks! Wanted to give you an update on this issue.

We investigated this and found that this error occurs only when you’re using the SDK in the app preview mode. If you add your app to a live board, the item card should open normally.

In any case, we’re working on a fix and it should be ready by tomorrow!