Print  
Gray star Gray star Gray star Gray star Gray star --Not rated--
281 Visits 5 Comments
Created
Gary S Ribar Gary S Ribar
Kablink Component
  • Teaming

I need to add some conditionality to some workflow changes.  In some cases this means requiring certain fields (custom attributes) to be filled out before an entry can be moved into a certain workflow state. (For example, you have to indicate a lead engineer before you can move an activity to In Progress but that field isn't required in earlier stages.) In other cases it may be checking the value of a field (e.g. you can't have a due date before today before you go to in progress).  In SiteScape Forum, I would implement these restrictions by creating a copy of docshare_showentry_support.html in my forum and adding javascript to the workflow change functions.

What do you recommend as the best way to accomplish this kind of thing in Teaming?

Workflow
Process State Action
Discussion workflow Active
This entry is currently active
Attachments(0)
Entry History
Tags
 
Replies
Thumbnail Image
Jan Hendrik Silligmann Jan Hendrik Silligmann
Modified by
Jan Hendrik Silligmann Jan Hendrik Silligmann
Aug 12, 2010 11:59 AM

Display the custom attribute fields with a JSP. At least the check for required fields would work.

 

 

<c:forEach var="workflow" items="${ssDefinitionEntry.workflowStates}">

<c:choose>

<c:when test="${workflow.state == '<YourSpecialWorkflowState.Name>' }">

<div class="ss_entryContent">

<div class="ss_labelAbove">

${property_caption}

<span class="ss_required" title="The &quot;${property_caption}&quot; field must be filled in" id="ss_required_${property_name}">*</span>

</div>

<input type="text" id="${property_name}" value="${ssDefinitionEntry.customAttributes[property_name].value}" maxlength="30" size="30" name="${property_name}" class="ss_text"  />

</div>

</c:when>

<c:otherwise>

<div class="ss_entryContent">

<div class="ss_labelAbove">${property_caption}</div>

${ssDefinitionEntry.customAttributes[property_name].value}

</div>

</c:otherwise>

</c:choose>

</c:forEach>

 

EDIT: works fine with text-inputs, others may be difficult.

Thumbnail Image
Peter Hurley (Novell) Peter Hurley (Novell)

I can't think of an easy way to do that in the JSPs without modifying the standard JSPs (view_entry_workflow.jsp). You could do this an a workflow call-out. This is where you write some java code and attach it to the workflow state. It can get called on entry into or exit from any state. Using this technique, you can do your modifications before the state gets changed.

Thumbnail Image
Jan Hendrik Silligmann Jan Hendrik Silligmann

I think the problem with workflow call-outs is that they don't alert the user right away. Some sort of onBlur-Javascript like this might work better for the "due date-problem".

btw, you can check almost any required field (e.g. an autocomplete-field) with the following jsp:

 

<%@ include file="/WEB-INF/jsp/definition_elements/init.jsp" %>
<c:forEach var="workflow" items="${ssDefinitionEntry.workflowStates}">
<c:choose>
<c:when test="${workflow.state == '<name of you workflow-state>' }">
<span class="ss_required" title="The &quot;<field caption>&quot; field must be filled in" id="ss_required_<field name>"></span>
</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
</c:forEach>

Just replace the bold parts and the field will be in the list of required fields. You can put the jsp anywhere on your form.
This is how it works: in the ss_common.js is a function called "ss_checkForRequiresFields(obj)" which checks our form for <span>-elements of class "ss_required". The rest should be clear by now.

 

Thumbnail Image
Gary S Ribar Gary S Ribar

I agree that I want to avoid the server round-trip, if at all possible.  I also what to do this is a view state so that it is required before moving it to a new state.  Making it a required field in the state before wouldn't work because there may be multiple people who need to modify the form before it is ready to move on.

Given all this my thought is to make a minimal modification to the view_entry_workflow.jsp that changes the submission form for the workflow to call a onsubmit routine.  I would then stub that routine in the view_entry_workflow.jsp and included in it a call to another routine that I would include in my custom jsp.    I would wrap that stub routine in a try so I wouldn't throw errors if the routine in the custom jsp isn't there.  I do realize that this would impact upgrade survivability but I will just have to stay aware of that.

Thanks

Thumbnail Image
Peter Hurley (Novell) Peter Hurley (Novell)

Server round trips aren't as important as they were in SiteScape Forum. We do all of our dynamic (Ajax) pages by going to the server. It is fast, and doesn't put noticeable load on the system.

Skip Footer Toolbar