Hello,
I’m trying to create a Job Card via the API, but I’m encountering the following error:
TypeError: ‘str’ object does not support item assignment.
The JSON I’m sending looks like this:
json
Copy
{
“doctype”: “Job Card”,
“work_order”: “MFG-WO-2025-00020”,
“employee”: “HR-EMP-00001”,
“operation”: “748700 HEA GLO”,
“workstation”: “CNC GLODALICA 1”,
“status”: “Work In Progress”,
“for_quantity”: 1
}
The response from ERPNext is:
json
Copy
{
“exception”: “TypeError: ‘str’ object does not support item assignment”,
“exc_type”: “TypeError”,
“exc”: “…”
}
Could someone help me understand what’s wrong with the JSON or how to properly create a Job Card via the API?
Employee field in the Job Card Doctype is a Table MultiSelect, so you need to pass the employee data as an array of objects, not a single string.
{
“doctype”: “Job Card”,
“work_order”: “MFG-WO-2025-00020”,
“employee”: [
{
“employee”: “HR-EMP-00001”
}
],
“operation”: “748700 HEA GLO”,
“workstation”: “CNC GLODALICA 1”,
“status”: “Work In Progress”,
“for_quantity”: 1
}
Now im facing another one
How to properly start (start_job) and complete (complete_job) a Job Card in ERPNext via API?
Problem Description:
I am trying to manage a Job Card in ERPNext via the API, but I am encountering a KeyError: ‘run_method’ error when attempting to start (start_job) and complete (complete_job) the Job Card. Can someone help me understand how to properly execute these actions?