bodbupnik wrote:Hi, everybody. I have a question, How can I check in trigger whether user attach a file or not. I need to check it in BEFORE ADD MESSAGE trigger. If there is no one attached file, ask user to do it and don't let the system to finish "Add message" operataion. Sorry, if this question already discussed on the forum. The forum is quite big and I need to solve this as soon as possible/
import com.trackstudio.exception.UserException;
if (message.getAttachments().size() <= 0) {
throw new UserException("You need is add attach!");
}
return message;
Petr wrote:bodbupnik wrote:Hi, everybody. I have a question, How can I check in trigger whether user attach a file or not. I need to check it in BEFORE ADD MESSAGE trigger. If there is no one attached file, ask user to do it and don't let the system to finish "Add message" operataion. Sorry, if this question already discussed on the forum. The forum is quite big and I need to solve this as soon as possible/
Hi. Example for check attached files. Following is code;
- Code: Select all
import com.trackstudio.exception.UserException;
if (message.getAttachments().size() <= 0) {
throw new UserException("You need is add attach!");
}
return message;
bodbupnik wrote:I forget to write, we use 4.0 TrackStudio right now. Planning to change it on TrackStudio 4.17 soon
bodbupnik wrote:May be there is a "message.hasAttachment()" method in class 'com.trackstudio.secured.SecuredMessageTriggerBean' which return true if user attach a file in CURRENT operation (not in previous)?
import com.trackstudio.exception.UserException;
if (message.getAtts().size() <= 0) {
throw new UserException("You need is attach file!");
}
return message;
Users browsing this forum: No registered users and 0 guests