Skip Headers

Agile Product Lifecycle Management SDK Developer Guide - Using APIs Release 9.3.3 E39307-01 |
| Contents

Previous | Next |

# 16 Managing and Tracking Quality

The Agile PLM system provides tools that allow companies to track and manage the following quality-related items:

- customer complaints

- product and manufacturing quality issues

- enhancement and corrective action requests

The corrective action process in the Agile PLM system is flexible and can be implemented in many different ways. For example, one way to customize the Agile PLM system is to use the Agile API to integrate the system with a Customer Relationship Management (CRM) system.

## 16.1 Quality-Related API Objects

The Agile API includes the following new interfaces:

- ICustomer - interface for the Customer class. A customer is anyone that uses a company's product(s). In some Agile PLM implementations, customers and problem reports will be imported directly from Customer Relationship Management (CRM) systems.

- IServiceRequest - interface for the ServiceRequest class. IServiceRequest is a subinterface of IRoutable; it lets you create two types of service requests, problem reports and nonconformance reports (NCRs).

- IQualityChangeRequest - interface for the QualityChangeRequest class, which is similar to an ECR and other types of change requests. It represents a closed loop Workflow process that addresses quality problems. Audit and CAPA (Corrective Action/Preventive Action) are subclasses of QualityChangeRequest.

## 16.2 Quality-Related Roles and Privileges

To create, view, and modify problem reports, NCRs, CAPAs, and Audits, you must have the appropriate privileges. The Agile PLM system has two default user roles that provide users with privileges to work with these quality-related objects:

- Quality Analyst - role for users who manage problem reports, and NCRs.

- Quality Administrator - role for users who manage audits and CAPAs.

For more information about roles and privileges, refer to the Agile PLM Administrator Guide.

## 16.3 Working with Customers

This section describes how to create, load, and save ICustomer objects.

### 16.3.1 About Customers

The ICustomer object stores contact information about a customer. What role does a customer have in the Agile PLM system? Customers provide feedback on your company's products, alerting you to quality issues or problems they encounter.

This object can originate in another system, such as a CRM system. You can use the Agile API to import customer data and problem reports from CRM systems into the Agile PLM system.

### 16.3.2 Creating a Customer

To create a customer, use the IAgileSession.createObject() method. At a minimum, you should specify values for the General Info.Customer Name and General Info.Customer Number attributes.

Example: Creating a customer

    try {
    //Create a Map object to store parameters

Map params = new HashMap();

    //Initialize the params object
    // Load a customer by specifying a CustomerNumber

params.put(CustomerConstants.ATT_GENERAL_INFO_CUSTOMER_NUMBER, "CUST00006");

params.put(CustomerConstants.ATT_GENERAL_INFO_CUSTOMER_NAME, "Western Widgets");

    //Create a new customer

ICustomer cust1 = (ICustomer)m_session.createObject(CustomerConstants.CLASS_CUSTOMER, params);

} catch (APIException ex) {

System.out.println(ex);

}

### 16.3.3 Loading a Customer

To load a customer, use the IAgileSession.getObject() method. To uniquely identify a customer, specify the value for the General Info | Customer Number attribute.

Example: Loading a customer

    try {

ICustomer cust = (ICustomer)m_session.getObject(ICustomer.OBJECT_TYPE, "CUST00006");

    } catch (APIException ex) {
    // Load an existing customer
    }

System.out.println(ex);

### 16.3.4 Saving a Customer as Another Customer

To save a customer as another customer, use the IDataObject.saveAs() method, which has the following syntax:

public IAgileObject saveAs(java.lang.Object type, java.lang.Object params)

For the params parameter, specify the General Info | Customer Name and General Info | Customer Number attributes.

