Using Case Field Values to Assign Tasks to Respective Teams

Let us consider the scenario where you want to assign tasks to a specific team based on the field value of a case record. For example, a user want to assign a task to Team A based on the value for a field called Zone. This article helps you achieve that objective.


      Following assumptions are made to explain this use case:

  • The case object has a field Zone that contains the zone information.
  • The user has created teams based on the Zone values.

Basic Flow

  1. When the end user creates a case, the zone details are captured as part of the record.
  2. A task is created for the associated case.
  3. Invoke the attached class from "Business rules update event rules".
  4. Whenever we update the task, if the value of the Zone field for the case and the team name matches, the task is assigned to the respective team and the task zone is also updated by the system.



import com.platform.api.*;

public class UpdateZone
    public void updateFindingZoneInTask(Parameters params)throws Exception
      String taskId = params.get("id");
      String caseInfo = params.get("related_to");
      String caseId = caseInfo.split(":")[1];
        //Setup query to get finding details      
        String caseQuery="SELECT id,cases_zone FROM cases where id = "+caseId;
        Result queryResult = Functions.execSQL(caseQuery);
        Parameters updatedParams = Functions.getParametersInstance();
        if (queryResult.getCode() == 1) {
          ParametersIterator iterator = queryResult.getIterator();
            Parameters caseParams =;
            // this flag will help to do not execute recursive update.
            // get the fields from finding record update in the task.
            String zone= caseParams.get("cases_zone");
            updatedParams.add("task_zone", zone);
            if(zone != null && !"".equals(zone)){
              //Setup query to get the team id based on finding zone
              String query="SELECT last_name, user_type, id FROM USER where last_name='"+zone+"' AND user_type='O'";
              Result teamResult = Functions.execSQL(query);
              if(teamResult.getCode() == 1){
                ParametersIterator teamIterator = teamResult.getIterator();
                Parameters teamParams =;
                String teamId=teamParams.get("id");
        Result result = Functions.updateRecord("tasks", taskId, updatedParams);
        if(result.getCode() == 0)
"Finding fields updated successfully in the TASK \n"
                      + result.getMessage(), "Update");
          String msg = "Error in updating finding fields.";
 + ":\n" + result.getMessage(), "Update");
          Functions.throwError(msg + ".");
      catch(Exception e)