Valid workitem check

Description
CoJeff
Posts: 6
Joined: Tue Feb 16, 2016 6:18 pm

Valid workitem check

Postby CoJeff » Tue Sep 10, 2019 6:33 pm

I'm trying to use a saveworkitem script that will set a custom field based on a status. All of that is working except when a workitem ID is used that doesn't exist. If the script encounters a invalid workitem ID it exits and polarion gets an error log entry. I'm not very good at APIs and I've tried trackerService.findWorkItem(projectId, item) but the script still exits.

What would be a good way to verify that an ID exists before I try to do anything with it?

Thanks for any help.

~jeff

CoJeff
Posts: 6
Joined: Tue Feb 16, 2016 6:18 pm

Re: Valid workitem check

Postby CoJeff » Tue Sep 10, 2019 8:31 pm

I did finally try a try-catch block that seemed to do the trick. I still would like to know if there is a way to check if an ID is valid.

Jürgen
Posts: 86
Joined: Tue Sep 12, 2017 1:02 pm

Re: Valid workitem check

Postby Jürgen » Mon Sep 16, 2019 10:01 am

The class IObject has a method "isUnresolvable()" that can be used for a work item as well.

rushirathi
Posts: 1
Joined: Thu Sep 19, 2019 5:49 am

Re: Valid workitem check

Postby rushirathi » Thu Sep 19, 2019 6:02 am

Thanks for the information.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 8 guests