It's all about the answers!

Ask a question

how to set the value of the Constraint Type of a workitem creating programatically using Plain Java API RTC


lakshmi jyothsna (37118) | asked Apr 01 '20, 6:29 a.m.
Hi Everyone,

We have a requirement to create a work item using plain java api programmatically. I tried to set the values of the attribute Constraint Type as similar way of setting the values of Priority and severity.But it didnt work for me.
please help me .


IWorkItemClient workItemCommon = (IWorkItemClient)rtcRepository.getClientLibrary(IWorkItemClient.class);
       
        IEnumeration enumeration= workItemCommon.resolveEnumeration(attribute, nullProgressMonitor);
        List<ILiteral> enumList =    enumeration.getEnumerationLiterals();
        for(ILiteral lit: enumList) {
            System.out.println("litername>>>"+lit.getName());
            if(lit.getName().equalsIgnoreCase(literalName)) {
        
            return lit.getIdentifier2();

finally i set the returned identifier to the workitem Constraint Type Attribute

Thanks in advance!!!

Accepted answer


permanent link
Ralph Schoon (63.3k33646) | answered Apr 01 '20, 10:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The Constraint Type is an enumeration and can be set as such. I tried with the Work Item command Line ad it works just fine. Note that for any value other than asap, you have to also set the timestamp for the constraint date.

lakshmi jyothsna selected this answer as the correct answer

Comments
lakshmi jyothsna commented Apr 02 '20, 12:42 a.m.

Thanks alot Raplph. 


lakshmi jyothsna commented Apr 02 '20, 12:46 a.m.

 Hi Ralph,


We didnt know this :
Note that for any value other than asap, you have to also set the timestamp for the constraint date. 

its very useful to me


Ralph Schoon commented Apr 02 '20, 2:12 a.m. | edited Apr 02 '20, 2:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Why would you not know this? Certainly you would have looked into how the UI works with the data, before you looked at the API, wouldn't you?

Try to set a no later than and not provide a data and save. Error. I would imagine that the error in the API during save would also hint the missing date. Yes, the errors can sometimes be a bit mysterious, but all in all they usually make sense and hint what the issue is.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.