set(entity, key1, value1, key2, value2, ..., keyN, valueN)
 set(entity, json)
 set(entity, map)

Sets the passed values for the given property keys on the specified entity, using the security context of the current user.
set() accepts several different parameter combinations, where the first parameter is always a graph object. The second parameter can either be a list of (key, value) pairs, a JSON-coded string (to accept return values of the geocode() function) or a map (e.g. a result from nested function calls or a simple map built in serverside JavaScript).

When using the set() method on an entity that is not writable by the current user, a 403 Forbidden HTTP error will be thrown. In this case, use set_privileged() which will execute the set() operation with elevated privileges.


// Key-Value examples
${set(user, 'name', 'new-user-name', 'eMail', '')}
${set(page, 'name', 'my-page-name')}

// JSON examples
${set(this, geocode(this.street,,}
${set(user, "{name: 'new-user-name', age: 42, eMail: ''}")}

// JavaScript example
    var me =;
    Structr.set(me, {name: 'my-new-name', eMail: ''});


Related Articles
About this article
Last change 2018-01-25
Topics FrontendFunctionsStructr 2.0