The access details worked, thank you.
I'll be studying the setup and will share the next recommendations, accordingly.
Thank you for your patience.
Just wanted to let you know that I'm still working on this and will share the findings, as soon as I can.
Thank you Waqar. Take your time, I appreciate your help.
We had an unusually busy forum queue over the weekend, but, I'll be resuming work on this, today.
Thank you for waiting.
After reviewing the requirements and performing some tests on my website, I'll recommend controlling the conditional nature of the form notification, through the "cred_notification_recipients" filter:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_notification_recipients
In summary, you'll
1. Create a form notification for the form "Submit Button Only", as you would create it to be sent without any conditions.
2. Next, through a custom function attached to the "cred_notification_recipients" filter, you'll check whether the final requisition meets the criteria for the notification to be sent or not.
If the criteria are fulfilled, you'll leave the recipients of the form notification as it is, which will mean that it should be sent, as normal.
And if the criteria are not fulfilled, you'll set the "$recipients" array to empty, which will mean that it shouldn't be sent to anyone.
3. Inside the custom function attached to the "cred_notification_recipients" filter, you'll have the ID of the current "Requisition" post. Through this, you'll be able to get the related "Req Items" posts too, using the 'toolset_get_related_posts' function:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
You'll find a relevant code example of this "recipients" manipulation in this support thread:
https://toolset.com/forums/topic/split-send-a-different-notification-email-after-submitting-based-on-whether-or-not-the-field-is-selected/#post-2129671
I hope this helps and please let me know if you have any follow-up questions.
So, if i understand correctly, I need to take my existing code and wrap it in the "cred_notification_recipients" filter, which will give me the ID of the current post to use in pulling the child post fields which I can loop through for the condition on my if statement that will determine whether the notification should be sent or not.
Have I got that right?
Yes, your understanding is correct.
You'll not need any code in the main function "do_post_things", for the processing of this email notification. You can keep it only for updating any custom field values, on form submission.
The code for conditional processing of the email notification will need to be added to the function attached to the 'cred_notification_recipients' filter.