Count lapsed times between Added-Time for Records created by the Emailed Data process?

Count lapsed times between Added-Time for Records created by the Emailed Data process?

BACKGROUND INFO: I have onSuccess script that works fine for the regular add record process, but doesn't work when records are created through emailed data. The script (shown below) enters the lapsed time between the creation of the new record and the most recent record created that day with the same value in the Person field, i.e. that meets the criteria : (Person == input.Person and Added_Time == today). This image shows that the first record created (Record Number 1) using the normal Add within Zoho Creator has a time lapse of 0.00 since the script sets that value to 0.00 when a record is the first of the day and therefore has no previous record to count lapsed time against. Then Record Number 2, again normally added within Zoho Creator, has a correct time lapse of 0.03 when the added times of Records 1 & 2 are compared. Record Number 3, though, does not enter the correct time lapse. Record 3 was added through an Email Data submission. The time lapse between Records 2 & 3 is about the same as between 1 & 2 and and therefore should show 0.03 as well, but instead it shows 0.00. Record 4 was added within Zoho Creator and once again it does show the correct lapsed time since the creation of Record 3.

I think the problem is that when a record is created through emailed data Zoho Creator can't recognize any input values until the record creation is finalized and therefore the criteria is not recognized. UPDATE: The more I tested this the more I concluded that the problem is as stated just above. I created a WORKAROUND, though. I trained my users to add a string to their text messages to differentiate an "in" from and "out" so that instead of counting lapse against the last record "sort by  Added_Time desc;" -- I count lapse only for the "outs" against the last "in". I also added script that sends management an email if there occurs a lapsed time greater than the norm which woul d indicate that a user did not add the required string properly to their message. 

QUESTION: Is there anyway to accomplish the task of counting lapsed times between records created by the Emailed Data process? 




















  1. LastRecThisPerson  =  ThisForm  [(Person = input.Person && ID < input.ID && Added_Time == today)] sort by  Added_Time desc;
  2. if (LastRecThisPerson.ID  ==  null)
  3. {
  4. input.LapsedTimeInHours = 0.00;
  5. }
  6. if (LastRecThisPerson.ID  >  100)
  7. {
  8. input.LapsedTimeInHours = ((zoho.currenttime -LastRecThisPerson.Added_Time)  /  1000  /  60 /  60);
  9. }