User Examples

Basic User Create

Create a basic user, setting the fewest properties possible. All other values for the user are left at their default.

[
  {
    "Action": "Create",
    "Type": "Replicon.Domain.User",
    "Operations": [
      {
        "__operation": "SetProperties",
        "FirstName": "Jimmy",
        "LastName": "Brown",
        "LoginName": "jbrown",
        "Password": "passw0rd",
        "PrimaryDepartment": {
          "__type": "Replicon.Domain.Department",
          "Identity": "1"
        }
      }
    ]
  }
]

Query All Users

Query for all users in the system. This query takes no arguments.

[
  {
    "Action": "Query",
    "QueryType": "UserAll",
    "DomainType": "Replicon.Domain.User",
    "Args": []
  }
]

Query Users By Status

Query for all enabled Users

[
  {
    "Action": "Query",
    "QueryType": "UserByStatus",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      true
    ]
  }
]

Query User by Email

Query for users by e-mail.

[
  {
    "Action": "Query",
    "QueryType": "UserByEmail",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "doug.brown@company.com"
    ]
  }
]

Query Specific User By Id

Query for the specific user with Id #2. This query takes a single argument: an array of user Ids to find.

[
  {
    "Action": "Query",
    "QueryType": "UserById",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      [
        2
      ]
    ]
  }
]

Query Users by Last Name

Query for any users that have "Brow" in their last name. The first argument to this query is the string to match, and the second argument defines whether to support a partial match (e.g. a value of "true" would return "Brown").

[
  {
    "Action": "Query",
    "QueryType": "UserByPartialLastName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Brow",
      true
    ]
  }
]

Query User by Login Name

Query for the user with the login name "admin".

[
  {
    "Action": "Query",
    "QueryType": "UserByLoginName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "admin"
    ]
  }
]

Query User by Partial Login Name

Query for the user with the partial login name "ad" with wildcard search.

[
  {
    "Action": "Query",
    "QueryType": "UserByPartialLoginName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "ad",
      true
    ]
  }
]

Query User by First

Query for users with the first name of "Doug".

[
  {
    "Action": "Query",
    "QueryType": "UserByFirstName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Doug"
    ]
  }
]

Query User by Partial First

Query for users with the partial first name of "Doug" with wildcard search.

[
  {
    "Action": "Query",
    "QueryType": "UserByPartialFirstName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Doug",
      true
    ]
  }
]

Query User by First & Last Name

Query for users with the first name of "Doug", and last name of "Brown".

[
  {
    "Action": "Query",
    "QueryType": "UserByFirstNameLastName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Doug",
      "Brown"
    ]
  }
]

Query User by Last Name

Query for users with the last name "Brown".

[
  {
    "Action": "Query",
    "QueryType": "UserByLastName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Brown"
    ]
  }
]

Query User by Partial Last Name

Query for users with the partial last name of "Brown" with wildcard search.

[
  {
    "Action": "Query",
    "QueryType": "UserByPartialLastName",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Brown",
      true
    ]
  }
]

Query User by Partial Email

Query for users with the partial e-mail of "Doug" with wildcard search.

[
  {
    "Action": "Query",
    "QueryType": "UserByPartialEmail",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Doug",
      true
    ]
  }
]

Query User by Employee Id

Query for the user with the employee ID 10020.

[
  {
    "Action": "Query",
    "QueryType": "UserByEmployeeId",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "10020"
    ]
  }
]

Set User UDF Values

Set user defined field values (QuickBooks Payroll Item, Mental Health Days Taken, and Last Mental Health Day) for different user defined field types (text, drop-down, number, and date).

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "2",
    "Operations": [
      {
        "__operation": "SetUdfValues",
        "QuickBooks Payroll Item": "Hourly",
        "Mental Health Days Taken": 2,
        "Last Mental Health Day": {
          "__type_": "Date",
          "Year": 2010,
          "Month": 7,
          "Day": 9
        }
      }
    ]
  }
]

Add Substitute User

Add user #2 as a substitute for user #45, with full access and no date restrictions.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "Substitutes",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Substitute": {
              "__type": "Replicon.Domain.User",
              "Identity": "2"
            },
            "FullAccess": true
          }
        ]
      }
    ]
  }
]

Query Returning Substitute Users

Query all the substitute users for a given user.

[
  {
    "Action": "Query",
    "QueryType": "UserById",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      [
        24
      ]
    ],
    "Load": [
      {
        "Relationship": "Substitutes"
      }
    ]
  }
]

Edit Substitute User Entry

