Posts tagged "livecycle"

Required Digital Signatures in LiveCycle form

Description:
Recently, I had a project in which a form was being routed to three people in a serial fashion. However, prior to submitting the form we wanted to test whether the current user had signed the form in his/her designated spot. In order for the digital signatures to remain valid we could not make adjustments to the XML Schema and then use the RenderForm activity in LiveCycle– signatures would have been broken. So we had to put all the code to handle this in the form.

Situation:
There are three roles, Employee, Supervisor, and Reviewer. The form is routed through a LiveCycle process in that order. The Supervisor and Reviewer can either Approve or Decline the form. If the form is Declined it gets routed back to the Employee.

Setting up the form:

  • Add a Text Field, name it requiredSignature, and set its presence to Invisible and set its value to “Employee”
  • Add 3 digital signature fields and named them: employeeSignature, supervisorSignature, and reviewerSignature
  • Put the Approve/Decline option as a drop-down list into the form instead of in Workspace User Action so we did not have to depend on the AWS_ACTION drop down and Form Bridge because we are submitting as a PDF due to the digital signatures, everything is self-contained in the form.
  • The bottom of the form looks like this:

    Three Digital Signatures

    Three Digital Signatures

 

Code:

Three things you should know about the following code:

  1. signatureValidate returns:
    -1 — Not a signature field
    0 — Signature is blank
    1 — Unknown status
    2 — Signature is invalid
    3 — Signature of document is valid, identity of signer could not be verified
    4 — Signature of document is valid and identity of signer is valid.
  2. event.target.getField() you must include [0] in order target the designated field.
  3. [signatureField].mandatory makes that signatureField required prior to submit; [signatureField].disabled makes that signatureField no longer required in order to submit the form.

To be placed on the in the preSubmit Event for the form:

if (requiredSignature.rawValue==”Employee”){

var oState = event.target.getField(“employeeSignature[0]“).signatureValidate();

if (oState > 3){

employeeSignature.mandatory = “disabled”;
requiredSignature.rawValue=”Supervisor”;

}
else{

employeeSignature.mandatory = “error”;

}

}

else if (requiredSignature.rawValue==”Supervisor”){

var oState = event.target.getField(“supervisorSignature[0]“).signatureValidate();

if (oState > 3){

supervisorSignature.mandatory = “disabled”;
requiredSignature.rawValue=”Reviewer”;

}
else{

supervisorSignature.mandatory = “error”;

}

}else if(requiredSignature.rawValue==”Reviewer”){

var oState = event.target.getField(“reviewerSignature[0]“).signatureValidate();
if (oState > 3){

reviewerSignature.mandatory = “disabled”;

}

else{

reviewerSignature.mandatory = “error”;

}

}

else if(requiredSignature.rawValue==”Decline”){

requiredSignature.rawValue=”Employee”;

}

 

On the Supervisor Approve/Decline Drop-down list add the following code to the exit Event:

var oState = event.target.getField(employeeSignature[0]“).signatureValidate();

if(this.rawValue == “Approve”){

if (requiredSignature.rawValue==”Supervisor”){
//do nothing


}

else if(requiredSignature.rawValue==”Decline”){

requiredSignature.rawValue=”Supervisor”;

if (oState > 3){

supervisorSignature.mandatory = “error”;

}

supervisorSignature.presence = “visible”;
supervisorSignatureDate.presence = “visible”;

}

}

else{

if (requiredSignature.rawValue==”Supervisor”){

if (oState > 3)
{

requiredSignature.rawValue=”Decline”;

}
supervisorSignature.mandatory = “disabled”;

}

supervisorSignature.presence = “hidden”;
supervisorSignatureDate.presence = “hidden”;

}

 

Result:

If an Employee attempts to Submit the form without signing the form, he/she will get the following Error Message:

Employee Signature Error Message

Employee Signature Error Message

Setting Up Windows Service Dependencies – Oracle XE Example

Did you ever need a Windows service to startup, but only after other services are running? The LiveCycle Turnkey installation creates a dependency so that MySQL starts before JBoss. What if your application requires another DB such as Oracle XE to be running first?

Unfortunately, Oracle XE does not install this dependency, so that if you setup the Oracle XE DB to automatically start (the default installation), everything will be running, but you can’t access the XE DB. This can happen when the DB starts up before the TNS Listener, so that the TNS Listener doesn’t realize there’s a database running.

This Knowledge Base Article from Microsoft http://support.microsoft.com/kb/193888 describes how to do setup these dependencies, but the text does not match up with what I see in Windows 2003 EE R2, so I have attached some screen shots.

  1. Start->Run->regedit
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OracleServiceXE (swap OracleServiceXE for your service)
  3. Create a new Multi-String Value, by right-clicking on the background in the folder’s contents
    create_multi-string_value.png
  4. Change the name of the value to “DependOnService”
  5. Edit the value (right-click and select modify) and add the services that should be started before this one. You need to enter the service name exactly as it appears in the Windows Services application. For Oracle XE, it is the “OracleXETNSListener” service.
    edit_value.png
  6. Click OK
    change_multi-string_value_name.png
    View larger image.
  7. Verify that it was updated properly by checking the service properties
    service_properties.png

    service_dependencies.png