# observe\_rsc\_update\_done/2

Source: https://zotonic.com/docs/1981/observe_rsc_update_done-2

URI: https://zotonic.com/id/1981

Language: en



An updated resource has just been persisted. Observe this notification to execute follow-up actions for a resource update.

Type:

[notify](/id/doc_developerguide_notifications#notification-notify)

Return:

return value is ignored

`#rsc_update_done{}` properties:

- action: `insert|update|delete`
- id: `m_rsc:resource_id()`
- pre\_is\_a: `list`
- post\_is\_a: `list`
- pre\_props: `m_rsc:props()`
- post\_props: `m_rsc:props()`

`pre_is_a`

List of resource categories before the update.

`post_is_a`

List of resource categories after the update.

`pre_props`

Map of properties before the update.

`post_props`

Map of properties after the update.

Example
-------

Add some default edges when a resource is created:

```erlang
observe_rsc_update_done(#rsc_update_done{action = insert, id = Id, post_is_a = PostIsA, post_props = Props}, Context) ->
    case lists:member(activity, PostIsA) of
        false ->
            ok;
        true ->
            m_my_rsc:create_default_edges(Id, Context),
            ok
    end;
observe_rsc_update_done(#rsc_update_done{}, _Context) ->
    %% Fall through
    ok.
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1981?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1981?language=en>)
