I am dying here… I can’t figure out how to shorten the input on a node. This is a json element that contains the content of an email, and it at times is full of garbage due to people’s crappy (usually Outlook) email clients. I would like to limit the returned value to only 200 characters.
I have tried slices, substrings, and I am just stuck hitting a wall. Below is the mock data of the element I have plucked out and I want to transform. Please, can someone help me figure this out, it surely must be simple, because complex stuff I usually figure out… it’s the simple stuff that stumps me.
Maybe I am missing something but a simple slice should work here. I quickly updated your code node(love the name btw) to showcase it.
Hope this helps, let me know if there is anything more
I even tried just putting the expression in the last step, where it creates the ending payload (google chat object). But it appears to just ignore the slice entirely.
The secret sauce seems to be selecting the element with [0], so the working expression is {{ $json.note[0].slice(0,200) }} in the last stage. This works.
Ahh… and that’s why it wouldn’t work. I wish it failed the evaluation rather than give me pretty green text to make me thing it was good. Ah well… maybe someone will automate that