Assign template pages
fabrement-assign-template-pagesGive records this template, or take it away. mode is required. add / remove touch only the ids you pass; replace makes pageIds the exact set and releases every other record that had it — use it when you know the whole set, and list-template-pages first. Works on a record of any public type, not just the ones that take a template by default. For a whole-type frame use set-default-template instead.
Rules: get-skill-doc {id:"template-contract"} — read it before the first call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Required — there is no default. replace: the set becomes exactly pageIds, and every other record picking this template is released — send it only when you know the whole set. add: these records take the template, everything else is left alone. remove: these records release it, everything else is left alone. | |
| pageIds | Yes | The ids this call is about. With mode replace this is the FULL set and anything missing from it loses the template; with add or remove it is only the records to change. | |
| templateId | Yes | Template id from list-templates. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | The mode this call ran in. | |
| note | No | Present with tookFrom: what each record left, and how to put it back when that is possible. | |
| cleared | Yes | Records released from THIS template. One that changed hands to another template is in `tookFrom`, not here. It counts records INCLUDING any in the trash, which `pageCount` never counts — so clearing a binned pick moves this and leaves `pageCount` where it was. | |
| assigned | Yes | Records this call WROTE the template to. One that already carried it is not counted again. | |
| tookFrom | No | Records that were carrying a DIFFERENT template and now carry this one. Absent when none did. | |
| pageCount | Yes | How many records carry this template AFTER the call — the whole set, not just what this call wrote, so it is normally the larger of the two. |