Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting user mentions from blueprint wizard into confluence page

Elliot Sloman
Contributor
February 11, 2019

I've created a Blueprint Wizard and I've been trying to get the autocomplete-user field to work but despite being able to successfully search for users in the wizard, when the draft is created and published, the user name is still inserted as plain text.

I've spent a good while looking through the existing questions and answers and although there's lots of questions on the subject, I still haven't been able to resolve the issue.

The relevant section in my soy template is as follows:

<div class="field-group">
<label for="techreview">{getText('my.blueprint.form.label.title.techReview')}</label>
<input id="techreview" type="text" class="text long-field autocomplete-user" data-none-message="No users found" data-template="{literal}{username}{/literal}" placeholder="{getText('blueprint.form.name-label.placeholder')}" name="techReview">
</div>

 

My post-render function is: (I've tried with both UserOrGroup, MultiUser and both of them individually with no change in success).

wizard.on('post-render.ECOInfoForm', function(e, state){
AJS.Confluence.Binder.autocompleteMultiUser();
AJS.Confluence.Binder.autocompleteUserOrGroup();
})

 

My XML:

<tr>
<th>Technical Reviewer</th>
<td><at:var at:name="techReview"/></td>
</tr>

I've also tried replacing the above with:

<tr>
<th>Technical Reviewer</th>
<td><ri:user ri:username="techReview"/></td>
</tr>

and that didn't work either. I'm guessing because this looks for a username of 'techReview'? Rather than actually replacing it with the given username from the soy.

 

What am I doing wrong? Sadly, I couldn't seem to find any good examples on this anywhere. Any help would be much appreciated! 

1 answer

1 accepted

2 votes
Answer accepted
Elliot Sloman
Contributor
February 22, 2019

I was able to answer my own question eventually.

My XML:

<tr>
<th>Technical Reviewer</th>
<td><at:var at:name="vTechReviewMention" at:rawxhtml="true"/></td>
</tr>

 And in my ContextProvider Class:

String vTechReview = (String) blueprintContext.get("vTechReview");
context.put("vTechReviewMention", "<ac:link><ri:user ri:username=\"" + vTechReview + "\"/></ac:link>")

And this worked for me. The magic was adding the  <ac:link> tags around the user tags. Hope this helps anyone else who struggles to get this working.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events