| Extending the Web Parts / Custom Actions |
This section provides the steps to design and configure Custom Actions in the AgilePoint Process Instance List Web Part:
The user defined custom class needs to be derived from ICustomProcessInstanceAction and needs to implement the AddCustomActions method.
Sample:
public class CustomTaskListActions : ICustomProcessInstanceAction
{
public StringBuilder AddCustomActions(StringBuilder sb, string piid, string currentUser)
{
int count = 0;
string formRenderUrl = "FormRender.aspx";
formRenderUrl = formRenderUrl + "?PIID=" + piid;
sb.Append(AddMenuItem(count.ToString(), "window.open('" + formRenderUrl + "')", "_layouts/images/edit.gif"));
return sb;
}
private string AddMenuItem(string text, string actionUrl, string imageUrl)
{
if (imageUrl == null || imageUrl == string.Empty)
{
imageUrl = "/_layouts/AP/Image/warn16.gif";
}
string menuHtml = "<ie:menuitem id=\"" + Guid.NewGuid().ToString() + "\" type=\"option\" iconSrc=\"" + imageUrl + "\" onMenuClick=\"" + actionUrl + ";\" text=\"" + text + "\" title=\"" + text + "\" menuGroupId=\"2147483647\"></ie:menuitem>";
return menuHtml;
}
}
This can be done in two ways:
For example:
<add key="CustomAgilePointTaskActions" value="SPCustomAction.CustomTaskListActions,SPCustomAction" />
Add a new item in the AgilePoint Configuration List where the Application name is CustomProcessInstanceAction and the AP Setting Value is class name, assembly name