dispatchEvent('seek:draft:save').
It returns a Promise to a result object.
dispatchEvent('seek:draft:save') does not throw exceptions.Result property | Type | Description |
|---|---|---|
isError | boolean | Whether an error has occurred. |
data | object | null | An object that contains information about the draft job ad.Only present when isError is false. |
data.id | string | The ID of the saved draft job ad. |
data.isComplete | boolean | Whether the draft job ad has all mandatory fields complete and is ready for posting. |
isError will be false, and data.id will contain the saved draft’s ID.If data.isComplete is true, the draft can be posted as a job ad using the postPositionFromDraft mutation.
See post a draft job ad for more information.If data.isComplete is false, there are mandatory fields that the hirer has not yet completed.
Attempting to post a draft that is not complete will result in a BAD_USER_INPUT error from the SEEK API.data.id can be saved alongside the job requisition in your software as a SEEK job ad draft, and used to resume editing later.
If the hirer resumes their posting workflow from a draft, the id must be passed as the draftPositionProfileId prop to the render function.If there was some problem with saving the draft job ad, then isError will be true, and data will be null.
Instructions will be shown within the panel for the hirer to resolve and retry saving.const saveSeekDraftId = async (draftId, isComplete) => {
// Save the draft ID alongside the job requisition in your software.
};
const handleSubmitButton = async () => {
const result = await dispatchEvent('seek:questionnaire:save');
if (result.isError) {
// No draft ID will be provided if an error occurs.
// The panel will display an actionable error message to the hirer.
return;
}
await saveSeekDraftId(result.data.id, result.data.isComplete);
};
draftPositionProfileId as a prop to the render function.const props = {
jobRequisition: {
// ...
draftPositionProfileId: savedDraftId // The saved draft ID from your software
}
};
SeekApi.render(containerNode, 'enhancedJobPosting', props);
draftPositionProfile query.
This can be useful if your software displays a summary screen prior to posting the job ad.query draftPositionProfile($id: String!) {
draftPositionProfile(id: $id) {
id
positionTitle
location {
suburb
}
isComplete
}
}postedPositionProfilePreview query with the draftPositionProfileId.query ($draftPositionProfileId: String!) {
postedPositionProfilePreview(
draftPositionProfileId: $draftPositionProfileId
) {
previewUri {
url
}
}
}