Page tree

EWUpdate

Updates a record in your Agiloft knowledgebase.

Syntax

EWWSBaseUserObject res = ew.EWUpdate(String sessionId, String
    table,
    EWWSBaseUserObject obj);
or for the table-specific call: 
WSCase wsCase = ew.EWUpdate_WSCase(String sessionId, WSCase case); 

Usage

Use EWUpdate to update records in a table, such as Case or Contact, in your knowledgebase. The client application passes the tableName and the map with data to be applied to the record in the generic call and just the map in the table-specific call. 

The EWUpdate call is analogous to the UPDATE statement in SQL.

Rules and Guidelines

When updating records, consider the following rules and guidelines:

  • The username that was used to obtain the specified session token must have sufficient access rights to update individual records within the specified table. Please verify specific permissions via Setup > Access > Manage Groups > [Edit Group] > Table > [Select Table] > Permissions.
  • Agiloft allows specifying fine-grained access permissions on the table field level. The username that was used to obtain the specified session token must have sufficient access rights to set every field being specified in the data object supplied in the call on update of the record. Consider this if you are using the record data obtained from or just used in another call like EWRead or EWCreate - read and create permissions of a particular user may not match the updated ones. Please verify specific permissions via Setup > Access > Manage Groups > [Edit Group] > Table > [Select Table] > Field Permissions.
  • The data object must contain the identifier of the record being modified.
  • When updating the records in the table it is required to specify explicitly the type of the record. This is especially important in the case when the record is created for the true subtype, such as Contacts.Customer. In this case the table specified in the call will be "Contacts" and the type of the record will be "Customer". For the top-level subtypes the type of the record is equal to the table name. Please consult the Table Wizard for the specific names of the tables/subtypes in your knowledgebase, available via Setup > Tables and editing the relevant table. 
  • Certain fields can be defined to have default values. If permissions allow these may be overwritten by data supplied in the call.
  • A record created by another user, via API or via GUI, may have some required fields not filled as the user didn't have adequate privileges. Any required fields which do not have a value at the time of the call or a preconfigured default value must have a value supplied if they fall within the access privileges of the logged in user that is triggering the EWUpdate call.
  • The API and WSDL distinguish between an empty (null) value set explicitly and a value not set at all in the EWUpdate call - i.e. the one that should remain unchanged.
  • Fields that are present in the table directly are filled in as simple values.
  • Some environments like .NET require a special property set for simple-type fields to properly handle empty values - <name>Specified = true for .NET.
  • Agiloft allows one to establish relationships between the records in different tables via Linked Fields and ensures the data integrity once the links are forged.
  • Fields from the Linked Fields relationships that allow values not present in the donor tables are present both in the table, for the case when the value is non-source, and the linking classes, for the case when the value is truly imported and the link is forged.

Unsupported Types of Fields

Related tables and embedded search results are not supported by the SOAP interface.

Basic Steps for Updating Records

Updating records involves the following basic steps:

  1. Determine the id of the record you want to update. You may want to use the EWSelectFromTable call to get the identifiers of the records based on some search condition or get the identifier from a previous EWCreate call, or get the id of a linked record from the linking class after performing an EWRead.
  2. If you do not have it already from one of the previous calls, construct an instance of the complex type that corresponds to the table you are trying to update. Fill in the identifier and those fields that need updating.
  3. Call EWUpdate.
  4. Process the results.

Example Task

In MyKB knowledgebase, as user A, update a given case, setting the field Escalate to Support Staff to Yes (in this particular KB this triggers a round-robin assignment to the members of the Support Team). Return the name of the employee who is assigned to the case as a result. 

This task is completed by performing the following steps:

  1. Login to MyKB with "A" and "password" and English as the local language.
  2. Set the Escalate to Support Staff field to Yes.
  3. Update the record.
  4. Read the name of the assignee.
  5. Logout.

Sample Code - Java

 public String update(WSCase wsCase) {
    EWServiceAPI binding = new EWServiceAPIServiceLocator().getMyKB();
    String sessionId = binding.EWLogin("MyKB", "A", "password", "en");
    wsCase.setEscalate_To_Support_Staff(WSChoice_Yes_No.OPTION_YES);
    WSCase result = (WSCase) binding.EWUpdate(sessionId, "case", wsCase);
    WSCaseTeams_Dao3_Link3 assigneeLink = result.getDAO_Dao3_Link3();
    String assignee;
    if (assigneeLink!=null) {
    assignee = assigneeLink.getAssigned_To();
    } else {
    assignee = null;
    }
    binding.EWLogout(sessionId);
    return assignee;
    }

You can generate a sample Web Services code for any table by selecting Setup > Tables > [Edit Table] > API > Download Sample.

Arguments

Name

Type

Description

sessionId

String

Session token.

tableName

String

The name of the table where the record is to be updated - only for generic methods.

obj

EWWSBaseUserObject

The descendant of EWWSBaseUserObject - one of the complex types described in the WSDL that correspond to the tables on the Agiloft side.

Response

Updated record data as a descendant of EWWSBaseUserObject - a complex structures of the same type as the object argument.

Faults

EWSessionException - client not logged in or the session has expired; client should re-login. 

EWPermissionException - username used to create the session lacks the sufficient privileges to perform record modification. 

EWWrongDataException - data causes an index or constraint violation; key, name of problematic column and the value causing the problem as parameters. 

EWOperationException - modification operation has been blocked by an Agiloft function. 

EWIntegrityException - the specified table cannot be found or its primary key cannot be identified. 

EWUnexpectedException - an unexpected exception has happened; user should report this for investigation.