Create a draft and remove it
Remove a draft of an object by using the DestroyDraft method.
The children of the draft object (if any) are removed as well.
This method can be used to cancel the work on the draft of an object. For example, if you had created a draft of a sheet that is published, you might not want anymore to replace the published sheet.
Example
Prerequisite: A non-published app is opened. The handle of the app is 1.
The steps are the following:
- Creation of a sheet in the app.
- Add a child to the sheet.
- Publish the app (the sheet is published at the same time).
- Create a draft of the sheet.
- Remove the draft.
1. Create a sheet of identifier Sheet01 (qId is Sheet01). qChildListDef is added to the definition of the sheet in order to be able to list the children of the sheet.
The client sends:
The engine returns:
The sheet Sheet01 is created and has 2 as a handle.
2. Create a child in the sheet. The child is a list object with identifier LB01 (qId is LB01). The handle of the request is 2 because the sheet has 2 as a handle. A title and a description are added. The name of the field is Country (qFieldDefs is Country).
The client sends:
The engine returns:
The list object is created and has 3 as a handle.
3. Publish the app. The handle of the request is 1 because the Publish method applies at app level. The name of the published app is Golf Quest.qvf. The first parameter in the request corresponds to the identifier of the stream where the app is published.
The client sends:
The engine returns:
The app and all its objects are published, which means that the sheet Sheet01 is also published. The published sheet contains one object, which is the list object LB01.
4. Create a draft of the published sheet. The identifier of the sheet is Sheet01.
The client sends:
The engine returns:
The draft is created. The identifier of the draft (qDraftId) is returned.
5. Remove the draft. The first parameter is the identifier of the draft. The second parameter is the identifier of the source object (the object from which the draft was created).
The client sends:
The engine returns:
The draft of the sheet Sheet01 is successfully removed (qSucess is true).