Activities (EtQScript)

Example:

This formula looks up the value stored in the "Department" field. If the selected department is "Quality", then there will be two available activities for this phase. These are the Action Item activity and the Feasibility Analysis activity. Otherwise, there will be only one available activity, which is the Action Item activity. Remember to use the EtQScript Editor features.

departmentField = thisDocument.getField("DEPARTMENT")

if (departmentField != None):

 availableDeps = departmentField.getOptions()

selectedDep = departmentField.getValue()

 if (selectedDep == availableDeps["Quality"]):

  print ("CORRACT_ACTION_ITEM")

  print ("CORRACT_FEASIBILITY_ANALYSIS")

 else:

  print ("CORRACT_ACTION_ITEM")

The same example applies to return required activities for creation and required activities for completion.

Assignment Email Subject Type (EtQScript)

In this field, write an EtQScript that this method returns the text for the subject of the e-mail messages that will be sent to the assigned user(s) because of routing a document to this phase (e.g., assignment e-mail). Remember to use the EtQScript Editor features.

Example:

Write a formula that this method returns the following statement in the subject of the assignment e-mails when a Process document (in the Corrective Action application) is routed to the Initial Approval phase (see the next figure):

Assignment to Corrective Action Document Process Initial Approval #ALC-00009-SS, Dec 30, 2004

Where:

Corrective Action Document: Form name

Process: Workflow Type

Initial Approval: Forward Phase

#ALC-00009-SS: The number of the document including the prefix and suffix

Dec 30, 2004: The Due Date of the document.

print "Assignment to " + thisDocument.getDisplayName() + " " + thisPhase.getWorkflowName() + " " + thisPhase.getDisplayName() + " #" + thisDocument.getFieldText("ETQ$NUMBER") + ", " + thisDocument.getField("ETQ$DUE_DATE").getText()

Assignment Email Body Type (EtQScript)

In this field, enter an EtQScript that this method returns the text for the body of the e-mail messages that will be sent to the assigned user(s) because of routing a document to this phase. Remember to use the EtQScript Editor features.

The default script for this field is:

print "Please click link to open the document:"

Example 1:

The following script:

print "Please click here to open the document:"

This method returns the following in the Email Body:

Please click link to open the document: Corrective Action Document # ALC00134-SS

Example 2:

The following script returns:

- List of document owners.

- [DOCUMENT NUMBER] – [TITLE] has been modified and may affect:

- The related documents, with two columns, which are Document Number, and Title, in a table format.

currDoc = thisDocument

body = ""

Owner = currDoc.getField("ETQ$APPROVERS").getDisplayText()

if (Owner != ""):

 Owners = Owner.split(";")

 for Own in Owners:

  body += Own + " <br> "

  body += " <br> "

body += currDoc.getField("ETQ$NUMBER").getText()

body += " - "

body += currDoc.getFieldText("DOCWORK_TITLE")

body += " has been modified and may affect: <br><br>"

 

relatedDocLinks = currDoc.getField("DOCWORK_REFERENCE_LINKS").getDocLinks()

if (relatedDocLinks != []):

 body += "<table border=1 bordercolor=gray><tr><th>" + currDoc.getField("ETQ$NUMBER").getDisplayName() + "</th>"

 body += "<th>" + currDoc.getField("DOCWORK_TITLE").getDisplayName() + "</th></tr>"

 for relatedDocLink in relatedDocLinks:

  if (relatedDocLink.isDocumentExisting()):

   key = relatedDocLink.getDocKey()

   docs = thisApplication.getDocument(key)

   if(docs != None):

    body += "<tr><td>" + docs.getField("ETQ$NUMBER").getText() + "</td>"

    body += "<td>" + docs.getFieldText("DOCWORK_TITLE") + "</td></tr>"

   docs.close()

body += "</table><br><br>"

 

body += " Please review the modifications to determine the impact to your process document. <br>"

body += " The Link that is associated to the notification body should be a link to the related document: <br>"

print body

Assignment (EtQScript)

Use this field if you want to assign the document to certain users instead of, or in addition to, the names you select in the ‘Assignment’ field using an EtQScript. The formula may return certain user names, so the document will automatically be assigned to the returned user names in this phase. Remember to use the EtQScript Editor features.

Example 1:

The following script can be used in Phase Settings Assignment Formula, which checks the value in the Department field. If the selected value is "Administration", then the document will be assigned to Administrators. Otherwise, the document will be assigned to users in the Approver field.

departmentField = thisDocument.getField("DEPARTMENT")

if (departmentField != None):

 availableDeps = departmentField.getOptions()

 selectedDep = departmentField.getValue()

 if (selectedDep == availableDeps["Administration"]):

  print "Administrators"

 else:

  approvers = thisDocument.getFieldValues("ETQ$APPROVERS")

  if (approvers != []):

   for apr in approvers:

    print apr

Signature with solid fill For this to work correctly, we assume that the setting name (User Profile in this case) is not only composed of numeric digits. Settings are not allowed to be named using only digits..

Example 2: Filling in the Assignment field based on a Names field of a Subform

The following script can be used in the Assignment formula of the Approval phase of the Supplier Audit Plan workflow to assign the approval phase to all users/groups selected in the Lead Auditor field of the Planned Audits subform.

auditPlanSubform = thisDocument.getSubform("ETQ_AUDITS_AUDIT_PLAN_PROFILESINFO")

if auditPlanSubform != None:

 auditPlanRecords =  auditPlanSubform.getRecords()

 for rec in auditPlanRecords:

  leadAuditorID = rec.getFieldValue("ETQ_AUDITS_LEAD_AUDITOR")

  if leadAuditorID != None:

   userProfile = eccProfileManager.getUserProfile(leadAuditorID)

   assignedAuditor = userProfile.getName()

   print assignedAuditor