{
  "name": "Workforce - CrossSource Department",
  "type": "static",
  "attributes": {
    "activeHrDept": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "DEPARTMENT",
              "accountSortDescending": true,
              "accountPropertyFilter": "(ACTIVE == \"1\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "activeVmsDept": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Vendor Management System",
              "attributeName": "DEPARTMENT",
              "accountSortDescending": true,
              "accountPropertyFilter": "(ACTIVE == \"1\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "termHrDept": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Enterprise HR",
              "attributeName": "DEPARTMENT",
              "accountSortDescending": true,
              "accountReturnFirstLink": true,
              "accountPropertyFilter": "(ACTIVE == \"0\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "termVmsDept": {
      "type": "firstValid",
      "attributes": {
        "values": [
          {
            "type": "accountAttribute",
            "attributes": {
              "sourceName": "Vendor Management System",
              "attributeName": "DEPARTMENT",
              "accountSortDescending": true,
              "accountReturnFirstLink": true,
              "accountPropertyFilter": "(ACTIVE == \"0\")"
            }
          },
          "NONE"
        ],
        "ignoreErrors": "true"
      }
    },
    "termWinner": {
      "type": "dateCompare",
      "attributes": {
        "operator": "gte",
        "positiveCondition": "hr",
        "negativeCondition": "vms",
        "firstDate": {
          "type": "dateFormat",
          "attributes": {
            "inputFormat": "MM/dd/yyyy",
            "outputFormat": "ISO8601",
            "input": {
              "type": "firstValid",
              "attributes": {
                "values": [
                  {
                    "type": "accountAttribute",
                    "attributes": {
                      "sourceName": "Enterprise HR",
                      "attributeName": "TERMINATION_DATE",
                      "accountSortDescending": true,
                      "accountReturnFirstLink": true,
                      "accountPropertyFilter": "(ACTIVE == \"0\")"
                    }
                  },
                  "01/01/1900"
                ],
                "ignoreErrors": "true"
              }
            }
          }
        },
        "secondDate": {
          "type": "dateFormat",
          "attributes": {
            "inputFormat": "MM/dd/yyyy",
            "outputFormat": "ISO8601",
            "input": {
              "type": "firstValid",
              "attributes": {
                "values": [
                  {
                    "type": "accountAttribute",
                    "attributes": {
                      "sourceName": "Vendor Management System",
                      "attributeName": "TERMINATION_DATE",
                      "accountSortDescending": true,
                      "accountReturnFirstLink": true,
                      "accountPropertyFilter": "(ACTIVE == \"0\")"
                    }
                  },
                  "01/01/1900"
                ],
                "ignoreErrors": "true"
              }
            }
          }
        }
      }
    },
    "value": "#if($activeHrDept != 'NONE' && $activeHrDept != 'null')$!activeHrDept#elseif($activeVmsDept != 'NONE' && $activeVmsDept != 'null')$!activeVmsDept#elseif($termWinner == 'hr' && $termHrDept != 'NONE' && $termHrDept != 'null')$!termHrDept#elseif($termVmsDept != 'NONE' && $termVmsDept != 'null')$!termVmsDept#end"
  },
  "internal": false
}
