UserDefinedField Examples

Query for All UDF's

Query for all user defined fields.

[
  {
    "Action": "Query",
    "QueryType": "UserDefinedFieldAll",
    "DomainType": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedField",
    "Args": []
  }
]

Query for UDF By Id

Query for a user defined field by Id.

[
  {
    "Action": "Query",
    "QueryType": "UserDefinedFieldById",
    "DomainType": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedField",
    "Args": [
      [
        {
          "__type": "GUID",
          "Value": "7185c15c-0001-40d9-a6c9-1b9e1a4503aa"
        }
      ]
    ]
  }
]

Query for UDF By UDF Group Name and UDF Name

Query for a user defined field by the group name and the field name

[
  {
    "Action": "Query",
    "QueryType": "UserDefinedFieldByGroupNameFieldName",
    "DomainType": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedField",
    "Args": [
      "User",
      "RemoteApiNumeric"
    ]
  }
]

Setup UDFs of Each Type

Create four user defined fields for the user defined field category #1. (See the first example above for information on how to query user defined field categories.). The four fields created are named String, Number, Date, and QuickBooks Payroll Item, and are assigned text, number, date, and drop-down field types, respectively. Two drop-down options are provided for the QuickBooks Payroll Item, "Hourly" and "Salary".

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CollectionClear",
        "Collection": "Fields"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Fields",
        "Operations": [
          {
            "__operation": "SetProperties",
            "FieldIndex": 0,
            "Name": "String",
            "Enabled": true,
            "Type": {
              "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
              "Identity": "Text"
            }
          }
        ]
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Fields",
        "Operations": [
          {
            "__operation": "SetProperties",
            "FieldIndex": 1,
            "Name": "Number",
            "Enabled": true,
            "Type": {
              "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
              "Identity": "Numeric"
            }
          }
        ]
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Fields",
        "Operations": [
          {
            "__operation": "SetProperties",
            "FieldIndex": 2,
            "Name": "Date",
            "Enabled": true,
            "Type": {
              "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
              "Identity": "Date"
            }
          }
        ]
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "Fields",
        "Operations": [
          {
            "__operation": "SetProperties",
            "FieldIndex": 3,
            "Name": "QuickBooks Payroll Item",
            "Enabled": true,
            "Type": {
              "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
              "Identity": "DropDown"
            }
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "DropDownOptions",
            "Operations": [
              {
                "__operation": "SetProperties",
                "Value": "Hourly",
                "Enabled": true
              }
            ]
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "DropDownOptions",
            "Operations": [
              {
                "__operation": "SetProperties",
                "Value": "Salary",
                "Enabled": true
              }
            ]
          }
        ]
      }
    ]
  }
]

Load UDF Group's Fields

Load all the fields in a user defined field category (User, Department, Client, etc). This is useful for determining a field's identity, which is required to edit a single field.

[
  {
    "Action": "LoadIdentity",
    "DomainType": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Load": [
      {
        "Relationship": "Fields"
      }
    ]
  }
]

Load UDF Fields and Drop-Down Options

Load all of the fields and their drop-down options in a user defined field category (User, Department, Client, etc).

[
  {
    "Action": "LoadIdentity",
    "DomainType": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Load": [
      {
        "Relationship": "Fields",
        "Load": [
          {
            "Relationship": "DropDownOptions"
          }
        ]
      }
    ]
  }
]

Add a Drop-Down Option to a UDF

Add a new drop-down option named "Magic" to the user defined field with identity #16 in category #1.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CollectionEdit",
        "Collection": "Fields",
        "Identity": "04F2F563-0352-45b5-9EDA-E3B3D9A251A5",
        "Operations": [
          {
            "__operation": "CollectionAdd",
            "Collection": "DropDownOptions",
            "Operations": [
              {
                "__operation": "SetProperties",
                "Value": "Magic",
                "Enabled": true
              }
            ]
          }
        ]
      }
    ]
  }
]

Remove a Drop-Down Option from a UDF

Remove a specific drop-down option from a user defined field.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CollectionEdit",
        "Collection": "Fields",
        "Identity": "04F2F563-0352-45b5-9EDA-E3B3D9A251A5",
        "Operations": [
          {
            "__operation": "CollectionRemove",
            "Collection": "DropDownOptions",
            "Identity": "BD16862F-F2B7-40e4-BF93-B1C7ADD3D684"
          }
        ]
      }
    ]
  }
]

