Create job from template
Parameter | Mandatory | Description | Examples | More Info |
---|---|---|---|---|
API | Yes | The API area | jobs.json | |
General | Yes | Parameters described in overview | user=user&password=user | Structure of an API call |
Action | Yes | The action to perform | action=create | |
Add new lookup | No | Flag to add any custom field values to lookup list | LookupValuesAddToLists=True | |
Input | Yes | JSON string | See below |
JSON Input | Mandatory | Description | Examples |
---|---|---|---|
varJobTemplate | Yes | Specify the template to use | "varJobTemplate": "8/00800001" |
jobClientCode | Yes | Client code - see clients API | "jobClientCode": "8/1244" |
jobDateIn | No | Date in | "jobDateIn": "2017/04/01" |
jobDateDue | No | Date due | "jobDateDue": "2017/04/30" |
jobNumber | No | Job number | "jobNumber": "8/00JON6" |
jobDescription | No | Job description | "jobDescription": "My new job description" |
jobComments | No | Job comments | "jobComments": "My new job comments" |
jobJobtypeCode | No | Job type code - see job types API | "jobJobtypeCode": "8/10" |
jobHandleruserid | No | Handler ID - see users API | "jobHandleruserid": "3" |
jobHandlerTeam | No | Job team - see teams API | "jobHandlerTeam": ""8/DQS" |
jobStatus | No | 1=Quote 2=Live 3=In house 4=On hold 5=Special | "jobStatus": "2" |
jobPrefixOnly | No | Pass this param if you need to add a prefix to an automatic job number | "jobPrefixOnly": "JN" |
jobReferenceJob | No | Reference Job field - if not passed the reference job will be set to the job number of the template job used. | "jobReferenceJob": "ABC1000" |
jobContactInternalRef | No | Client contact ID Job client contact | "jobContactInternalRef": 8600 |
jobProjectCode | No | Project code | "jobProjectCode": 388 |
jobCampaignNo | No | Campaign code | "jobCampaignNo": 268 |
Job templates
New jobs are typically created from a job template. However, any job can be used as a template. The fields copied over to the new job are defined by the default 'options view'. If you require a different options view this can be achieved be setting up a new default options view for the API user.
Options view
Options views can be created in the 'Create/copy job interface' in Synergist
e.g.
Job numbers
If no job number is being passed in the API call and the system is set to use automatic job numbers, any automatic job prefixes will be added to the generated job number. If you wish to pass a manual prefix you can (see above) but this will only be accepted if the company settings allow for manual prefixes.
Dates
In a system where dates are driven by phase/stages (see date controls in company settings), the due date should not be passed - all due dates are then calculated by the durations set in the phases/stage in the template being used. If a due date is passed this overrides the due dates set in the template and all phases and stages are given the same due date (the date passed). If a due date is passed that is earlier than the start date no error is returned but the due date in the request is ignored.
Sales status
If the template is set to Quote, and this is being overridden by passing Status=2 (Live) it will set the Sales Status to the default for Live status , rather than a Quote status (and vice versa).
Example request:
http://<SERVER>/jsonAPI/jobs.json?user=user&password=user&action=create&company=8&version=3.9&input={
"data": [
{
"varJobTemplate": "8/00800001",
"jobHandleruserid": "3",
"jobClientCode": "8/1244",
"jobJobtypeCode": "8/10",
"jobNumber": "8/00MJP20",
"jobDescription": "Mynewjobdescription",
"jobDateIn": "2017/12/06",
"jobDateDue": "2017/12/07",
"jobHandlerTeam": "8/DQS",
"jobStatus": "2",
"jobContactInternalRef": 8600,
"jobProjectCode": 388,
"jobCampaignNo": 268
}
]
}
Example response:
{
"responsecode": 1,
"responsestatus": "OK",
"errorcode": 0,
"errormessage": "",
"responsemessage": "data processed successfully.",
"warningmessage": "",
"success": true,
"data": [
{
"jobNumber": "8/00MJP20",
"jobUuid": "E5569957F40EF943A3C32BCAAD542633",
"jobTimeStampModified": 1523625197,
"jobRecommendedVersionNumber": 7
}
]
}