Can't Mark Complete Tasks with error Can't set reference - Access not allowed
jmstacey opened this issue · 2 comments
jmstacey commented
The script crashes when trying to mark an OF task completed that's been resolved in Jira. The debug output:
JOFSYNC.mark_resolved_jira_tickets_as_complete_in_omnifocus: resolution: {"self"=>"https://jira.corp/rest/api/2/resolution/10100", "id"=>"10100", "description"=>"Work has been completed on this issue.", "name"=>"Done"}
JOFSYNC.mark_resolved_jira_tickets_as_complete_in_omnifocus: resolution was non-nil, so marking this Task as completed.
Exception `Send::EventError' at /Users/jostacey/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-17/2.1.0-static/rb-scpt-1.0.2/_aem/send.rb:87 - EventError
OSERROR: -10003
MESSAGE: Can't set reference to given value. Access not allowed.
Exception `NoMethodError' at /Users/jostacey/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-17/2.1.0-static/rb-scpt-1.0.2/_aem/aemreference.rb:747 - undefined method `AEM_resolve' for AEM::AEType.new("FCit"):TypeWrappers::AEType
Exception `NilClass' at /Users/jostacey/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-17/2.1.0-static/rb-scpt-1.0.2/rb-scpt.rb:542 - CommandError
OSERROR: -10003
MESSAGE: Can't set reference to given value. Access not allowed.
OFFENDING OBJECT: app("/Applications/OmniFocus.app").AS_new_reference(AEM::AEType.new("FCit").property("FCcd"))
EXPECTED TYPE: :anything
COMMAND: app("/Applications/OmniFocus.app").default_document.tasks.ID("iFNqju48gpB").completed.set(true)
OmniFocus 2.12.2
jmstacey commented
Initial result looks like a recent version of OmniFocus has changed the semantics of completing a task.
Change task.completed.set(true)
to task.mark_complete()
seems to get it working again.
devondragon commented
Good catch! I will update the code. Thank you!