How do I ensure my attachments are synced before adding them to an email or pdf?

I want to attach signatures, documents, or photos to an email or pdf, and I am using CloudCode to process my data. How can I ensure that the attachment has been uploaded before the CloudCode task is triggered?

See the example below:

Say your model has a field, customer_signature of type: signature. You want to ensure that before the ready webhook is fired to CC, the signature is uploaded. This is accomplished by adding the field attribute to the webhook, and setting the state to uploaded. The valid options for state are uploaded and present. If you only want to check that it has been captured for a given task, present is sufficient.

<webhook type="ready" receiver="cloudcode" action="mytask" >
   <field name="customer_signature" state="uploaded" required="true" embed="true" />
</webhook>
4 Likes