@Override
  public String endTaskFlow() throws ServiceException {

    if (getTaskFlowData().isStandardInvocation()) {
      DataGridState<Org> dataGridState = conversation.get(DataGridState.class, ORG_SEARCH_GRID);

      List<Org> selectedOrgs = dataGridState.getSelectedItems();

      for (Org org : selectedOrgs) {

        boolean found = false;
        for (Org orgMap : getTaskFlowData().getOrgs()) {

          if (orgMap.getOrgId().equals(org.getOrgId())) {
            found = true;
            break;
          }
        }

        if (!found) {
          dataGridState.deSelectItem(org.getOrgId().toString());
        }
      }

      for (Org orgMap : getTaskFlowData().getOrgs()) {
        if (orgMap.getOrgId() != null) {
          dataGridState.selectItem(orgMap.getOrgId().toString(), orgMap);
        }
      }
    }

    return SUCCESS;
  }
  @Override
  @CoreSecured({CORE_CUSTOMER_ORGANIZATION_ACCESS})
  @Action(
      value = "details",
      results = {@Result(name = "success", location = "/org/details.jsp")})
  public String execute() throws ServiceException {
    if (org == null) {
      Org o = orgService.getById(getServiceContext(), getOrgId());

      org = o.getAsMap();

      org.put("parentOrgName", o.getParentOrgName());
    }
    if (reset) {
      contactDataGridState.getFilters().clear();
      orgPartDataGridState.getFilters().clear();
    }

    orgPartScope = scopeService.getScopeWithOrgParts(getServiceContext());

    contactByOrgItemProvider.setOrgId(getOrgId());

    orgPartItemProvider.setOrgId(getOrgId());
    orgPartItemProvider.setScopeId(getServiceContext().getScopeId());

    viewDef = configService.getViewDefinition(getServiceContext(), ViewDefTypeCode.ORG);
    contactsViewDef =
        configService.getViewDefinition(getServiceContext(), ViewDefTypeCode.CONTACT_DATAGRID);
    orgPartViewDef =
        configService.getViewDefinition(getServiceContext(), ViewDefTypeCode.ORG_PART_DATAGRID);

    return SUCCESS;
  }
  @Action(
      value = "orgTaskFlowBegin",
      results = {
        @Result(
            name = "success",
            type = "redirectAction",
            params = {
              "actionName",
              "${taskFlowData.taskFlowState.currentTask.action}",
              "namespace",
              "${taskFlowData.taskFlowState.currentTask.namespace}"
            })
      })
  public String beginTaskFlow() throws ServiceException {
    startNewTaskFlow();

    DataGridState<Org> dataGridState = conversation.get(DataGridState.class, ORG_SEARCH_GRID);

    getTaskFlowData().setOrgs(new HashSet<>(dataGridState.getSelectedItems()));

    return SUCCESS;
  }