Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi, Im trying to make a very simple workflow to manage a sort of data submission queue for 3D printing. I need to send an email to the creator of the Document when the queue manager changes the state of the document to "complete", I have the email trigger set up to send to "creator" but that only send to the person changing the state, I cant see an obvious way to send it to the priarybusinessobject "created by" user, how can I get this info and hook it into the workflow notification?
Hello,
why don't you insert a notification task in the workflow itself.
In the recipient, you can put a variable that has previously been set to the document creator using
either wtDoc.getCreator() or wtDoc.getCreatorEMail().
Florent
I ended up writing some code like this in a workflow expression:
//Find the document creator
String usermail = ((wt.enterprise.RevisionControlled)primaryBusinessObject).getCreatorEMail();
//Find the Document number
String docNumber = ((wt.doc.WTDocument)primaryBusinessObject).getNumber();
//Instantiate a new SendMail task
com.infoengine.SAK.Task newmail = new com.infoengine.SAK.Task("wt/mail/SendMail.xml");
//Set parameters . Modify as needed
newmail.addParam("FROM",me@mycompany.co.uk);
newmail.addParam("TO",usermail);
newmail.addParam("SUBJECT", docNumber);
newmail.addParam("CONTENT", docNumber);
//Send the mail
System.out.println("sending email");
newmail.invoke();
In the end I actually put some conditional statements in there to send different emails depending on what the state of the object was. I found most of what I needed in the knowledge base and the Java API documentation