ZohoCRM API V2 /w PHP SDK 3 - INVALID MODULE

ZohoCRM API V2 /w PHP SDK 3 - INVALID MODULE

I'm trying to add a SalesOrder to Zoho CRM via the PHP SDK3.
So far I have Zoho connecting, and I have successfully created a "Lead" based on the sample code. Now I am trying to get a SalesOrder created in the system but am hitting the exception:


API_EXCEPTION - {"code":"INVALID_MODULE","status":"error","message":"the module name given seems to be invalid"}


Here is the code I am using:

  1. <?php

    use com\zoho\crm\api\util\Constants;
    use com\zoho\crm\api\record\RecordOperations;
    use com\zoho\crm\api\record\Record;
    use com\zoho\crm\api\record\Field;
    use com\zoho\crm\api\record\Sales_Orders;
    use com\zoho\crm\api\record\Leads;
    use com\zoho\crm\api\record\Accounts;
    use com\zoho\crm\api\record\Events;
    use com\zoho\crm\api\record\BodyWrapper;
    use com\zoho\crm\api\tags\Tag;
    use com\zoho\crm\api\record\InventoryLineItems;
    use com\zoho\crm\api\record\LineItemProduct;

    function insertSalesOrder() {
    echo "<br/>insertSalesOrder...<br/>";

    $moduleAPIName = Constants::SALESORDERS; //"Sales Orders"; //"salesorders"; //Constants::SALESORDERS;

    echo $moduleAPIName;

    //Get instance of RecordOperations Class that takes moduleAPIName as parameter
    $recordOperations = new RecordOperations();
    //Get instance of BodyWrapper Class that will contain the request body
    $bodyWrapper = new BodyWrapper();
    //List of Record instances
    $records = array();
    //$recordClass = 'com\zoho\crm\api\record\Record';
    //Get instance of Record Class
    $record1 = new Record(); //$recordClass();
    /*
    * Call addFieldValue method that takes two arguments
    * 1 -> Call Field "." and choose the module from the displayed list and press "." and choose the field name from the displayed list.
    * 2 -> Value
    */
    $field = new Field("");
    //$record1->addFieldValue(Leads::LastName(), "TEST FROm PHP");

    $record1->addFieldValue(Sales_Orders::Subject(), "TEST FROm PHP subject");
    //$record1->addFieldValue(Sales_Orders::ProductDetails(), "TEST FROm PHP product details");
    $record1->addFieldValue(Accounts::AccountName(), "Account_Name");

    $productId = '3194657000031371025'; // grabbed form url: https://crm.zoho.com/crm/org665997644/tab/Products/3194657000031371025
    //$lineItem = new InventoryLineItems();
    //$lineItem->setDescription("test product description");
    //$lineItem->setDiscount(5);
    //$lineItem->setListPrice(100);

    $inventoryLineItemList = array();
    $inventoryLineItem = new InventoryLineItems();

    $lineItemProduct = new LineItemProduct();
    $lineItemProduct->setId($productId); //"3477061000005356009");
    $inventoryLineItem->setProduct($lineItemProduct);
    $inventoryLineItem->setQuantity(1.5);
    $inventoryLineItem->setProductDescription("productDescription");
    $inventoryLineItem->setListPrice(10.0);
    $inventoryLineItem->setDiscount("5.0");
    $inventoryLineItem->setDiscount("5.25%");
    /*
    $lineItemProduct = new LineItemProduct();
    $lineItemProduct->setId($productId); //"34770615356009");
    $inventoryLineItem->addKeyValue("Product_Name", $lineItemProduct);
    $inventoryLineItem->addKeyValue("Quantity", 1.5);
    $inventoryLineItem->addKeyValue("Description", "productDescription");
    $inventoryLineItem->addKeyValue("ListPrice", 10.0);
    $inventoryLineItem->addKeyValue("Discount", "5%");
    */
    //$record1->addLineItem($lineItem);

    array_push($inventoryLineItemList, $inventoryLineItem);
    $record1->addKeyValue("Product_Details", $inventoryLineItemList);

    /*
    $record1->addKeyValue("Date_1", new \DateTime('2021-03-08'));
    $record1->addKeyValue("Date_Time_2", date_create("2020-06-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get())));
    $startdatetime = date_create("2020-06-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
    $record1->addFieldValue(Events::StartDateTime(), $startdatetime);
    $record1->addFieldValue(Events::EventTitle(), "TEST From PHP");
    $enddatetime = date_create("2020-07-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
    $record1->addFieldValue(Events::EndDateTime(), $enddatetime);
    $tagList = array();
    $tag = new Tag();
    $tag->setName("Testtask");
    array_push($tagList, $tag);
    //Set the list to Tags in Record instance
    $record1->setTag($tagList);
    */
    array_push($records, $record1); // pushing the record to the array

    $bodyWrapper->setData($records);
    $trigger = array("approval", "workflow", "blueprint");
    $bodyWrapper->setTrigger($trigger);
    $response = $recordOperations->createRecords($moduleAPIName,$bodyWrapper);

    echo "<br/>RESPONSE:<br/>";
    echo print_r($response);
    }



I've also tried calling getModules API and it is showing me there is a SalesOrder module name.

Can anyone help which might be wrong?