Ticket
OBS! moveAttachments krÀver att FileUpload komponenter i formulÀret Àr namngivna.
count(props) props = { enableFilter: boolean,
filterStatus: string,
filterForm: string[],
anonymous: boolean,
createdToday: boolean,
updatedToday: boolean, withRoleGroups: boolean,
enableAdvancedFilters: boolean,
advancedFilter: object, }
Number
let ticket = sp3.ticket()
// We could run this to see how many tickets there
// are in the "start" status for the listed forms.
let ticketCount = await ticket.count({
enableFilter: true,
filterStatus: "start",
filterForm: ["formId1", "formId2"],
anonymous: true
})
return ticketCount
getAttachments({ formDataId, expandInfo })
Array with all attachments on given ticket. JSON
let ticket = sp3.ticket()
let attachments = await ticket.getAttachments({
formDataId: "ticketId / formDataId", //tickets are stored as formData in the DB
expandInfo: true //adds more fields, including base64 string
})
return attachments
getReciept({ formDataId,
base64 })
Receipt represented in JSON
let ticket = sp3.ticket()
let receipt = await ticket.getReceipt({
formDataId: "ticketId / formDataId", //tickets are stored as formData in the DB
base64: true //adds base64 string
})
return receipt
totalByField( formId,
field ) Field kan vara valfritt fÀlt som finns pÄ formDatan, Àven nestade fÀlt sÄsom "assign.owner". GÄr Àven att ange id pÄ komponent i formulÀret.
Array som representerar antalet tickets i angivet formulÀr, grupperade per field. JSON
let ticket = sp3.ticket()
let result = await ticket.totalByField(
"formId",
"formComponentId"
)
return result
totalByMonths( formId,
field ) Field kan vara valfritt fÀlt som finns pÄ formDatan, Àven nestade fÀlt sÄsom "assign.owner". GÄr Àven att ange id pÄ komponent i formulÀret.
Array som representerar antalet tickets i angivet formulÀr, grupperade per field och mÄnad. JSON
let ticket = sp3.ticket()
let result = await ticket.totalByMonths(
"formId",
"status"
)
return result
moveAttachment( id, destinationId ) id = id pÄ attachment destinationId = formDataId som ska ta emot filen.
StrÀng som beskriver vilken fil som flyttats och var den hamnat. "Attachment {id} --> formData {destinationId}"
let ticket = sp3.ticket()
const assetId = context.effects.assetId
// Assuming there is an effect determining the assetId
const destinationId = context.effects.destinationId
// Assuming there is an effect determining the destinationId
let res = await ticket.moveAttachment({
id: assetId,
destinationId: destinationId
})
return res
moveAttachments( formDataId, destinationId, assetMap (optional) ) formDataId = frormData att flytta frÄn destinationId = formData att flytta till assetMap = object som beskriver flytt av filer mellan FileUpload komponenter. Ange komponenternas id { componentId1: componentId2, componentId2: componentId1 }
OBS! Funktionen krÀver att samtliga FileUpload komponenter i formulÀret Àr namngivna
Returnerar: Array av strÀngar som beskriver vilka filer som flyttats och var de hamnat. [ "Attachment {id} --> formData {destinationId}", ... ]
let ticket = sp3.ticket()
const destinationId = context.effects.destinationId
// Assuming there is an effect determining the destinationId
let res = await ticket.moveAttachments({
formDataId: context.formData._id,
destinationId: destinationId,
assetMap: {
"FileUpload componentId1": "FileUpload componentId2",
"FileUpload componentId2": "FileUpload componentId1"
}
})
// This assetMap will swap files between the two components while moving them to the destinationId
return res
Last updated