Edit an existing substitute user entry, setting the start and end date of the substitution, without affecting the permissions for the user. You can determine the identity of the substitute user entry using "Query All Users" shown above.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "24",
    "Operations": [
      {
        "__operation": "CollectionEdit",
        "Collection": "Substitutes",
        "Identity": "102",
        "Operations": [
          {
            "__operation": "SetProperties",
            "StartDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 8,
              "Day": 1
            },
            "EndDate": {
              "__type": "Date",
              "Year": 2010,
              "Month": 8,
              "Day": 15
            }
          }
        ]
      }
    ]
  }
]

Change Payroll Rate

Clear a user's payroll and cost rates, and set $75 as their payroll rate and $100 as their cost rate.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionClear",
        "Collection": "PayrollRateHistory"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "PayrollRateHistory",
        "Operations": [
          {
            "__operation": "SetProperties",
            "EffectiveDate": {
              "__type": "Date",
              "Past": true
            },
            "EndDate": {
              "__type": "Date",
              "Future": true
            },
            "HourlyRate": 75
          }
        ]
      },
      {
        "__operation": "CollectionClear",
        "Collection": "CostRateHistory"
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "CostRateHistory",
        "Operations": [
          {
            "__operation": "SetProperties",
            "EffectiveDate": {
              "__type": "Date",
              "Past": true
            },
            "EndDate": {
              "__type": "Date",
              "Future": true
            },
            "HourlyRate": 100
          }
        ]
      }
    ]
  }
]

Load a User's Payroll Rates

Load all the payroll rates assigned to a user. This query is useful before editing rates.

[
  {
    "Action": "LoadIdentity",
    "DomainType": "Replicon.Domain.User",
    "Identity": "45",
    "Load": [
      {
        "Relationship": "PayrollRateHistory"
      }
    ]
  }
]

Modify Payroll Rate

Modify an existing payroll rate entry, changing the value to $65/hr.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionEdit",
        "Collection": "PayrollRateHistory",
        "Identity": "121",
        "Operations": [
          {
            "__operation": "SetProperties",
            "HourlyRate": 65
          }
        ]
      }
    ]
  }
]

Set Billing Rate

Set a user's default billing rate.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "2",
    "Operations": [
      {
        "__operation": "SetProperties",
        "DefaultBillingRate": 2.5
      }
    ]
  }
]

Add a Role to a User

Add a permission profile to a user.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "Roles",
        "Value": {
          "__type": "Replicon.Domain.Role",
          "Identity": "2"
        }
      }
    ]
  }
]

Remove a Role from a User

Remove a permission profile from a user.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionRemove",
        "Collection": "Roles",
        "Identity": "2"
      }
    ]
  }
]

Add & Remove License Seat Assignments

Add and remove license seats assigned to a user.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "ModuleGroups",
        "Value": {
          "__type": "Replicon.Domain.ModuleGroup",
          "Identity": "Expense"
        }
      },
      {
        "__operation": "CollectionRemove",
        "Collection": "ModuleGroups",
        "Identity": "Project"
      }
    ]
  }
]

Set User's Holiday Calendar

Set a user's holiday calendar.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "SetProperties",
        "HolidayCalendar": {
          "__type": "Replicon.Domain.Calendar",
          "Identity": "3"
        }
      }
    ]
  }
]

Set User's Overtime Rule

Add an overtime rule to a user with blank start and end dates.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "OvertimeRules",
        "Operations": [
          {
            "__operation": "SetProperties",
            "OvertimeRule": {
              "__type": "Replicon.TimeOff.Domain.BusinessRules.OvertimeRule",
              "Identity": "7"
            },
            "EffectiveDate": {
              "__type": "Date",
              "Past": true
            },
            "EndDate": {
              "__type": "Date",
              "Future": true
            }
          }
        ]
      }
    ]
  }
]

Retrieve TimeOff Accrual Policies

Load all the time off accrual policies for a user.

[
  {
    "Action": "LoadIdentity",
    "DomainType": "Replicon.Domain.User",
    "Identity": "45",
    "Load": [
      {
        "Relationship": "TimeOffCodePolicies",
        "Load": [
          {
            "Relationship": "TimeOffCode"
          },
          {
            "Relationship": "Items"
          }
        ]
      }
    ]
  }
]

Set User's TimeOff Approval Path

Set user #45's time off approval path to path #2.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "SetProperties",
        "TimeOffApprovalPath": {
          "__type": "Replicon.Domain.Approvals.ApprovalPathTemplate",
          "Identity": "2"
        }
      }
    ]
  }
]

Add a Supervisor to a User

Add user #2 as a supervisor for user #45. The supervisor is added with blank start and end dates.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "Supervisors",
        "Operations": [
          {
            "__operation": "SetProperties",
            "StartDate": {
              "__type": "Date",
              "Past": true
            },
            "EndDate": {
              "__type": "Date",
              "Future": true
            },
            "Supervisor": {
              "__type": "Replicon.Domain.Supervisor",
              "Identity": "2"
            }
          }
        ]
      }
    ]
  }
]

