I do have experience in Java/Groovy and used to write code using ScriptRunner / PowerScript for Server model. Through i appreciate the serverless concept of Forge used for Cloud, i’m having difficulty in implementing the same using Forge since i’m relatively new to JavaScript/Ajax. Appreciate if u can help me with the below
if i need to use rest api 3 then how to handle description coming in multiple. is there any example on joining all of them into a single.
Also, when i’m using rest api 2 , and access description field then it is showing the text as {{My Description}} . How can i extract only exact description?
I need to update a customfield by prefixing a static text to the Description, then how do i search for if the Cf exists and then get the field ID for subsequent put operation. I’m unable to find the example anywhere.
No. At least not as specific as merging multiple ADF documents into 1. However, there are 2 possible approaches:
If you really just need to merge the whole contents, you could probably get away with some JSON manipulation and understanding of the ADF structure. Basically, merge the content arrays from each of the documents, and put them back into a new content array, and you have yourself a valid ADF document.
More sophisticated manipulation is probably better done with a library. Unfortunately, the JavaScript library is mostly following the builder pattern and does not have a “merge” utility.
I’m not 100% sure. Is that extra text the wiki formatting? If so, then don’t you want to keep the formatting as you merge/rewrite the content? Part of the problem that ADF was meant to solve in the v3 API is how to convey the “exact description” while including formatting. So, if you want to see the formatting rendered in HTML, you can use an expand parameter on the request. Try using renderedFields to see if that’s the way you want the content.
Your Forge app can search fields using GET /rest/api/2/field/search?query=${query}. Since you mentioned being new to JavaScript, be careful with the “template function” in the Forge api module. You should always create variables for the parts of your URL that would change and let the template substitute them. See this thread to avoid a common problem: