Omniplan <-> Jira connector

Hello!

I am trying to make this script work: http://forums.omnigroup.com/showthread.php?t=7856

    set login to "mylogin"
set passwd to "mypass"
set jiraProject to "PROJ"
set jiraReporter to "a_usrname"

on jiraUserForTask(_task)
	using terms from application "OmniPlan"
		set assignee to resource of item 1 of assignments of _task
		if assignee is not equal to missing value then
			set entries to custom data entries of assignee
			repeat with i from 1 to count of entries
				set entry to item i of entries
				set v to value of entry
				if name of entry is equal to "jira-user" and v is not missing value then
					return v
				end if
			end repeat
		end if
		return missing value
	end using terms from
end jiraUserForTask


on syncTaskToJira(_task, entry)
	using terms from application "OmniPlan"
		set entryKey to value of entry
		tell application "http://jira.mynetwork.com:8080/rpc/xmlrpc"
			--if assignee of issue does not equal to _task 
			set assignee to my jiraUserForTask(_task)
			if assignee is not equal to missing value then
				set t to call xmlrpc {method name:"jira1.login", parameters:{my login, my passwd}}
				
				if entryKey is equal to "C" then -- create
					set issue to call xmlrpc {method name:"jira1.createIssue", parameters:{t, {project:my jiraProject, summary:name of _task, type:"3", assignee:assignee, reporter:my jiraReporter}}}
					
					tell application "OmniPlan"
						set value of entry to |key| of issue
						set entryKey to value of entry
					end tell
				else
					set issue to call xmlrpc {method name:"jira1.getIssue", parameters:{t, entryKey}}
				end if
				
				-- Update the effort (timetracking in Jira)
				tell application "OmniPlan"
					set _effort to ((effort of _task) / (60 * 60)) as integer
					if _effort < 8 then
						set _effort to "" & _effort & "h"
					else
						set _effort to "" & ((_effort / 8) as integer) & "d"
					end if
				end tell
				
				-- Reset effort + assignee 
				set issue to call xmlrpc {method name:"jira1.updateIssue", parameters:{t, entryKey, {timetracking:{_effort}}}}
				set issue to call xmlrpc {method name:"jira1.updateIssue", parameters:{t, entryKey, {assignee:{assignee}}}}
				
			end if
		end tell
	end using terms from
end syncTaskToJira

on handleTask(_task)
	using terms from application "OmniPlan"
		--tell task _task
		set entries to custom data entries of _task
		repeat with i from 1 to count of entries
			set entry to item i of entries
			set v to value of entry
			if name of entry is equal to "jira-id" and v is not missing value then
				my syncTaskToJira(_task, entry)
			end if
		end repeat
		
		set subs to child tasks of _task
		if subs is not missing value then
			repeat with i from 1 to the count of subs
				my handleTask(item i of subs)
			end repeat
		end if
	end using terms from
end handleTask

tell application "OmniPlan"
	set _window to front window
	set _document to document of _window
	set _project to project of my _document
	set _tasks to tasks of _project
	set selTasks to selected tasks of front window
	
	
	repeat with i from 1 to the count of selTasks
		my handleTask(item i of selTasks)
	end repeat
end tell

Seems that when the application is open and tasks are selected, script is getting data correctly, but I am not capable to connect to Jira.

Has anybody tried this script with success? Do you know if a particular permission is needed in Jira or any feature installed?

My knowledge with Applescript is limited, so any assistance regarding this matter will be really appreciated. Many thanks for your time.

I haven’t tried connecting a jira server with AppleScript, so I can only ask the simplest question… Have you customized all of these variables for your actual script?
(at the top of the script)

  • login
  • passwd
  • jiraProject
  • jiraReporter

(in the syncTaskToJira method)

(Obviously you won’t want to post that version of the script here, since then we could all log in to your jira server!)

Many thanks for your reply. Of course I have entered the real data of my Jira instance: login, password, jiraProject and also the correct URL.

For making things simple, I have just created a new cloud Jira instance, will full admin permissions. After changing all data, I am not capable to connect to this new Jira instance. No error message, no connection.

Trying to obtain the correct URL to use, I have found this document: https://developer.atlassian.com/jiradev/latest-updates/soap-and-xml-rpc-api-deprecation-notice

JIRA’s SOAP and XML-RPC remote APIs were removed in JIRA 7.0 for Server.

Nice to know…

Please, can someone let me know which URL do I have to call from Omniplan? Am I missing something?

Many, many thanks for your time. :-)

You need to make sure that the Restful API is accessible in your JIRA installation, and then you should be able to use it just fine.