It's all about the answers!

Ask a question

Synchronize attributes only mentioned attribute


kavita herur (5876894) | asked Apr 10 '14, 7:52 a.m.

Hi All,

 I have few doubts on "Synchronize Attributes" I have gone through link

http://rsjazz.wordpress.com/2012/11/19/using-an-expression-to-synchronize-attributes-for-work-items-of-a-specific-type/

 I have 4.0.5  client and  4.0.5 server

1. There are many slave project area how to update all work ticktes(closed and open) in all project area.

2. There are huge amount of data So I don't thing "Synchronize attribute" from query result will help.

3. there are 3-4 new attributes are added currently but I want to sync only one attribute.

Thanks in advance.

Kavita

2 answers



permanent link
Abraham Sweiss (2.4k1331) | answered Apr 10 '14, 2:46 p.m.
Hello Kavita,

1. A seperate query will need to be run against each project area
2. DOn't know the answer, but would suggest doing a test to validate your assumption
3. My understanding is that the sync is an all or none operation

Comments
kavita herur commented Apr 11 '14, 4:14 a.m.

Thanks for quick responce. I am more concerned about Query:3 "there are 3-4 new attributes are added currently but I want to sync only one attribute"

So I cant sync one attribute by stand alone script  also as mentioned by Ralph above. There is no respective API?

Thanks,

Kavita


permanent link
Ralph Schoon (63.5k33646) | answered Apr 11 '14, 4:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Kevita,

I think Abraham is right. Synchronize attributes will always add all new attributes. So you can't use that.
But you can use the API to just add the one attribute you want. The API you can use is IWorkItem.addCustomAttribute. The code looks like:

if (!workItem.hasCustomAttribute(customInteger)
		&& fCreateAttributesIfMissing) {
	// If not defined in the process template it has to be
	// manually created
	workItem.addCustomAttribute(customInteger);
}
if (workItem.hasCustomAttribute(customInteger))
	workItem.setValue(customInteger, fCustomInteger);

You can use this in an operation similar to synchronize attributes in my blog post.

Comments
kavita herur commented May 12 '14, 8:03 a.m.

Hi  Ralph,
I am doing in similar manner but still getting error at addCustomAttribute statement. I added that attribute in project area and to respective work item Type manulay. this code has to add this attribute to old WTs
if(workItem.hasCustomAttribute(attributeHandle)){
      temp = "Has attribute";
    }else{
        try {
         copyManager.connect((IWorkItemHandle)workItem.getItemHandle(),IWorkItem.FULL_PROFILE,mine);
         WorkItemWorkingCopy wc = copyManager.getWorkingCopy(workItem);                   
         ((IWorkItem) wc).addCustomAttribute(attributeHandle);         
         } catch(Exception e) {
Please let  me know where  I am making mistake.


Thanks,
Kavita


Ralph Schoon commented May 12 '14, 8:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't see the wc.save operation.

Also be aware that hsi does not add the attribute to the process description. You have to add the attribute there before you do this, otherwise it will not show up in the process.

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.