• Anonymous
  • Login
  • Register
RealWorkFlow - Feature Request: Request for 'approved by' field


Hi Phillip,

Basically, what I am looking for is the ability to write the name of the person who approved the stage that the workflow document is at.

I did add some code to my source. The only part I'm questioning is whether or not cycling through all of the States is necessary. Here is the code that I added:

<b>State.java</b>

final static String APPROVED_BY_FIELD = "rwfApprovedByField";

/**
* Return the value in the Approved By field associated with the state
* This method will return the value in the Approved By field. The intent of the field
* is to essentially be used to write the name of the person who approved the current state
* @return The field value from the state
*/
public String getApprovedByField()
{
try
{
if (stateDoc.hasItem(State.APPROVED_BY_FIELD))
{
return stateDoc.getItemValueString(State.APPROVED_BY_FIELD);
}
}catch(NotesException e){e.printStackTrace();}
return null;
}

<b>Approver.java</b>

/**
* Set the name of the current approver in the context document
* The value of the approvedByField can be taken from an existing State document
* and the State class has a method specifically for returning this value.
*
* @param approvedByField The field to set on the underlying context document
*/
public void setApprovedByField(String approvedByField)
{
try
{
String n = ses.getUserName();
/// grab the username from the REMOTE_USER cgi variable for web apps.
if(doc.hasItem("REMOTE_USER") && doc.getItemValueString("REMOTE_USER") != null){
n = doc.getItemValueString("REMOTE_USER");
if(doc.getItemValueString("REMOTE_USER").trim().equals("")){n = "Anonymous";}
}
else
{
// we want the name to look nice, so write the abbreviated
// version
Name currentUser = ses.createName(n);
n = currentUser.getAbbreviated();
}
doc.replaceItemValue(approvedByField, n);
}
catch (NotesException e)
{
}
}

<b>WorkflowDocument.java</b>

/**
* Set the approved by field for the workflow document
*/
public void setApprovedBy()
{
// Note: I'm a little unsure about the cycling through the States - Eric
for(Iterator it=states.iterator(); it.hasNext(); )
{
State s = (State)it.next();
String approvedByField = s.getApprovedByField();

approver.setApprovedByField(approvedByField);
}
}

And one modification to the processContextDoc method:
WorkflowDocument wfd = new WorkflowDocument(doc);
boolean save = false;
if(wfd.runValidation()){
if(wfd.hasChangedStatus()){
wfd.setApprovers();
wfd.setAuthors();
wfd.setReaders();
wfd.sendMail();
wfd.setHistory();
wfd.setApprovedBy(); // <-- I added this part
}

Of course, finally you need to modify the State document to include a field with the name "rwfApprovedByField".

Thanks,
Eric



Taken Actions by Owners

No actions have been taken yet.


Documents
In this field you can enter the actual request.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.
In this field owners can describe what they have done or want to do.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.