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,558,949
Community Members
 
Community Events
184
Community Groups

Confluence / confiforms / IFTTT / Javascript ?

I have been looking for some examples of using the IFTTT macro 'Run Javascript' action but the pickings are slim. I can get as far as alert('static text') but as soon as I start trying to access form fields I fall over in a flaming heap

Do I need to use JQuery or can I access fields using the 'standard' [entry.fieldname] syntax somehow?

 

1 or 2 pointers should see me on my way ... all I want to do is too populate a field dynamically based on content of other fields for use in a subsequent macro (email body, Jira ticket body, etc.)

 

P.

4 answers

You are ahead of me. I am still trying to figure out hoe to get the basic alert working per https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions :(

The wiki indicates to use a script fragment like below in the body:Capture1.PNGHowever this does not work at all, instead the following gets inserted into the page after execution:

Capture2.PNG

This happens with or without the "no format" macro.

 

And then I simply ignored the wiki and voila! The following worked:

Capture3.PNG

 

Previously (without the No Format macro) I could only get 1 line of JS to execute. Problem solved hopefully

Wow, not sure how you figure that out. It worked like a charm. I was able to display the form field I needed in the alert message as well!

Thanks!

I have a requirement to create a calculator on confluence usinng confiform. It needs to preform some calculation and give the result at the time of submission.

I tried using javascript inside IFTTT, however it is not working.

 

Javascript outside of confiform inside ListView is working fine, however it creates for all the items within the table. 

 

I need to run javascript at the time of form submission. Any help?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 27, 2020

The contents you put inside the ListView is generated for EACH row that your ListView renders

So, you need to put your shared scripts outside the ListView

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 27, 2020

Side note: do you know that you can have calculations online with ConfiForms, without a need for submit?

See the first demo https://wiki.vertuna.com/display/TEST/Page+to+demo+score+calculation+using+2+methods 

Can also call JavaScript if a "more serious" calculation is needed (what we support built-n: https://wiki.vertuna.com/display/CONFIFORMS/Supported+math+operators%2C+formulas+and+functions )

Thanks for your reply. I wnated to knwo how to add storage format code in confluence. I can add macro by searching confiform. but how do we add 

<ac:structured-macro ac:macro-id="a2d2bfea-0bba-47af-ae0a-01a323851220" ac:name="confiform" ac:schema-version="1">  <ac:parameter ac:name="formName">dynamicUpdate1</ac:parameter>  <ac:rich-text-body>    <ac:structured-macro ac:macro-id="35fe9696-b67b-4323-bdf4-295384bd7e71" ac:name="confiform-entry-register" ac:schema-version="1">      <ac:rich-text-body>        <p> </p>      </ac:rich-text-body>    </ac:structured-macro>    <p>

Do I need use any of the macro add above code to it? 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 27, 2020 • edited

By using free plugin from Atlassian https://marketplace.atlassian.com/apps/1210722/confluence-source-editor?hosting=server&tab=overview 

The page I have referenced earlier mentions that in the page header...

Please correct me if this is the wrong place to ask, but did anyone figure out if it was possible to manipulate a field using JavaScript placed in an IFTTT macro?

Thank you,

Aaron

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 27, 2019

@aaron_gedz 

You can inject the script into the page (assuming it is not disabled in ConfiForms configuration) and that script can do just about anything you want.

Script shall be either wrapped inside the code macro or inside the noformat to ensure it stays the same and does not get some unnecessary "extras" from Confluence editor

Quick demo on such IFTTT https://wiki.vertuna.com/display/TEST/Redirect+on+save+to+dynamic+url+with+IFTTT+with+javascript

 

Manipulating the fields shall be done with ConfiForms Rules for Field Definition macros, as this is what you use to manipulate the UI

https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules

and the demo

https://wiki.vertuna.com/display/TEST/Using+ConfiForms+Field+Definition+rules+with+JavaScript+action+to+get+and+set+field+values

Thanks for the quick reply!

So would it not be possible to save the result of a Run JavaScript IFTTT Macro back to a field on created?

 

Similar to the above examples, if I had something like

rSummary = '[entry.rSummary]';

rSummary = rSummary.replace(/"[^"]+"/g, function(v) {

      return v.replace(/,/g, '');

(Then this would be the block where I would save the result of "rSummary" back to my field, or the server, or the [entry.rSummary], notation)

Or is that only possible using Confiforms Rules for Field Definition?

Thanks,

Aaron

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 28, 2019

JavaScript works on the browser, and you can manipulate the UI with it. You cannot save "back" the field, as it is not a callback you have on "save" / before "save".

You need to "prepare" the value before it gets submitted and that can be done using the ConfiForms Rules for Field Definition macro

Ah, okay. Thank you for your timely response!

I appreciate your help!

Aaron

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 10, 2019

For this to work properly you need to add your scripts inside the HTML macro

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events