Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to set Contributor type field to Unassigned in Attribute Customization script?

We're trying to create a customized attribute script in Javascript where when a work item goes to a specific State, a custom field of type=Contributor will be automatically set to Unassigned.

I've done this before with UIDs for specific Team Members who should be the default value, but how would we represent Unassigned in the script rather than a specific user?


0 votes

Comments

 Hi Michael. I was never able to set contributors in scripts. Can you provide an example of your script code that does it? Have you tried to set the contributor to null?

Ralph,

I've been able to set the Owner field using scripts.  I made the assumption that since our custom field was also a Contributor type that it would work the same.

Michael,

I had tried this in 3.x, not sure which version. It never worked for me to pass the UUID in the script. But I have now verified that you can pass the UUID e.g. for a user and potentially other items (not tested that yet) and it will actually set the item.

This will go into the labs of our Process Enactment Workshop once we publish lab 5. Thanks so much for the answer which made me re-check!

No problem Ralph. You've helped us a lot, so always happy to share what we have.

I actually stored the UID in a variable in the XML source and referenced the variable in my javascript.  That way if the Owner changed we only needed to change the UID in the XML source and not modify the script.

Interesting, can you share how you read the XML file?


Accepted answer

Permanent link
I would output the value of the literal Unassigned from the specific contributor attribute to a log or console or just another string field, then use that value to be returned from the script.

for example, when I set Owner attribute to Unassigned and run
     var ownername = workItem.getValue(WorkItemAttributes.OWNER);
     return ownername;

and capture the return on a string attribute, I get
     _YNh4MOlsEdq4xpiOKg5hvA
as a value.

Now, from my script, I return this value and any Contributor attribute associated with this script gets set to Unassigned.
Michael Walker selected this answer as the correct answer

2 votes

Comments

Thanks Dinesh...I was wondering if Unassigned had a UID value.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Oct 15 '12, 5:18 p.m.

Question was seen: 6,985 times

Last updated: Apr 02 '13, 4:03 a.m.

Confirmation Cancel Confirm