CreateRandDSchedule API¶
Creates a new Retention and Disposition (R&D) schedule definition. Once created, the schedule can be assigned to documents and folders via SetDocumentRandDSchedule and SetFolderRandDSchedule.
Endpoint¶
Methods¶
- GET
/srv.asmx/CreateRandDSchedule?authenticationTicket=...&RDDefXML=... - POST
/srv.asmx/CreateRandDSchedule(form data) - SOAP Action:
http://tempuri.org/CreateRandDSchedule
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
authenticationTicket |
string | Yes | Authentication ticket obtained from AuthenticateUser. |
RDDefXML |
string | Yes | XML string defining the schedule. See format below. |
RDDefXML Format¶
The XML must have a root element (element name is not significant) with the following attributes:
| Attribute | Type | Max Length | Required | Description |
|---|---|---|---|---|
Name |
string | 128 | Yes | Schedule name. |
Description |
string | 255 | Yes | Schedule description. |
URL |
string | 255 | No | External documentation URL. |
ReferenceNumber |
string | 20 | No | Regulatory reference or citation number. |
SourceAuthority |
string | 64 | No | Name of the regulatory authority (e.g., NARA). |
RecordsSeriesName |
string | 100 | No | Records series name. |
RetentionType |
int | -" | Yes | 0 = None, 1 = Temporary, 2 = Permanent. |
RetentionTrigger |
int | -" | Yes for Temporary | 1 = On Create, 2 = On Cutoff. Required when RetentionType=1, and 0 (Custom Date Entry) is refused there. Forced to 1 when RetentionType=2. |
RetentionPeriodYears |
int | -" | Yes for Temporary | Years to retain. At least one of years, months and days must be > 0 when RetentionType=1. All three are forced to 0 when RetentionType=2. |
RetentionPeriodMonths |
int | -" | Yes for Temporary | Additional months to retain. |
RetentionPeriodDays |
int | -" | Yes for Temporary | Additional days to retain. |
DispositionType |
int | -" | Yes | 0 = None, 1 = Final Disposition, 2 = Transfer to External Agency. |
DispositionTrigger |
int | -" | Yes if DispositionType > 0 | 0 = Custom Date Entry, 1 = On Create, 2 = On Cutoff, 3 = On Retention End. Must be 3 when RetentionType=1, and 3 is refused when RetentionType=0. |
DispositionPeriodYears |
int | -" | Yes if DispositionType > 0 | Years after the disposition trigger. At least one of years, months and days must be > 0. |
DispositionPeriodMonths |
int | -" | No | Additional months. |
DispositionPeriodDays |
int | -" | No | Additional days. |
TransferAgency |
string | 100 | Yes if DispositionType=2 | Agency name for the transfer destination. |
MoveFolderId |
int | -" | No | Folder ID for transfer destination folder. |
CreateTask |
boolean | -" | No | true to create a workflow task when disposition is triggered. Defaults to true if omitted; automatically forced to false when DispositionType=0. The daily disposition job creates a Dispose (or Transfer) task for a member of the R&D Managers group (the system administrator if none), due 3 days after the disposition date. Documents only; ignored for folders. Nothing is deleted until someone runs DisposeItem. |
SendEmail |
boolean | -" | No | true to send an email notification when disposition is triggered. Defaults to true if omitted; automatically forced to false when DispositionType=0. |
Example XML:
<RDSchedule
Name="Standard 7-Year Retention"
Description="Retain documents for 7 years then destroy"
ReferenceNumber="FIN-001"
SourceAuthority="IRS"
RetentionType="2"
RetentionTrigger="1"
RetentionPeriodYears="7"
RetentionPeriodMonths="0"
RetentionPeriodDays="0"
DispositionType="1"
DispositionTrigger="3"
DispositionPeriodYears="0"
DispositionPeriodMonths="0"
DispositionPeriodDays="0"
TransferAgency=""
MoveFolderId="0"
CreateTask="true"
SendEmail="true"
/>
Response¶
Success Response¶
DefId: Auto-generated integer ID of the new schedule definition. Use this value when assigning the schedule to documents or folders.
Error Response¶
Required Permissions¶
Any authenticated user. Anonymous access is not allowed.
Example¶
GET Request¶
GET /srv.asmx/CreateRandDSchedule
?authenticationTicket=3f7a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c
&RDDefXML=<RDSchedule+Name="7-Year+Finance"+Description="Finance+documents+7yr".../>
HTTP/1.1
Host: yourserver
POST Request¶
POST /srv.asmx/CreateRandDSchedule HTTP/1.1
Host: yourserver
Content-Type: application/x-www-form-urlencoded
authenticationTicket=3f7a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c&RDDefXML=<RDSchedule Name="7-Year Finance" Description="Finance documents 7yr" RetentionType="2" RetentionTrigger="1" RetentionPeriodYears="7" RetentionPeriodMonths="0" RetentionPeriodDays="0" DispositionType="1" DispositionTrigger="3" DispositionPeriodYears="0" DispositionPeriodMonths="0" DispositionPeriodDays="0"/>
JavaScript¶
Every call answers XML with HTTP 200, success or not, so success is the thing to branch on and
errorCode is the number to report.
async function call(action, params) {
const response = await fetch(`/srv.asmx/${action}?${new URLSearchParams(params)}`);
const root = new DOMParser()
.parseFromString(await response.text(), 'text/xml')
.documentElement;
if (root.getAttribute('success') !== 'true') {
throw new Error(`${root.getAttribute('errorCode')}: ${root.getAttribute('error')}`);
}
return root;
}
Creates a schedule. Every value is an attribute of the root element, and the element's own name is never looked at.
const definition = `
<RetentionDispositionSchedule
Name="Seven year retention"
Description="Keep for seven years, then destroy"
ReferenceNumber="FIN-001"
SourceAuthority="IRS"
RecordsSeriesName="Finance"
RetentionType="1" <!-- 1 is Temporary, 2 is Permanent -->
RetentionTrigger="1" <!-- 1 On create, 2 On cut off -->
RetentionPeriodYears="7"
DispositionType="1" <!-- 1 Final disposition, 2 Transfer -->
DispositionTrigger="3" <!-- must be 3, On retention end, when retention is Temporary -->
DispositionPeriodDays="1"
CreateTask="false"
SendEmail="false" />`;
const root = await call('CreateRandDSchedule', {
authenticationTicket: ticket, RDDefXML: definition
});
const defId = root.querySelector('RetentionDispositionSchedule').getAttribute('DefId');
The rules the server enforces, in the order it checks them:
NameandDescriptionare both required. The name is at most 128 characters and takes letters, digits,_,-,.,,,(,)and spaces only.RetentionTypeandDispositionTypecannot both be0.- Temporary retention (
RetentionType="1") needsRetentionTriggerof1or2-0, the default, is refused - and at least one of the three retention periods above zero. - Permanent retention (
RetentionType="2") forces the trigger and all three periods to zero, and refuses a disposition: a retention that never ends has nothing for a disposition to be triggered by. Until 9.0 the whole disposition half of the document was zeroed in silence and the call still reported success, so a caller who asked for one was never told it had gone away. - A disposition needs at least one of its three periods above zero.
DispositionTrigger="3", on retention end, needs a retention type other than0.- With Temporary retention and any disposition,
DispositionTriggermust be3. The refusal names the rule: "When 'Temporary retention' is selected, the required disposition trigger is 'Upon retention end'." It used to quote a stray minutes abbreviation instead.
Notes¶
- Maximum lengths of the text attributes of
RDDefXML:Name128,Description255,URL255,ReferenceNumber20,SourceAuthority64,RecordsSeriesName100,TransferAgency100 characters. A longer value is refused with4000. RetentionTypeis0none,1temporary and2permanent - these two notes had the names the wrong way round until 9.0.- When
RetentionType = 2(permanent), all period values are automatically reset to 0 andRetentionTriggeris set toOn Create, and a disposition is refused: see below. - When
RetentionType = 1(temporary), at least one ofRetentionPeriodYears,RetentionPeriodMonths, orRetentionPeriodDaysmust be greater than 0. CreateTaskandSendEmailare only meaningful whenDispositionType > 0. WhenDispositionType = 0(None), both are automatically forced tofalseregardless of the values supplied.- If
CreateTaskorSendEmailare omitted from the XML, they default totrue(and will then be subject to the DispositionType rule above). - The returned
DefIdis needed for SetDocumentRandDSchedule, SetFolderRandDSchedule, GetRandDScheduleInfo, UpdateRandDSchedule, and DeleteRandDSchedule.
Related APIs¶
- GetRandDSchedules -" List all defined R&D schedule definitions.
- GetRandDScheduleInfo -" Get full details of a specific schedule.
- UpdateRandDSchedule -" Update an existing schedule definition.
- DeleteRandDSchedule -" Delete a schedule definition.
- SetDocumentRandDSchedule -" Assign a schedule to a document.
- SetFolderRandDSchedule -" Assign a schedule to a folder.
Error Codes¶
The errorCode values this operation returns, checked against a running server:
errorCode |
When |
|---|---|
4010 |
the ticket is expired or unknown |
4030 |
the caller may not manage retention schedules - including a caller with no ticket at all |
4090 |
a schedule of that name already exists |
4000 |
any of the validation rules above, or RDDefXML is not well formed |
HTTP 400 |
a required string parameter was empty; refused by model binding, so there is no error document |