Assign TimeOff and Accrual Policy

Assign time off type #1 to user #2, with a new time off policy. The policy begins on January 1st 2010 with a carry over balance of 5 and accrues 1 day of time off each week on Tuesdays.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "2",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeOffCodeAssignments",
        "Value": {
          "__type": "Replicon.TimeOff.Domain.TimeOffCode",
          "Identity": "1"
        }
      },
      {
        "__operation": "CollectionAdd",
        "Collection": "TimeOffCodePolicies",
        "Operations": [
          {
            "__operation": "SetProperties",
            "TimeOffCode": {
              "__type": "Replicon.TimeOff.Domain.TimeOffCode",
              "Identity": "1"
            }
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "Items",
            "Operations": [
              {
                "__operation": "SetProperties",
                "EffectiveDate": {
                  "__type": "Date",
                  "Year": 2010,
                  "Month": 1,
                  "Day": 1
                },
                "CarryOver": {
                  "__type": "Replicon.TimeOff.Domain.CarryOverType",
                  "Identity": "CarryOver"
                },
                "AllowedAmount": 5,
                "EndDate": {
                  "__type": "Date",
                  "Future": true
                },
                "AccrueAmount": 1
              },
              {
                "__operation": "SetAccrueFrequency",
                "Frequency": "Weekly",
                "DayOfWeek": "Tuesday"
              }
            ]
          }
        ]
      }
    ]
  }
]

Edit Accrual Policy

Edit a specific accrual policy for a user, setting it to accrue 1 day per month.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "45",
    "Operations": [
      {
        "__operation": "CollectionEdit",
        "Collection": "TimeOffCodePolicies",
        "Identity": "145",
        "Operations": [
          {
            "__operation": "CollectionClear",
            "Collection": "Items"
          },
          {
            "__operation": "CollectionAdd",
            "Collection": "Items",
            "Operations": [
              {
                "__operation": "SetProperties",
                "EffectiveDate": {
                  "__type": "Date",
                  "Year": 2010,
                  "Month": 1,
                  "Day": 1
                },
                "EndDate": {
                  "__type": "Date",
                  "Future": true
                },
                "AccrueAmount": 1
              },
              {
                "__operation": "SetAccrueFrequency",
                "Frequency": "Monthly",
                "DayOfMonth": "1"
              }
            ]
          }
        ]
      }
    ]
  }
]

Query User by UDF Value

Query for users by a user defined field value.

[
  {
    "Action": "Query",
    "QueryType": "UserEqualToUDFValue",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Mental Health Days Taken",
      2
    ]
  }
]

Query User by Null UDF Value

Query for users by an empty user defined field value.

[
  {
    "Action": "Query",
    "QueryType": "UserNullUDFValue",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      "Mental Health Days Taken"
    ]
  }
]

Retrieve a user's current time off accrual balance

Loads a user's TimeOffCodeAssignmentDetails relationship, which contains properties that reflect the user's current balance (taken or remaining) for each time off type that they are assigned to.

[
  {
    "Action": "LoadIdentity",
    "DomainType": "Replicon.Domain.User",
    "Identity": "2",
    "Args": [],
    "Load": [
      {
        "Relationship": "TimeOffCodeAssignmentDetails",
        "Load": [
          {
            "Relationship": "TimeOffCode"
          }
        ]
      }
    ]
  }
]

Load User Email Notification Settings

Load the complete list of email notification settings for a user.

[
  {
    "Action": "Query",
    "QueryType": "UserById",
    "DomainType": "Replicon.Domain.User",
    "Args": [
      [
        "2"
      ]
    ],
    "Load": [
      {
        "Relationship": "UserEmailNotificationSettingsList"
      }
    ]
  }
]

Enable User Email Notification Settings

Enable an email notification setting type for a user.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "2",
    "Operations": [
      {
        "__operation": "CollectionAdd",
        "Collection": "UserEmailNotificationSettingsList",
        "Operations": [
          {
            "__operation": "SetProperties",
            "Key": "Notify.TimesheetDue.Disabled"
          }
        ]
      }
    ]
  }
]

Disable User Email Notification Settings

Disable an email notification setting type for a user.

[
  {
    "Action": "Edit",
    "Type": "Replicon.Domain.User",
    "Identity": "2",
    "Operations": [
      {
        "__operation": "CollectionRemove",
        "Collection": "UserEmailNotificationSettingsList",
        "Identity": "Notify.TimesheetDue.Disabled"
      }
    ]
  }
]