Example: Saving a customer to another customer

    try {

ICustomer cust1 = (ICustomer)m_session.getObject(ICustomer.OBJECT_TYPE, "CUST00006");

    //Create a Map object to store parameters
    public IServiceRequest createNCR(String strNum) throws APIException {
    //Initialize the params object

Map params = new HashMap();

params.put(CustomerConstants.ATT_GENERAL_INFO_CUSTOMER_NUMBER, "CUST00007");

params.put(CustomerConstants.ATT_GENERAL_INFO_CUSTOMER_NAME, "Wang Widgets");

    // Save the customer
    } catch (APIException ex) {

ICustomer cust2 = (ICustomer)cust1.saveAs(CustomerConstants.CLASS_CUSTOMER, params);

System.out.println(ex);

    }

## 16.4 Working with Product Service Requests

This section describes how to work with the two classes of Product Service Requests: Problem Reports and Nonconformance Reports

### 16.4.1 About Problem Reports

A problem report describes a problem or an issue that occurred with a product from the customer's perspective. A problem report can be submitted by a customer, sales representative, or customer service representative.

Because a problem report usually originates with a customer, it may not accurately describe the actual cause of the problem. To understand the root cause of a problem, a Quality Analyst must investigate the problem.

Problem reports can be routed for investigation. The investigating team, consisting of Quality Analysts, determines the root cause of the problem and decides whether to escalate the problem into an issue.

### 16.4.2 About Nonconformance Reports

A nonconformance report (NCR) is used to report material damages, failure modes, or defects in a product received by a customer or supplier. An NCR is typically identified when a product shipment is inspected after receipt from a supplier. A product is nonconforming if it does not meet customer requirements or specifications. Such products are generally rejected or segregated to await disposition. A nonconformance report may require that a Quality Analyst investigate the problem and determine whether corrective action is required.

NCRs can be routed for review. Typically, the review is used for additional information gathering rather than approval and rejection.

### 16.4.3 Creating a Product Service Request

To create a problem report or nonconformance report, use the IAgileSession.createObject() method. The only required attribute value you must specify is the object's number. The following example shows how to create problem reports and NCRs.

Example: Creating a problem report or NCR

    public IServiceRequest createPR(String strNum) throws APIException {

IServiceRequest pr = (IServiceRequest)m_session.createObject(

ServiceRequestConstants.CLASS_PROBLEM_REPORT, strNum); return pr;

    }

IServiceRequest ncr = (IServiceRequest)m_session.createObject(

ServiceRequestConstants.CLASS_NCR, strNum);

return ncr;

    }
    //Get the class

### 16.4.4 Assigning a Product Service Request to a Quality Analyst

To assign a problem report or NCR to a Quality Analyst, set the value for the Cover Page | Quality Analyst field, which is a list field. The available values for the list field consists of Agile PLM users. The following example shows how to set the value for the Cover Page.Quality Analyst field for a problem report or NCR.

Example: Assigning a problem report or nonconformance report

    void assignServiceRequest(IServiceRequest sr) throws APIException {
    //Set attrID equal to the Quality Analyst attribute ID

Integer attrID;

attrID = ServiceRequestConstants.ATT_COVER_PAGE_QUALITY_ANALYST;

    //Get the Cover Page.Quality Analyst cell
    //Get available list values for the list

ICell cell = sr.getCell(attrID);

IAgileList values = cell.getAvailableValues();

    //Set the value to the current user

IUser user = m_session.getCurrentUser();

values.setSelection(new Object[] { user });

cell.setValue(values);

    }

### 16.4.5 Adding Affected Items to a Product Service Request

To associate a problem report or nonconformance report with one or more items, you add items to the Affected Items table. Each Product Service Request can be associated with many items.

Note If Product Service Requests have been added to the Related PSR table, the Affected Items table cannot be modified.

