Forums

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

Automate Confiforms with ScriptRunner

Amir March 4, 2023

As you know, Confiforms doesn't support automation jobs and scheduling, while Adaptavist Scriptrunner plugin support jobs with custom scripts.

I have a form with auto enroll option and I want to submit it daily. The form check a criteria and when it is right, it sends an email.

I try lots of scripts to load enroll url, but I couldn't succeed. The url sample is like this:

"/confiforms/autoenroll.action?pageId=xxxx&f=FormName&_redirectUrl=/"

Could anyone help me to do this? Also please first test it, because I tried lots of scripts and none of them has worked.

Also my instance is restricted and it requires authentication to submit the form.

Is there another way I implement scheduling on Confiforms?

1 answer

1 vote
Alex Medved _ConfiForms_
Community Champion
March 4, 2023

Hi @Amir and welcome to this community

Using autoenroll URL to submit a form in ConfiForms sounds a but unusual.

There are REST APIs you can use - https://wiki.vertuna.com/display/CONFIFORMS/REST+API

which allow you full flexibility at what you do and how

Alex

Amir March 5, 2023

Hi Alex

Thank you for you answer.

How can I schedule Confiforms IFTTT with Rest API?

I want Confiforms check a condition (ex. a date) everyday and if it is true, send an email.

Thanks

Amir

Alex Medved _ConfiForms_
Community Champion
March 5, 2023

Hi @Amir 

I guess the answer is the topic title :-)

(or any other 3rd party scheduler you can use - CRON, etc)

Alex

Amir March 6, 2023

I wrote this code in "Jobs" section of ScriptRunner and chose "Confluence Admin" in "Run as" field, But I got 401 error!

import groovy.json.JsonOutput
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import org.apache.http.entity.ContentType

def payload = [
  fields: [
   "mytextfield":"field value"
  ]
]

def http = new HTTPBuilder("https://<my-confluence-site>")

http.request(Method.POST, ContentType.APPLICATION_JSON) {
   uri.path = '/rest/confiforms/1.0/create/pageId/formName'
   headers.'Content-Type' = 'application/json'
   requestEntity = JsonOutput.toJson(payload)
}

Could anyone help me?



Alex Medved _ConfiForms_
Community Champion
March 6, 2023

Hi

401 means your request is not authenticated

Alex

Amir March 6, 2023

Yes I know. But there isn't any reason why I get this error. Because I run this script (and create confiforms entry) as Confluence Admin! So maybe the code is wrong and it should be changed...

Alex Medved _ConfiForms_
Community Champion
March 6, 2023

But the http connection you open to confluence does not seems to be authenticated

(but I am not a scriptrunner user, so I might be wrong)

Like Amir likes this
Amir March 6, 2023

I really appreciate you if you add scheduling jobs to Confiforms IFTTT. Then it would be the most complete workflow app ever.

Like Markus Hintzsche likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events