Skip to main content
19-Tanzanite
June 28, 2017
Solved

Add tags to a Blog Entry using the Add Blog Entry snippet

  • June 28, 2017
  • 1 reply
  • 1829 views

I've been trying to use the Add Blog Entry snippet from the platform, but I have an issue.

The snippet inserts in the first line the following line:

var tags = new Array();

If you try to do tags.push, the snippet throws "Wrapped java.lang.Exception: Unable To Convert From org.json.JSONArray to TAGS Cause: Unable To Convert From org.json.JSONArray to TAGS".

I tried the AddTag method, but it does not exist, since it is a new Array.


What is the way to programmatically add a tag to a blog entry in javascript?

Best answer by CarlesColl

I don't think so.

Also you can always do myArray.join(";")

1 reply

1-Visitor
June 28, 2017

Hi Vlad,

To update Tags on a blog entry, you should use UpdateBlogEntry and on tags parameter pass a string with tags separated by ";" something like: "MyVocabulary:MyTag;MyVocabulary:MySecondTag"

You also can create a service which returns the baseType TAGS and set on that service:

var result = "MyVocabulary:MyTag;MyVocabulary:MySecondTag"


To create a new blog entry with tags, you just need to follow my previous instructions but with AddBlogEntry

19-Tanzanite
June 28, 2017

Hi Carles,

Thanks for the info, I was aware of the way involving strings, but to be more precise, I wanted to know if there's a way to add a Tag using the Array constructor which was provided by the snippet.

1-Visitor
June 28, 2017

I don't think so.

Also you can always do myArray.join(";")