Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,457,706
Community Members
 
Community Events
176
Community Groups

Access to the number of likes and comments of an IFTTT created page

Hi. How could I access to the number of likes and comments of an IFTTT created page?

For example I have a form that creates a page after submit and the page's ID is ${iftttResult_AAA.id} and it is saved on a field named "KPageID". Now I want to access the number of likes and comments of this page to show it on the cleanView macro. Something like KPageID.likecounts . Thanks

1 answer

1 accepted

3 votes
Answer accepted

ConfiForms provides access to AbstractPage object, but unfortunately it does not provide any information about the "likes" or "comments"

yes, you're right. But it would be great if you could show me a creative way to access to likes and comments of created page in view macro. I try page properties but it didn't work.

Page properties will not work, as these "objects" are not page properties...

Creative way? :-)

Of course it is possible with ConfiForms - you can use, for example, Web service Object ref field type

(I have a web-service connection configured to my local instance of Confluence and use REST APIs to get other pages metadata that can be retrieved). Important to set the field to have "as proxy" parameter checked

http://recordit.co/1VtKmFhzo3

Transforming a bit results what I get from the REST API endpoints

<ac:structured-macro ac:macro-id="a3724955-6510-4fc1-9341-321fbf97df88" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="2b99e58c-d835-4a4e-992b-704cba1ae545" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="a0b8b1c5-1a9c-48af-a005-e20ca975891a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">p</ac:parameter>
<ac:parameter ac:name="fieldLabel">page</ac:parameter>
<ac:parameter ac:name="type">page</ac:parameter>
</ac:structured-macro> </p>
<p>
<ac:structured-macro ac:macro-id="ca220efd-3c8f-498e-a1ef-2f66fae4f3c5" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="fieldName">likes,comments</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="5dc2db31-3c22-4bd4-b9c6-94e7adc2b520" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">!p:[empty]</ac:parameter>
<ac:parameter ac:name="values">likes=[entry.p]&amp;comments=[entry.p]</ac:parameter>
<ac:parameter ac:name="action">Set value</ac:parameter>
<ac:parameter ac:name="actionFieldName">p</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="519e5e4f-190c-4104-8c2a-7f7256f0b632" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="mapping">||undefined</ac:parameter>
<ac:parameter ac:name="fieldName">likes</ac:parameter>
<ac:parameter ac:name="fieldLabel">Likes</ac:parameter>
<ac:parameter ac:name="values">rest/likes/1.0/content/[entry.likes]/likes</ac:parameter>
<ac:parameter ac:name="extras">cfa616dd12ec3374aa15e100bd9e20be</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">objectRef</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="3aca9e4e-6802-4290-83cf-d706cf250eaa" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">comments</ac:parameter>
<ac:parameter ac:name="fieldLabel">Comments</ac:parameter>
<ac:parameter ac:name="values">rest/api/content/[entry.comments]?expand=children.comment</ac:parameter>
<ac:parameter ac:name="extras">cfa616dd12ec3374aa15e100bd9e20be</ac:parameter>
<ac:parameter ac:name="extracontext">true</ac:parameter>
<ac:parameter ac:name="type">objectRef</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="68260d60-a850-41e8-8a81-b06898927bf6" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="3e9838f8-6b1c-42ae-866a-5a00899f9ad6" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">p</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="809ed2c0-4f9e-47a9-a18a-f615b7b0f8c6" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">likes.likes.asJSON.transform(user).asCount</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="e6c94b5d-c87b-4d36-9d8f-d3456bd626c5" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">comments.children.comment.results.asJSON.asCount</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>

Alex

Like Amir likes this

That was creative :)
But I don't know how to make a web service. I know that I should configure it in confiform configuration page but I don't know how to program a web service. However thanks for your solution. If I could build a web service, I will test it.

You dont have to build/develop a webservice!

All I do here is I use the public REST APIs that your Confluence instance has.

I have just set up a connection to help web-service backed fields to use it - more on such group of fields https://wiki.vertuna.com/display/CFWEB/Working+with+web+services+backed+fields 

Like Amir likes this

I get it. Thanks a lot.

And the page you sent is in a private space and I should login to see that.

Like Amir likes this

Excellent. You're the best developer :) Thank you very much
I hope I could do it with these instructions.

I've pasted the source code you've sent on an empty page and it didn't work. (Likes and comments in view table are empty after adding a page to this form and the values of likes and comments are id of the page I entered.)

Sorry to ask again. Should I configure any web-service in confiform configuration page? Or web-service connection field in my form should be empty?

Untitled.png

Of course you need to configure connection to your confluence and select it here, in the field configuration

it is visible in my screencast, and I mentioned it in my comments

see other tutorials I have linked to see where this connection needs to be configured

Like Amir likes this

I'm so sorry but I couldn't understand how to configure web-service connection in confiforms configuration page. unfortunately I couldn't see this page you sent:

https://wiki.vertuna.com/display/CFWEB/Working+with+web+services+backed+fields

and in other URLs you sent there is no guidance to show how configure webservice connection. I search on google but find nothing. could you just say what should I write in these fields to connect to confluence rest api? thanks again.

Untitled.png

In WS URL put your server URL... with https:// or http://

Does not have to be named "confluence cloned" - this is up to you

Like Amir likes this

Thank you again. I was finally able to do it.

But I have a question. When the form submitted, a page created and for access the likes and comments of that created page, I should have the ID of that page and I couldn't set value while submitting the form. So should I create another form when IFTTT runs and set values on that form or there is no need to create another form and I could set value of likes and comments with IFTTT created page ID while submitting the form? I ask because I try some ways and I couldn't succeed. Thanks

You can save back the page id of a created page (for both, the likes and the comments field)

Solution on the right of the page - https://wiki.vertuna.com/display/CONFIFORMS/Creating+links+in+original+ConfiForms+entry+to+just+created+page

(where we set back the page id, not the link)

Alex

Like Amir likes this

I'm so sorry for these many questions, but I try many ways and when I do not reach the answer, I have to ask questions...

I had done this way before, but when I'm defining the form and define field definition of likes and comments, I should set value of "/rest/likes/1.0/content/[entry.IFTTTCreatedPageID]/likes" for likes, while it hasn't value yet! So where I should put the "confiform-field-definition-rules" to set value of IFTTTCreatedPageID and then set it in likes and comments?

I hope this will be my last question :D

Please re-read my previous answer 

You can save back the page id of a created page (for both, the likes and the comments field)


And see the page I have linked... It does not talk about the "confiform-field-definition-rules" macro... 

And my answer tells you that you need to save back the page id to comments and likes field! Do you understand what I am trying to say?

Alex

Like Amir likes this

YES, It's DONE

I should just use another IFTTT instead of rules.

I Couldn't have done it without you.

Many thanks

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events