This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

TargetInvocationException Error when attempting to create user manager (via user search)

Hello all, I was curious to see if anyone else has ran into this issue where you create a new input field type "AccountSearchTextField" and utilize that as a variable to put in for the manager attribute in AD.

It seems to show up okay on the web client and it will search for the desired user to be placed in as the manager:

However, when you try to approve the user creation, I'm thrown an exception stating the following: "The application must be closed because an unexpected error occurred. We are sorry for the inconvenience.

TargetInvocationException 

I noticed that when I take out the following configuration from my .json file, there's no more issues:
{
"Name": "manager",
"Definition": {
"Type": "AccountSearchTextField",
"Label": "Manager",
"ObjectType": "Account",
"IsEnabled": true,
"IsObjectSearchable": true,
"ExcludeDeactivatedUsers": true,
"RestrictToDataOwnerResources": true,
"UsersOnly": true,
}
},

I've sanitized and attached my entire json file:
 

[
  {
    "Version": 1,
    "TemplateType": "CreateNewUser",
    "Id": "c429f03f-277d-4336-ac24-28461936f7dc",
    "DisplayName": "Create new User",
    "Description": "",
    "FullQualifiedDomainName": "<domain>",
    "OrganizationalUnit": {
      "Definition": {
        "Type": "FixedValue",
        "Label": "['en-us:Organisational unit (OU)','de-de:Organisationseinheit (OU)','fr-fr:Unité organisationnelle']",
        "Value": "<OU VALUE>",
        "DisplayValue": "Users"
      }
    },
    "LookupTables": [],
    "MemberOf": {
      "IsHidden": true,
      "IsHiddenFromRequester": true,
      "Accounts": [
        "sid:<group>",
        "sid:<group>"
      ]
    },
    "ScriptOptions": {
      "IsHidden": false,
      "IsHiddenFromRequester": false,
      "IsScriptEnabledDefault": false,
      "Path": "",
      "CommandLineParameters": "",
      "DisplayName": ""
    },
    "LdapAttributes": [
      {
        "Name": "employeeID",
        "Definition": {
          "Type": "TextField",
          "Label": "Employee ID",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": 6,
            "ForbiddenChars": [],
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "properties/ldap/uniqueness",
            "CreationRule": ""
          }
        }
      },
      {
        "Name": "givenname",
        "Definition": {
          "Type": "TextField",
          "Label": "['en-us:First Name', 'de-de:Vorname', 'fr-fr:Prénom']",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": null,
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "",
            "CreationRule": ""
          }
        }
      },
      {
        "Name": "initials",
        "Definition": {
          "Type": "TextField",
          "Label": "Middle Initial",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": false,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": [],
            "ValidationRule": null,
            "ValidationInformation": null,
            "UniquenessConstraint": "",
            "CreationRule": null
          }
        }
      },
      {
        "Name": "sn",
        "Definition": {
          "Type": "TextField",
          "Label": "['en-us:Last Name', 'de-de:Nachname', 'fr-fr:Nom de famille']",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": null,
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "",
            "CreationRule": ""
          }
        }
      },
      {
        "Name": "cn",
        "Definition": {
          "Type": "TextField",
          "Label": "['en-us:Full Name', 'de-de:Common-Name', 'fr-fr:Nom commun']",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": null,
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "",
            "CreationRule": "{givenname} {sn}"
          }
        }
      },
	  {
		"Name": "manager",
		"Definition": {
		"Type": "AccountSearchTextField",
		"Label": "Manager",
		"ObjectType": "Account",
		"IsEnabled": true,
		"IsObjectSearchable": true,
		"ExcludeDeactivatedUsers": true,
		"RestrictToDataOwnerResources": true,
		"UsersOnly": true,
		}
	  },
      {
        "Name": "departmentNumber",
        "isHidden": true,
        "isHiddenFromRequester": false,
        "Definition": {
          "Type": "FixedValue",
          "Label": "Department Number",
          "Description": "",
          "Value": "##",
          "DisplayValue": "##"
        }
      },
      {
        "Name": "company",
        "isHidden": true,
        "isHiddenFromRequester": false,
        "Definition": {
          "Type": "FixedValue",
          "Label": "Organization Name",
          "Description": "company",
          "Value": "<company>",
          "DisplayValue": "<company>"
        }
      },
      {
        "Name": "proxyAddresses",
        "Definition": {
          "Type": "TextField",
          "Label": "Alias Addresses",
          "Description": "proxy",
          "DefaultValue": null,
          "IsRequired": false,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": [],
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "",
            "CreationRule": "smtp:{givenname}.{sn}@[FQDN]; smtp:{givenname}.{sn}@<EXTERNAL FQDN>"
          }
        }
      },
      {
        "Name": "userprincipalname",
        "Definition": {
          "Type": "TextField",
          "Label": "['en-us:Email Account', 'de-de:Benutzeranmeldename', 'fr-fr:Nom de l\\'utilisateur principal']",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": null,
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "properties/ldap/uniqueness",
            "CreationRule": "{givenname}.{sn}@<EXTERNAL FQDN>"
          }
        }
      },
	  {
		"Name": "samaccountnumber",
		"Definition": {        
		"Type": "NumericField",
		"DefaultValue": 30,
		"MinValue": 0,
		"MaxValue": 600,
		"Label": "['en-US:Username Account Number (Can be anything)']", 
		"IsRequired": true,
		"IsEnabled": true      
	  }
		},
      {
        "Name": "samaccountname",
        "Definition": {
          "Type": "TextField",
          "Label": "['en-us:Username', 'de-de:SAM-Account-Name', 'fr-fr:SAM nom de compte']",
          "Description": "",
          "DefaultValue": null,
          "IsRequired": true,
          "IsEnabled": true,
          "isHidden": false,
          "isHiddenFromRequester": false,
          "Constraints": {
            "MaxLength": -1,
            "ForbiddenChars": [
              "~",
              "!",
              "@",
              "#",
              "$",
              "%",
              "^",
              "&",
              "*",
              "(",
              ")",
              "`",
              ":",
              "'",
              "\"",
              ",",
              "<",
              ".",
              ">",
              "/",
              "?",
              "[",
              "{",
              "]",
              "}",
              "\\",
              "|",
              "=",
              "+",
              "_",
            ],
            "ValidationRule": "",
            "ValidationInformation": "",
            "UniquenessConstraint": "properties/ldap/uniqueness",
            "CreationRule": "<toLowerCase>(<firstLetter>({givenname}){sn}{samaccountnumber})"
          }
        }
      },
		{
        "Name": "description",
        "isHidden": true,
        "isHiddenFromRequester": true,
        "Definition": {
          "Type": "FixedValue",
          "Label": "description",
          "Description": "description",
          "Value": "<Description>",
          "DisplayValue": "<Description>"
			}
		}
    ],
    "InitialPassword": {
      "MinLength": 8,
      "IsComplex": true,
      "IsMasked": false,
      "DefaultValue": "<PASSWORD>",
      "Constraints": {
        "ValidationRule": "(?=(.*[0-9]))(?=.*[\\!@#$%^&*()\\\\[\\]{}\\-_+=~`|:;\"'<>,./?])(?=.*[a-z])(?=(.*[A-Z]))(?=(.*)).{8,}",
        "ValidationInformation": "Password must be at least 8 characters with 1 uppercase, 1 lowercase, 1 number, and 1 alphanumeric"
      }
    },
    "PasswordOptions": {
      "MustBechangedAtNextLogonDefault": true,
      "CannotBeChangedByUserDefault": false,
      "NeverExpiresDefault": false
    },
    "ActivationOptions": {
      "IsHidden": false,
      "IsHiddenFromRequester": false
    },
    "Modules": []
  }
]

EDIT: Forgot to add screenshot of error