Create/Update a Numeric Udf

Create a new numeric user defined field will all the available fields options, and then update it to change those set.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CreateNumericUdf",
        "Name": "RemoteApiNumeric",
        "Type": {
          "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
          "Identity": "Numeric"
        },
        "FieldIndex": 1,
        "Enabled": true,
        "Hidden": false,
        "Required": false,
        "MinValue": 0,
        "MaxValue": 10,
        "DecimalPlaces": 1,
        "DefaultValue": 8
      },
      {
        "__operation": "UpdateNumericUdf",
        "Name": "RemoteApiNumeric",
        "Enabled": true,
        "Required": false,
        "MinValue": 1,
        "MaxValue": 12,
        "DecimalPlaces": 2,
        "DefaultValue": 9
      }
    ]
  }
]

Create/Update a Text Udf

Create a new text user defined field will all the available fields options, and then update it to change those set.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CreateTextUdf",
        "Name": "RemoteApiText",
        "Type": {
          "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
          "Identity": "Text"
        },
        "FieldIndex": 2,
        "Enabled": true,
        "Hidden": false,
        "Required": false,
        "MaxLength": 40,
        "DefaultValue": "wonder"
      },
      {
        "__operation": "UpdateTextUdf",
        "Name": "RemoteApiText",
        "Enabled": true,
        "Required": false,
        "MaxLength": 50,
        "DefaultValue": "super wonder"
      }
    ]
  }
]

Create/Update a Date Udf

Create a new Date user defined field will all the available fields options, and then update it to change those set.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CreateDateUdf",
        "Name": "RemoteApiDate",
        "Type": {
          "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
          "Identity": "Date"
        },
        "FieldIndex": 3,
        "Enabled": true,
        "Hidden": false,
        "Required": false,
        "MinValue": {
          "__type": "Date",
          "Year": 2010,
          "Month": 10,
          "Day": 1
        },
        "MaxValue": {
          "__type": "Date",
          "Year": 2010,
          "Month": 12,
          "Day": 30
        },
        "DefaultValue": {
          "__type": "Date",
          "Year": 2010,
          "Month": 10,
          "Day": 30
        }
      },
      {
        "__operation": "UpdateDateUdf",
        "Name": "RemoteApiDate",
        "Enabled": true,
        "Required": false,
        "MinValue": {
          "__type": "Date",
          "Year": 2010,
          "Month": 1,
          "Day": 1
        },
        "MaxValue": {
          "__type": "Date",
          "Year": 2012,
          "Month": 12,
          "Day": 30
        },
        "DefaultValueIsToday": true
      }
    ]
  }
]

Create/Update a Drop Down Udf

Create a new drop down user defined field will all the available fields options, and then update it to change those set, including adding another drop down option, and replacing all drop down options, then remove a couple options.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.UserDefinedFields.Definition.UserDefinedFieldGroup",
    "Identity": "23DDD9A0-A1D1-40f1-AEAA-2E04915F0DE8",
    "Operations": [
      {
        "__operation": "CreateDropDownUdf",
        "Name": "RemoteApiDropDown",
        "Type": {
          "__type": "Replicon.Domain.UserDefinedFields.Definition.UdfType",
          "Identity": "DropDown"
        },
        "FieldIndex": 4,
        "Enabled": true,
        "Hidden": false,
        "Required": false,
        "DefaultValue": "three",
        "DropDownOptions": [
          "one",
          "two",
          "three",
          "four",
          "five"
        ]
      },
      {
        "__operation": "UpdateDropDownUdf",
        "Name": "RemoteApiDropDown",
        "Enabled": true,
        "Required": false,
        "DropDownOptions": [
          "Six"
        ],
        "DefaultValue": "one"
      },
      {
        "__operation": "UpdateDropDownUdf",
        "Name": "RemoteApiDropDown",
        "Enabled": true,
        "Required": false,
        "DropDownOptions": [
          "a",
          "b",
          "c",
          "d",
          "e",
          "f"
        ],
        "DropDownOptionsReplace": true
      },
      {
        "__operation": "RemoveDropDownUdfOption",
        "Name": "RemoteApiDropDown",
        "DropDownOptions": [
          "b",
          "c"
        ]
      }
    ]
  }
]