Set up a reminder automation

Set up a reminder automation

Hello!

I am having some trouble figuring out the Deluge script for an automation I would like to apply to my database.

I have a main profile form that has several subforms connected to it.  One of the subforms is an assessment that is done every 6 months for the family associated with the main profile.  

How can I set up an automation that would send an email reminder to the consultant (who is a user in the customer portal, and they are associated to the family within the main profile form) within 5 and a half months (approximately 166 days) after the most recent assessment for that family?  I'm not that proficient with the Deluge script, and with my basic knowledge, all of the script I'm writing isn't working.  I'm probably way off, but here is what I have so far:

  1. temp = ASL_Assessment_Report[ID != 0];
  2. for each  x in temp
  3. getDays = days360(x.Date_of_Assessment_Period,zoho.currentdate);

  4. if(getDays = 166) {
  5. sendmail
  6. from : zoho.adminuserid
  7. to : 
  8. subject: "ASL Assessment Due" 
  9. message : "This is a reminder that the ASL Assessment for x.Deaf_child_profile is due in 2 weeks.  Please log into your Zoho account to view your records." 
  10. ]
  11. }
  12. }
Note that the "To:" field is blank - this is because the email I need to add is actually associated with the Deaf_Child_Profile (main profile) form, and not it's subform of the ASL_Assessment_Report - and I'm not sure how to make that connection in the code.  

The reason I used the getDays function the way I did was because I only wanted the email reminder to go out once, when it is exactly 166 days since the most recent assessment.  If there's a better way (and there more than likely is), please let me know.

Any help is appreciated!!