Function to change status of shipment after 3 days
Hello!
I am trying to make a function that through a workflow, changes the status of the shipment to "delivered" after 3 days. The 3 days time is made with the workflow, but the update function is not working. When I try to debug it always give me this error:
Check and update the code in line 13 as there is a Exception : Value is empty and 'getJSON' function cannot be applied
This is the code. Can someone tell me what I am doing wrong?
- salesorderID = salesorder.get("salesorder_id");
- organizationID = organization.get("organization_id");
- authtoken = "02bxxx";
- response = zoho.inventory.getRecordsByID("SalesOrders",organizationID,salesorderID);
- listaPaquetes = response.getJSON("salesorder").getJSON("packages").toJSONList();
- for each paquete in listaPaquetes
- {
- packid = response.getJSON("salesorder").getJSON("packages").getJSON("package_id");
- if(!paquete.getJSON("status").isempty())
- {
- estadoPaquete = paquete.getJSON("status");
- }
- if(estadoPaquete = "not_shipped")
- {
- item = Map();
- item.put("status","delivered");
- info item;
- response = zoho.inventory.updateRecord("Packages","organizationID","packid",item);
- info response;
- }
- // info item;
- }