It's all about the answers!

Ask a question

Whats the best way of embedding images for use with calculated values on work items


Richard Good (872861) | asked Jul 02 '15, 5:13 a.m.

The nice chaps at IBM, have created some sort of script that displays a diagram on each work item based on which state it's in and the possible routes along the work flow from there. This appears to be done by adding a special project area adding the images to that then using a URL to the diagram in that project area corresponding to the current state.

Ideally these diagrams would be part of the process template, and as we have multiple disconnected networks wanting to use the same process the address to the images would be relative rather than explicit. Wonder if you can get the page you are on using Document.URL? Any advice on writing this script in a better way, seems like it could be improved - not done much java script?

Relevant pieces of java script follow: -


         
         var workFlowState = workItem.getValue(WorkItemAttributes.STATE);
         
         // Replace <URL> with the resource URL to the image attached to a work item
         if(workFlowState=="") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/16|New}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s3") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/17|New}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s8") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/18|Submitted}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s9") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/19|Analyse}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s11") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/20|Analysed}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s10") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/21|Deferred}}";
         if(workFlowState=="com.mbda.defect.workflow.state.s12") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/22|Approved}}";
            if(workFlowState=="com.mbda.defect.workflow.state.s13") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/23|Work}}";
            if(workFlowState=="com.mbda.defect.workflow.state.s14") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/24|Implemented}}";
            if(workFlowState=="com.mbda.defect.workflow.state.s15") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/25|Verify}}";
            if(workFlowState=="com.mbda.defect.workflow.state.s16") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/26|Verified}}";
            if(workFlowState=="com.mbda.defect.workflow.state.s17") return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/27|Closed}}";
         return "{{https://theServer/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/28|Unknown State}}";

 

One answer



permanent link
Ralph Schoon (63.3k33646) | answered Jul 02 '15, 5:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
As described in the workshop
Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management
this only works if the images are uploaded as attachments to a work item. Then the provider shows the images. We have not found another place where this works. It especially did not work if we had the images uploaded as process attachment.

You could use Additional Script parameters to be able to use the same script with different URL's.

Comments
Richard Good commented Jul 02 '15, 5:33 a.m.

Thanks - looks like it's workshop day ;-)


Ralph Schoon commented Jul 02 '15, 5:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Sorry about that 8)
Some stuff is just not doable in 3 sentences, so we tried to put what we could into those workshops.

If you consider reading through or performing the Process Enactment Workshop for the Rational solution for Collaborative Lifecycle Management you want to take the one for RTC only.

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.