Skip to main content
15-Moonstone
April 27, 2021
Question

Workflow notification to Object creator

  • April 27, 2021
  • 2 replies
  • 1635 views

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?

2 replies

1-Visitor
April 27, 2021

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

15-Moonstone
June 15, 2021

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