Representing the Workflow as diagram in RTC WI. (version 4.0)
We would like to represent the workflow of the WI in a separate tab in the workitem. We have referred to the steps stated in the link: http://jazzpractices.wordpress.com/2013/01/29/what-state-are-you-in-and-where-can-you-go/
and tried to implement the same in a script based default value and attribute of type large html but we are not able achieve the same.
Please find below the script file
*****************************************
dojo.provide("com.acme.providers.script.WorkflowStateScriptedCalculatedValue2");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var doDebug = true;
var scriptname = "WorkflowStateScriptedCalculatedValue2";
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.acme.providers.script.WorkflowStateScriptedCalculatedValue", null, {
getValue: function(attribute, workItem, configuration) {
debug("Start");
var workFlowState = workItem.getValue(WorkItemAttributes.STATE);
debug("WorkflowState: " + workFlowState);
// Adjust attachment numbers in the code below
return "{{https://smtcal0004.rd.corpintra.net:9443/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/112|New}}";
function debug(display){
if(doDebug){
console.log(scriptname + " " + display);
}
}
}
});
})();
**************************************
Kindly let us know where are going wrong. Thanks in advance.
Sandeep Rao.
and tried to implement the same in a script based default value and attribute of type large html but we are not able achieve the same.
Please find below the script file
*****************************************
dojo.provide("com.acme.providers.script.WorkflowStateScriptedCalculatedValue2");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var doDebug = true;
var scriptname = "WorkflowStateScriptedCalculatedValue2";
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.acme.providers.script.WorkflowStateScriptedCalculatedValue", null, {
getValue: function(attribute, workItem, configuration) {
debug("Start");
var workFlowState = workItem.getValue(WorkItemAttributes.STATE);
debug("WorkflowState: " + workFlowState);
// Adjust attachment numbers in the code below
return "{{https://smtcal0004.rd.corpintra.net:9443/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/112|New}}";
function debug(display){
if(doDebug){
console.log(scriptname + " " + display);
}
}
}
});
})();
**************************************
Kindly let us know where are going wrong. Thanks in advance.
Sandeep Rao.
Accepted answer
As described in https://jazz.net/library/article/1093 Lab 5, there are several limitations. You have to use a Wiki Type attribute. You have to upload the attachments to a work item to make the preview work. You also have to make sure to get the right attachment ID to create the link.
5 other answers
Hello Marie,
If you are trying to achieve you business requirement by storing the workflow Images externally, then you should host those images as an URI not an URL(All the images stored in a RTC Workitem are of URI format).
Also the Server in which you are hosting the image should expose a Public URI(No authentication mechanism should be present). if not then they will be rendered as broken link in the wiki attribute.
Hope that helps!
Thanks
Abhishek
Comments
showing 5 of 11
show 6 more comments
Hi Sandeep,
I tried to reproduce the same , below are the steps I followed.
1.Create an attribute field in task WI called "Workflow" with type as Large HTML
2. Create a "default value" in attribute customization as "script based value"
3. Added the script for the attribute and also added the same in the presentation
4. Added the attachement link as mentioned
https://hostname:9443/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/142
I don't see the image rendering as well. You might want to check the script again. I will come back with my findings by modifying the same.
Thanks
Vishnu M
I tried to reproduce the same , below are the steps I followed.
1.Create an attribute field in task WI called "Workflow" with type as Large HTML
2. Create a "default value" in attribute customization as "script based value"
3. Added the script for the attribute and also added the same in the presentation
4. Added the attachement link as mentioned
https://hostname:9443/ccm/service/com.ibm.team.workitem.common.internal.rest.IAttachmentRestService/itemName/com.ibm.team.workitem.Attachment/142
I don't see the image rendering as well. You might want to check the script again. I will come back with my findings by modifying the same.
Thanks
Vishnu M
Comments
Hello All,
I succeeded in this scenario, but as I would like to implement it in a process template for multiple project area, and then exporting it in another RTC installation, I don't want to store the pictures in a workitem attachment. I would prefer using project area attachment or external resource (that we can access with a URL), so that it is not mandatory to modify the link after importing the process template.
But it doesn't work.
If I try the first idea, I can't find a way to access the project area attachments.
If I try to access to a picture stored externally, it only displays a link, not the picture directly.
For example, I use the following "wiki code" : {{http://myserver/v01/State_0_Initiate.png|New}}
How can I do to display external images in a wiki attribute ?
Do you have another solution for my problem ?
Thank you for your help,
I succeeded in this scenario, but as I would like to implement it in a process template for multiple project area, and then exporting it in another RTC installation, I don't want to store the pictures in a workitem attachment. I would prefer using project area attachment or external resource (that we can access with a URL), so that it is not mandatory to modify the link after importing the process template.
But it doesn't work.
If I try the first idea, I can't find a way to access the project area attachments.
If I try to access to a picture stored externally, it only displays a link, not the picture directly.
For example, I use the following "wiki code" : {{http://myserver/v01/State_0_Initiate.png|New}}
How can I do to display external images in a wiki attribute ?
Do you have another solution for my problem ?
Thank you for your help,
Comments
Hello Marie,
When you are Hosting the Image on the External application you need to make sure that the application exposes the image a Rest Service
the syntax will be as follows using JAX-RS packages:
@Path("/image")
public class ImageService {
private static final String yourImagePath = "Image Path";
@Produces("image/png")
public Response getFile() {
File file = new File(yourImagePath);
ResponseBuilder response = Response.ok((Object) file);
response.header("Content-Disposition", "attachment; filename=image_from_server.png");
return response.build();
}
}
So when you implement this logic in you external application where you would be storing the image,the URI to the image will be: https://yourservername/applicationname/image/get
Hope this Helps.
Regards,
Abhishek
Hello Abhishek,
Really thank you for the precision. It's really clearer for me now.
Today, my images are stored on a folder on an IIS web server with a WebSphere Platform.
I'm not administrator of this server and I'm not used to it.
But I'll discuss with my admin to see how we could implement that.
I'll suggest him to use this link : http://www.ibm.com/developerworks/websphere/techjournal/1305_gunderson/1305_gunderson.html
And we'll see.
Thank you for your help!
Regards,
Marie
Really thank you for the precision. It's really clearer for me now.
Today, my images are stored on a folder on an IIS web server with a WebSphere Platform.
I'm not administrator of this server and I'm not used to it.
But I'll discuss with my admin to see how we could implement that.
I'll suggest him to use this link : http://www.ibm.com/developerworks/websphere/techjournal/1305_gunderson/1305_gunderson.html
And we'll see.
Thank you for your help!
Regards,
Marie
Comments
sam detweiler
Dec 16 '13, 6:16 a.m.sandeep rao
Dec 16 '13, 6:32 a.m.sam detweiler
Dec 16 '13, 7:03 a.m.sandeep rao
Dec 16 '13, 7:11 a.m.