Zum Hauptinhalt springen
Version: 6.19

Scripting and REST API improvements

The following improvements to the ConSol CM API and REST API have been made.

Method to obtain the current Web Client page in scripts (#657655)

It is now possible to detect in scripts from which Web Client page they were executed. The class OperationResponseBuilder has been extended for this purpose. The following methods were added to obtain the current page:

  • client.isAtResource(): Returns true if on resource page
  • client.isAtResourceCreate(): Returns true if on resource creation page
  • client.isAtResourceSearch(): Returns true if on Resources tab of the detail search
  • client.isAtTicket(): Returns true if on case page
  • client.isAtTicketCreate(): Returns true if on case creation page
  • client.isAtTicketSearch(): Returns true if on Cases tab of the detail search
  • client.isAtUnit(): Returns true if on contact page
  • client.isAtUnitCreate(): Returns true if on contact creation page
  • client.isAtUnitSearch(): Returns true if on contact object tab of the detail search
  • client.getIsAtEntityId(): Returns the entity ID (positive for persisted entity, 0 for transient entity, –1 if unspecified).

If the API methods invoked outside a Web Client context, a warning is written to the log files.

Improved handling of initial passwords for contacts (#661318 )

The flow for granting access to CM/Track using database authentication has been improved. It is now possible to send a password set code via script, for example in scope of a contact action. The contact will receive an email with a link to set a new password. This way, it is possible to avoid setting temporary passwords which the contact has to change later on.

The method sendPasswordResetCode has been added to the class EMailPasswordResetService for this purpose.

Usage example:

security_eMailPasswordResetService.sendPasswordResetCode(unit, Locale.ENGLISH, 'track-auth-set-password-template')

The template track-auth-set-password-template is added automatically on update. The Credentials tab of the Global portal settings page of the Web Admin Suite has been extended with the setting Password set template where the new template is referenced.

URLs

The template uses the URLs defined in the system properties url.track (URL of CM/Track) and url.track.auth (URL of the authentication application of CM/Track) of the module cmas-core-server. You must either set these properties or modify the template to craft a working link.

Method to change a contact's customer group (#666446)

The ConSol CM API has been extended by a method to change the customer group of contacts. This is useful when contacts are created automatically due to an incoming email and the user detects later that they are in the wrong customer group.

The method has been added to unitService and comes with two signatures:

  • changeCustomerGroup(Unit pUnit, CustomerGroup pNewCustomerGroup): Changes the contact to the provided customer group
  • changeCustomerGroup(Unit pUnit, Unit pNewCompany, CustomerGroup pNewCustomerGroup): Only for person objects. Changes the person to the provided customer group and assigns it to the provided company.

The implementation can be done for example via a contact action which opens a form where the user can select the new customer group, and, if needed, select a new company.

The customer group can only be changed if the following conditions are met:

  • The user who performs the action needs permissions to the target customer group.
  • The contact's cases must be in queues which have the new customer group assigned.
  • The company does not have persons.
  • The contact has no contact relations.
  • If the contact has resource relations, they are valid for the new customer group.

The following changes are not possible:

  • Changing the object type from person to company or vice versa
  • Moving a company with cases to a contact data model which does not allow companies to have cases
Preconditions

If the preconditions are not met, a runtime exception is thrown which needs to be handled in the action script, for example by displaying a message that changing the customer group is not possible.

The following automatic adjustments are done:

  • If a person from a two-level model is moved to a one-level model, the company is unassigned.
  • If the contact already had credentials for CM/Track, i.e. an assigned portal profile, a username and a password, these credentials are removed when the customer group is changed.
Data fields

The values for data fields are kept if the new customer group uses the same field groups. Otherwise, you need to implement a handling for the field values in your script, e.g. by writing certain values to the fields which are applicable in the new customer group.

Contact access restrictions hardened in REST API (#668892)

The REST API endpoints /units, units/{id} and units/{id}/relations for working with contacts now strictly enforce the system property security.restrict.unit.access.to.own.data from the module cmas-core-server. When enabled, users can only retrieve contact data and create, update, or delete contact relations for their own contact and contacts belonging to their company. Access attempts to other contacts via the REST API are consistently denied. This change also affects the results of autocomplete searches.

warnung

Please check if the system property setting matches your usage of contact data via REST API.