I would like to make the attachment as mandatory field when I change from State 1 to State 2. Here is how I did, due to unable to make System.AttachedFileCount as Required field, I created a custom field "Custom.HasAttachment" and set the following rule in the transition:
<FIELD refname="Custom.HasAttachment">
<WHEN field="System.AttachedFileCount" value="0">
<COPY from="value" value="No Attachment" />
<PROHIBITEDVALUES expanditems="false">
<LISTITEM value="No Attachment" />
</PROHIBITEDVALUES>
</WHEN>
<WHENNOT field="System.AttachedFileCount" value="0">
<COPY from="value" value="Has Attachment" />
</WHENNOT>
I manage to get the expected result in Visual Studio 2015, but it doesn't work as expected in team web access. During testing, I added a file, the error message is closed, then I remove the file, the error message is not appeared in Web Access (In Visual Studio, it does appeared back!). Somehow, team web access doesn't detect the same behavior.