Reusable Content for the Object Types Section

External object types can be refreshed in M-Files Desktop by pressing the Alt key and selecting Settings > Refresh External Objects and then by selecting a suitable external object type from the submenu. You can select either the Quick Refresh or the Full Refresh operation.

A full refresh operation is initiated for all external object types at 4:30 AM server time every night. This operation is executed as one part of the daily maintenance routine.

  1. Optional: If the Mapping Type is Property, specify the settings Use in Update Operation and Use in Insert Operation and define the related statements.
    If you want to...Complete the following steps:
    Allow read-only access Set the Use in Update Operation and Use in Insert Operation settings to No. Do not specify the statements in this table.
    Allow users to update but not create or delete information
    1. Set the Use in Update Operation to Yes.
    2. Under Service-Specific Settings, in UPDATE statement, write the UPDATE statement.
    Allow users to update, create, and delete information
    1. Set the Use in Update Operation and Use in Insert Operation settings to Yes.
    2. Under Service-Specific Settings, write the four statements in this table.
    Statement Definition Examples
    UPDATE When you edit an object in M-Files, M-Files Server edits the corresponding record in the external database using an UPDATE statement. Use a question mark (?) to signal columns to be updated.

    UPDATE Customers SET CustomerName = ? WHERE CustomerID = ?

    UPDATE Contact SET Name = ?, CustomerID = ? WHERE ContactID = ?

    INSERT INTO When you create a new object in M-Files, M-Files Server adds a corresponding record into the external database using an INSERT INTO statement. Use a question mark (?) to indicate the value of each column.
    Note: The INSERT INTO statement input to M-Files does not define a value for the ID column. The external database should be set up to automatically provide an ID for new records. For example in SQL Server databases, set the type of the ID column as identity. If the external database cannot produce new ID values, the INSERT INTO statement cannot be used.

    INSERT INTO Customers( CustomerName ) VALUES( ? )

    INSERT INTO ContactPersons( Name, CustomerID ) VALUES( ?, ? )

    Get ID SELECT After a new record has been created with the INSERT INTO statement, M-Files Server gets the ID of the newly created record with this SELECT statement.

    SELECT MAX( CustomerID ) FROM Customer

    DELETE When you delete an object from M-Files, M-Files Server deletes the corresponding record in the external database using a DELETE statement. Use a question mark (?) for the ID of the record to be deleted.

    DELETE FROM Customers WHERE CustomerID = ?

    DELETE FROM Contacts WHERE ContactID = ?

  2. Select the check boxes in the Update and Insert columns and define the four statements below the Columns listing.
    If you want to...Complete the following steps:
    Allow read-only access Do not select the check boxes and leave the statements empty.
    Allow users to update but not create or delete information
    1. Select the check boxes in the Update column for the necessary properties.
    2. Click the Default button next to the UPDATE statement field. You can also enter your statements to the fields.
    Allow users to update, create, and delete information
    1. Select the check boxes in the Update and Insert columns for the necessary properties.
    2. Click the Default button next to the UPDATE, INSERT INTO, SELECT, and DELETE statement fields. You can also enter your statements to the fields.

    The table below explains the use of the four statements mentioned above.

    Statement Definition Examples
    UPDATE When you edit an object in M-Files, M-Files Server edits the corresponding record in the external database using an UPDATE statement. Use a question mark (?) to signal columns to be updated.

    UPDATE Customers SET CustomerName = ? WHERE CustomerID = ?

    UPDATE Contact SET Name = ?, CustomerID = ? WHERE ContactID = ?

    INSERT INTO When you create a new object in M-Files, M-Files Server adds a corresponding record into the external database using an INSERT INTO statement. Use a question mark (?) to indicate the value of each column.
    Note: The INSERT INTO statement input to M-Files does not define a value for the ID column. The external database should be set up to automatically provide an ID for new records. For example in SQL Server databases, set the type of the ID column as identity. If the external database cannot produce new ID values, the INSERT INTO statement cannot be used.

    INSERT INTO Customers( CustomerName ) VALUES( ? )

    INSERT INTO ContactPersons( Name, CustomerID ) VALUES( ?, ? )

    SELECT After a new record has been created with the INSERT INTO statement, M-Files Server gets the ID of the newly created record with this SELECT statement.

    SELECT MAX( CustomerID ) FROM Customer

    DELETE When you delete an object from M-Files, M-Files Server deletes the corresponding record in the external database using a DELETE statement. Use a question mark (?) for the ID of the record to be deleted.

    DELETE FROM Customers WHERE CustomerID = ?

    DELETE FROM Contacts WHERE ContactID = ?

  3. In Mapping Type, specify how the source column is mapped to M-Files. Complete one of these steps:
    • To map a source column as the external ID, select Object ID.
      or
    • To map the source column to an M-Files property, select Property. In Target Property, select the M-Files property.
    Note: When you want to map multiple values to a property of the Choose from list (multi-select) data type, the values must be recorded on their own rows in the external database. For example, if you want to map multiple values to the Industry property, the values must be recorded like this:
    ID Customer name City Industry Active
    ABC-123 ESTT Corporation New York 100 1
    ABC-123 ESTT Corporation New York 101 1
    ABC-123 ESTT Corporation New York 108 1

    In this case, however, data can only be read from, not recorded to the external database.