Example: Adding an affected item to a Product Service Request

    void addAffectedItem(IServiceRequest sr, String strItemNum) throws APIException {

IAgileClass cls = sr.getAgileClass();

    //Attribute variable
    //Get the Related PSR table
    //Get the Affected Items table

IAttribute attr = null;

ITable affItems = sr.getTable(ServiceRequestConstants.TABLE_AFFECTEDITEMS);

    //Create a HashMap to store parameters
    //Set the Item Number value

HashMap params = new HashMap();

params.put(ServiceRequestConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER, strItemNum);

    //Set the Latest Change value

attr = cls.getAttribute(ServiceRequestConstants.ATT_AFFECTED_ITEMS_LATEST_CHANGE);

IAgileList listvalues = attr.getAvailableValues();

listvalues.setSelection(new Object[] { new Integer(0)});

params.put(ServiceRequestConstants.ATT_AFFECTED_ITEMS_LATEST_CHANGE, listvalues);

    //Set the Affected Site value

attr = cls.getAttribute(ServiceRequestConstants.ATT_AFFECTED_ITEMS_AFFECTED_SITE);

IAgileList listvalues = attr.getAvailableValues();

listvalues.setSelection((new Object[] { "Hong Kong" });

params.put(ServiceRequestConstants.ATT_AFFECTED_ITEMS_AFFECTED_SITE, listvalues);

    //Create a new row in the Affected Items table
    }

IRow row = affItems.createRow(params);

### 16.4.6 Adding Related PSRs to a Product Service Request

A Product Service Request can be used to aggregate multiple problem reports or NCRs into one master. To do this, create a new Product Service Request and don't add items to the Affected Items table. Instead, select the Related PSR table and add a row for each related Product Service Request. The single PSR you create is the Parent PSR. All the added PSRs on the Related PSR tab are child PSRs.

Note: SmartRules settings control whether a PSR can be associated with both affected items and related PSRs, or only affected items or related PSRs. Depending on enabling/disabling the "PSR contains Items and Related PSRs" SmartRule setting, you can enable/disable the Affected Items tab after you add Related PSRs. For information on SmartRules and PSRs, refer to Agile PLM Product Quality Management User Guide and Agile PLM Administrator Guide. The following example assumes SmartRules are set properly.

Example: Adding related PSRs to a Product Service Request

    void addRelatedPSRs(IServiceRequest sr, String[] psrNum) throws APIException {

ITable relPSR = sr.getTable(ServiceRequestConstants.TABLE_RELATEDPSR);

    //Create a HashMap to store parameters
    }
    //Add PSRs to the Related PSR table

HashMap params = new HashMap();

for (int i = 0; i < psrNum.length; i++) {

    //Set the PSR Number value
    //Create a new row in the Related PSR table

params.put(ServiceRequestConstants.ATT_RELATED_PSR_PSR_NUMBER, psrNum[i]);

IRow row = relPSR.createRow(params);

    //Reset parameters

params = null;

}

    }

## 16.5 Working with Quality Change Requests

A Quality Change Request, or QCR, allows a Quality Analyst to manage quality records that contain aggregated problems related to products, documents, suppliers, and customers. You can route the QCR for review and approval, driving the issue(s) to closure using a corrective or preventive action (CAPA). This may result in changes to a product, process, or supplier by initiating an ECO or MCO. QCRs also provide an audit trail between problems, corrective and preventive actions, and engineering changes.

Agile PLM provides two classes of Quality Change Requests:

- CAPA - Stands for Corrective Action/Preventive Action, which addresses defects that (generally) surfaced from problem reports. By the time a problem reaches the CAPA stage, the team has figured out which specific items must be fixed. Consequently, the affected item for a CAPA may be different from the affected item of its related problem report. For example, say a customer reported a problem with a DVD-ROM drive. A CAPA is initiated and the root-cause is identified to be a defect in the IDE controller. Therefore, the CAPA and its related problem report have different affected items.

- Audit - Systematic, independent and documented processes for obtaining evidence and evaluating it objectively to determine the extent to which criteria are fulfilled. Audits can be initiated against items for which no problems have been reported.

### 16.5.1 Creating a Quality Change Request

To create a QCR, use the IAgileSession.createObject() method. The only required attribute value you must specify is the object's number. The example below shows how to create both CAPA and Audit QCRs.

Example: Creating a QCR

    public IQualityChangeRequest createCAPA(String strNum) throws APIException {

IQualityChangeRequest capa = IQualityChangeRequest)m_session.createObject(

QualityChangeRequestConstants.CLASS_CAPA, strNum);return capa;

    public IQualityChangeRequest createAudit(String strNum) throws APIException {

IQualityChangeRequest audit = IQualityChangeRequest)m_session.createObject(

QualityChangeRequestConstants.CLASS_AUDIT, strNum);

return audit;

    }
    // Get the ECO class

### 16.5.2 Assigning a Quality Change Request to a Quality Administrator

To assign a QCR to a Quality Administrator, you set the value for the Cover Page | Quality Administrator field. This process is similar to the way you assign a Product Service Request to a Quality Analyst.

Example: Assigning a QCR

    void assignQCR(IQualityChangeRequest qcr) throws APIException {
    //Set attrID equal to the Quality Administrator attribute ID

Integer attrID;

attrID = QualityChangeRequestConstants.ATT_COVER_PAGE_QUALITY_ADMINISTRATOR;

    //Get the Cover Page.Quality Administrator cell
    //Get available list values for the list

ICell cell = qcr.getCell(attrID);

IAgileList values = cell.getAvailableValues();

    //Set the value to the current user

IUser user = m_session.getCurrentUser();

values.setSelection(new Object[] { user });

cell.setValue(values);

    }

