This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Set LastModifedBy when updating properties from a service account

Hi all,

I wand to create and update documents in m-files from an ERP system.
The ERP system has it's own user database. M-Files is using Windows auth.

For testing I've setup a small service that gets new and updated documents from the ERP system and updates m-files via REST-API accordingly.
The service authenticates in m-files with a service account.
The service has a mapping between ERP users and m-files users.

When creating new documents CreatedBy and LastUpdatedBy are set with the correct mapped m-files user (by setting properties 23 and 25).

But when I update metadata via a call to /objects/(type)/(objectid)/(version)/properties LastUpdatedBy is set to my service account and not to the user I put in property 23.

Is there a way to set the LastUpdatedBy to another user in this scenario?

thanks
Tobias

  • Hi all,

    as I haven't received any answers yet, I'll try to formulate my question better/shorter/simpler.
    I think it should be pretty easy to answer for the moderators.

    When updating a document via REST-API can I set the property LastUpdatedBy (ID=23) to a value specified in my request?
    I don't want it to be set to the caller, because the caller is a service account.

    thank you very much
    Tobias

  • Hi again,

    what Do I need to do to get an answer from the moderators?
    Is anything wrong with my question?

    Do I have to implement my own LastUpdatedBy2 or is there a way to set LastUpdatedBy when or after calling /objects/(type)/(objectid)/(version)/properties?

    thanks
    Tobias

  • Hi Tobias,

    I'm sorry you haven't received an answer to your question. However, since this is a peer-to-peer community and not an official support channel, the advice is for you to contact your M-Files representative with this problem.

  • Hi Tobias,

    As said: this is a peer-to-peer forum and, as such, will typically get quite low traction during periods of holidays and the like.

    I don't believe that it's possible to do this right now.  The act of checking in the object will effectively overwrite the last-modified-by property.  It would be possible to use some server-side code to set the value (e.g. you could set a different property, then use server-side code to read the value and set the last-modified-by).

    That said: I would urge some caution with doing so.  This would need to be written in such a way that the last-modified-by user is only updated in very controlled circumstances, otherwise the usefulness of the object history data is compromised.  It may also affect some external auditing concerns.  If this is a concern for you then I would consider whether the most appropriate approach would be to let the created-by and last-modified-by be the service account (as that, logically, is what has done the change), and store your values in separate metadata.

    Regards,

    Craig.

  • Hi Craig,

    thank you very much for your response.
    As you have suggested I've implemented last-modified-by-2.

    regards
    Tobias