Getting id of created record occasionally not working

Getting id of created record occasionally not working

Hey there!

I've got a function in Zoho CRM that get's triggered when a record is created via the Zoho E-Mail parser.
The function is working every time I start it from the editor or when only a few mails get parsed/records get created.
But when parsing multiple mails in a short time, the script fails occasionally because Zoho can't get the id of a newly created record from the function.

The code I use is:

  1. createOrder = zoho.crm.createRecord("Purchase_Orders",newOrderData);
  2. createOrderIDs = createOrder.get("id").toLong();
The error that is showing up then is:
"Value is empty and 'toLong' function cannot be applied at line Number 96"
(line 96 is line 2 from the sample code)

If I start the same function on the same record from the editor afterwards, everything works fine.

Do you have any idea what might be the cause here?
Is Zoho asking faster for the id than the record is created?