### 16.5.3 Saving a Quality Change Request as a Change

You can use the IDataObject.saveAs() method to save a QCR as another QCR or as an ECO (or another type of change order). When you save a QCR as an ECO, the items affected by the QCR are not automatically transferred to the Affected Items tab of the ECO. If you want to transfer affected items from the QCR to the ECO, you must write the code in your program to provide that functionality. Workflow is a required input parameter for using saveAs()on QCRs.

Note: If you try to save a QCR to an object that is not a subclass of either the Quality Change Request or Change superclasses, the Agile API throws an exception.

Example: Saving a QCR as an ECO

    public IChange saveQCRasECO(IAgileSession session, IQualityChangeRequest qcr) throws APIException {

IAgileClass cls = m_admin.getAgileClass(ChangeConstants.CLASS_ECO);

    // Get autonumber sources for the ECO class
    // Create a problem report
    // Get Workflow for the ECO class

IAutoNumber[] numbers = cls.getAutoNumberSources();

IWorkflow ecoWf = ((IRoutableDesc)session.getAdminInstance().getAgileClass(ChangeConstants.CLASS_ECO)).getWorkflows()[0];

    // Save the QCR as an ECO

HashMap map = new HashMap();

map.put(ChangeConstants.ATT_COVER_PAGE_NUMBER, numbers[0]);

map.put(ChangeConstants.ATT_COVER_PAGE_WORKFLOW, ecoWf);

IChange eco = (IChange)qcr.saveAs(ChangeConstants.CLASS_ECO, map);

    // Add code here to copy affected items from the QCR to the ECO
    }

return eco;

## 16.6 Using Workflow Features with PSRs and QCRs

PSRs and QCRs derive all Workflow functionality from the IRoutable interface. The following table lists the Workflow commands you can use to manage product quality objects.

Feature | Equivalent API(s)
--- | ---
Audit a PSR or QCR | IRoutable.audit()
Change the status of a PSR or QCR | IRoutable.changeStatus()
Send a PSR or QCR to another user | IDataObject.send()
Approve a PSR or QCR | IRoutable.approve()
Reject a PSR or QCR | IRoutable.reject()
Comment on a PSR or QCR | IRoutable.comment()
Add or remove approvers for a PSR or QCR | IRoutable.addApprovers() IRoutable.removeApprovers()

### 16.6.1 Selecting Workflows for PSRs and QCRs

When you create a new Product Service Request or a Quality Change Request, you must select a workflow. Your Agile PLM system can have multiple workflows defined for each type of Product Service Request and Quality Change Request. To retrieve the valid workflows for an object, use IRoutable.getWorkflows(). If a Workflow has not been assigned yet, you can use IRoutable.getWorkflows() to select a workflow, as shown in the following example.

Example: Selecting a workflow

    public static IServiceRequest createPSR() throws APIException {

IAgileClass prClass = admin.getAgileClass(ServiceRequestConstants.CLASS_PROBLEM_REPORT);

IAutoNumber[] numbers = prClass.getAutoNumberSources();

IServiceRequest pr = (IServiceRequest)m_session.createObject(prClass, numbers[0]);

    // Get the current Workflow (a null object, since the Workflow has not been set yet)
    // Get all available workflows

IWorkflow wf = pr.getWorkflow();

IWorkflow[] wfs = pr.getWorkflows();

    // Set the problem report to use the first workflow

pr.setWorkflow(wfs[0]);

return pr;

    }

You can also set the Workflow for a Product Service Request or a Quality Change Request by selecting a value for the Cover Page.Workflow field, as shown in the following example.

Example: Selecting a Workflow by setting the value of the "Cover Page.Workflow" attribute

    void selectWorkflow(IServiceRequest psr) throws APIException {

    //Set nAttrID equal to the Workflow attribute ID

int nAttrID;

nAttrID = ServiceRequestConstants.ATT_COVER_PAGE_WORKFLOW;

    //Get the Workflow cell
    //Get available list values for the list

ICell cell = psr.getCell(nAttrID);

IAgileList values = cell.getAvailableValues();

    //Select the first workflow

values.setSelection(new Object[] {new Integer(0));

cell.setValue(values);

    }