@enlightened ya I encountered the same issue. Answer is to use variables! Please see the post that @TMNXT-Dev referenced & follow 🌶 's solution. That should solve your problem 👍
But no luck. It’s crazy to have to take pot-shot’s in order to make something work. Isn’t the ANY decent documentation on how to use this stuff? The examples are horrible, not real world. What can be done about this?
Variable works when changing value in a status column. But how do we change the string value for an item in a text column? There has to be a way for such a common use case 🤔
Could there be another form we’re not aware of? Like a text JSON str equivalent of status… something like JSON.stringify({“text” : “sample”}) to pass in, even though that doesn’t rly even make sense…
It looks promising, but I’m still confused. What are you passing in as the value for text? I see that you set $value var type to JSON instead of String. It’d be especially helpful if you can give us an example value for autoId that would work in this case?
In the example given autoId is just a string. As the GraphQl expects a JSON I call my function with JSON.stingify(autoId).
That does make sense?
Shouldn’t we be able to just set String type directly then like $value: String! instead of $value: JSON! 🤔 though I did try that & found that it didn’t work…
wow it worked finally jeez thank you @basdebruin 👍 🥇 🏆
@enlightened we were supposed to stringify a STRING to be passed in as the value. Setting $value as String! type or setting the value to a primitive string won’t work cause $value must be JSON, apparently
I’m glad to join in on the help party here! I’ll have to take a further look with the team to see what might be the root cause for this behavior and I’ll get back to you as soon as I can with more pointers 🙂
That said, I am literally speechless at the amount and quality of help that @supernova, @basdebruin and @TMNXT-Dev have provided here!! Thank you so much for being an active pillar of our community and for helping our users where they need more support the most.
-Alex
The others brought up a good point about stringifying your JSON and I really think that is the main problem as well. Since you’re using XMLHttpRequest rather than Monday’s API, the requirement is a bit different. Moving forward I recommend using JSON.stringify() than try to figure out where to put the slashes and quotes. insert whohastimeforthat.gif
I believe you wanted to use it all in one line and stick your variables inside the query and not use variables, but unfortunately that’s not possible with changing column values as @supernova and @TMNXT-Dev have pointed out.
I’m not familiar with IIS, but I am a bit familiar with XMLHttpRequests as I use fetch more frequently, so I hope you can translate it to how you want, but this is how I have it working:
const xmlhttp = new XMLHttpRequest();
const theUrl = "https://api.monday.com/v2"
as str is your query, correct? I should have made that clearer.
As for variables. You’re right and as discussed in @supernova’s post earlier: Can't change column value(s) Unfortunately the only way to get it working is with variables. May be a bug or if it’s not, the documentation should stress it more that variable is required. nudge @AlexSavchuk nudge
So if you’re going to add variables, you’ll just need to send it this way:
If you’re open to suggestions @AlexSavchuk , here are some that I have for monday’s current API doc:
where Playground is first introduced, specify that just because a query runs successfully in the GraphQL editor does not mean that that same query will work in code ( also a good place to clearly state requirement of variables* here )
*maybe also emphasize variables usage at relevant checkpoints throughout the doc for those who don’t attentively read from A-Z… lol (me)
anchor links or even a ⚠️ will do 👍
under Mutating > Columns > Change column values :
I suggest including another example for a simple Text column ( and/or add a section for Text Column to the list of column types under “Changing column values section” )
cuz right now it’s not intuitive (to me at least) from what’s given that you have to convert a ~ string ~ to JSON for a Text column. Long Text + Status col inputs (status is the default example in the doc) scream Object! to a newbie. Since updating an item’s text is such a common use case, I feel like it deserves its own special place on the doc y’know?
include more concrete, practical, thorough examples
const jsonStr2 = JSON.stringify(
{
text: "hooray!",
status: {
index: 1
},
date7: {
date: "2020-09-10",
time: "13:25:00"
},
email_1: {
email: "itsmyemail@mailserver.com",
text: "my email"
},
link: {
"url": "http://monday.com",
"text": "go to monday!"
},
numbers_3: "110.95",
long_text_1: {
"text": "Hi, I'm a Long Text! I can contain up to 2000 chars! Text is my twin...what's her char limit, you ask? Idk! Sadly, our creators never told us ¯\\_(ツ)_/¯ But hopefully we'll find out soon enough so we can let you know Anyway, try me out! Click add column > more columns & you'll find me there!"
}
});
I know there's a section near the end laying out both forms for each individual col type (excluding text). That's great! But it'd be *even more* helpful, compact & comprehensible imo to have a complete example that demonstrates how to **Change multiple column values** as a quick one-stop reference point.
That way, whenever someone wants to update multiple column values together, s/he won’t have to jump to another section to collect the info needed. It’d be clear right off the bat which key/value pairs & types are expected for which column types.
Also, ( somewhat minor but still relevant I guess ) :
For argument types where we see !Int , !String , !JSON, the exclamation points are there to indicate that those args are required, right? Except at first sight, it reads the opposite! I’m sure this one’s a typo & ! should be at the end. Just interesting that a misplacement of 1 char can completely flip the intended meaning haha again, nbd since it’s easy to deduce from the given context.
Still, I think it’s worth pointing out since I do recall being confused about this very early on. And if someone misinterprets !JSON to mean that JSON is optional…well then you can see the trouble there. That alone may throw them off when their query doesn’t run in code as they expect it to.
TL;DR
emphasize variables requirement; add text column example; the more examples the merrier 🥳 🎈
Just my 2¢ ✨
🙂
Got fired up by your post & drafted up a whole proposal 🌶 @pepperaddict lol 😂
Thanks for staying on this case and making sure we can figure this out together! I really appreciate your continued support 🌶 and 🦈 - your contributions to the community have been just top-notch lately. Honestly, thank you for taking the time out of your day to help other users out 🙂
I’ve taken a further look at this with the team, and we have come to the conclusion that the values you are trying to send to our servers are not formatted as JSON correctly, which is why they’re getting blocked with an error:
To me, it seems like you are applying the JSON.stringify in a way that shouldn’t work with our API, especially seeing as some columns, like the Text column, have a different structure to their data than others.
This is what I am referring to when saying the JSON.stringify code could be used in a better way:
Overall, the isn’t going through as expected because at this point in time, our column value parser expects JSON values (not primitives) in most cases, which is something that @supernova is referring to in his post as well. This means that even if the value you are sending is a string of text to a Text column, the whole string has to be formatted as JSON for the platform to recognise it as such. Does that make sense?
That said, I do think this is a point of friction and tension for a lot of our users, as I have issues with this exact process myself. To be transparent with you, we are already working on making further improvements to this area and I want to make sure this thread is not lost in the community - I’ve passed it on to the development team just to show how big of an impact this current setup has on our users.
I really appreciate you coming forth with a list of suggestions that would make our users’ life with code easier, as creating apps and integrations is not an easy task to begin with. I’m stunned by the time you’ve put into making sure your experience is taken into account and I definitely agree that the documentation needs some love from our team to make it clearer, easier to use and more intuitive.
I’m afraid I can’t commit to an ETA when the changes you are looking for would become more than suggestions and be implemented in practice, but I’ve taken those points to the team and hopefully, we can make an effort together to make this part of the platform better. Again, I appreciate your awesome, friendly and clear input with action steps, as this helps us make those changes in a quicker way as well.
I guess what we were trying to get across is that we wished the documentation could’ve been clearer with better examples. Ultimately, we were able to get the queries to work, but it wasn’t until we discovered that we had to use variables (kudos to 🌶). And from there the struggle then became figuring out exactly how to structure the variables so they’d pass. This is but one case where updating the docs could save a lot of time and frustration - not just for users of this platform but for monday’s development team as well. I suspect there would be less cases of confusion over simple things like this, eliminating the need for multiple back and forth exchanges surrounding some core piece of information that could have & should have been better explained in the doc.
Anyway, I typed out that lengthy post (surprised myself too, smh) not just to share my own account + a few others’ I’ve seen on this forum, including @enlightened’s from this discussion, but primarily to shed light on how frustrating it can be from a new dev’s perspective. And because I believed the few starter suggestions I listed shouldn’t take long to implement. Any one of the working solutions or examples provided in this forum could literally be copied & pasted, and that would already count as an improvement. It’s bad enough to struggle through something firsthand; even worse to witness someone else fall into the same trap - stuck for what could be hours, days, or worse yet, giving up entirely - when something like this could easily have been avoided with just a few lines edited / highlighted in the doc. This is why it bothers me as much as it does. But I also understand that y’all may have your priorities set elsewhere at this time.
Well, at least now this thread exists for future new users to reference if they know what to search, so that’s a start! Anyway, it’s awesome that you’ve acknowledged this pain point & plan to someday improve the docs 👍
✨ All the best! ✨
I completely agree with 🐬!
More examples will definitely help and this is the third post regarding this issue (that I’m aware of) .
Thank you @AlexSavchuk for getting back to us regarding this!
Sorry for hijacking this post, and please don’t take this the wrong way: I feel like the problem we’re facing is being overlooked as a json issue. Which may still be a possibility but we’ve tried different approaches and the frustration mostly lies on it working in playground but not in practice.
When working with enlightened’s xmlhttp post request, I also had to use variables to be able to successfully update the column so it’s not just a Monday SDK issue. Well, whether it’s a bug or not, 🐬's suggestion of having more examples will make any developer happy. haha.
✨ Exactly 💖💚 ✨
Just did a quick search & these are the sort of cases I was referring to:
Also, I remember responding to someone’s post in discord about having better documented integration & recipe examples. Not sure if our comments were even seen though ♀️
@AlexSavchuk If the team ever needs inspiration, I recommend checking out Chainlink’s dev docs + resources. Although they’re blockchain focused in the cryptosphere, you can still get good ideas from their dev docs (e.g. use of multi-tab editor to demo query code samples in different programming languages) 👍
( sry this is the last time I’ll bug you about this stuff aha srsly I’m getting tired too 😝
plz don’t take offense at any of this 🙏 )
Can we update an item without knowing item_id.
I am creating a duplicate board.
After duplicating it I need to set some values from webhook.
But Now I don’t about the item_id of it but I know name will always same.