Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
User avatar
By groakes
#795844
Hi,

I was wondering if anyone had tried creating issues in Jira as part of a ProcessMaker process.

We have a process whereby a our organisation assesses incoming material for addition into our Collection. Once material has come through this process it is managed as a project which, depending upon the nature and type of material, can be non linear in its handling. What I would like to do is at the end of the process, generate an issue into a Jira backlog.

If anyone has any ideas about this it would be great. Both PM and Jira are hosted locally.

cheers
Greg
User avatar
By amosbatto
#795895
Based on what I found by googling, my best guess is that you can create a trigger in ProcessMaker with code like this:
Code: Select all
//set to your username and password and URL of your Jira installation:
$username = 'fred';
$password = 'PaSsW0rD'; 
$url = 'http://localhost:8090/rest/api/2/issue/';

//set the data for the new issue:
$aData = array(
   "fields" => array(
       "project" => array(
            "key" => "test"
       ),
       "summary" => "REST ye merry gentlemen.",
       "issuetype" => array(
          "name" => "Bug"
       )     
    )
);

$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);

//next 2 lines only necessary if using POST:
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aData));

//uncomment the following 2 lines if using https:
//curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); 
//curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);

@=oRet = json_decode(curl_exec($ch)); 
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

//uncomment to debug:
//print "<pre>"; var_dump(@=oRet); die;

if ($status != 200 and $status !=201) {
   throw new Exception("Error: $status: ".json_encode(@=oRet));
}
else {
    @@jiraID = @=oRet->id;
    @@jiraKey = @=oRet->key;
    @@jiraUrl = @=oRet->self;
}
You can see the results if you have a subsequent DynaForm in your process with fields which are associated with the jiraID, jiraKey and jiraUrl variables.

See:
https://developer.atlassian.com/jiradev ... eate-issue
https://community.atlassian.com/t5/Answ ... q-p/530858
http://wiki.processmaker.com/3.0/Callin ... T_Requests

Turn on the debugger when running this trigger. If this code doesn't work, then you should post it on the Jira forum and ask what is wrong. They should know how to interact with their own API.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]