How to Send an email notification to the R&D group when we release a CO?
Problem Summary
—————————————————
send an email notification to the R&D group when we release a CO
Problem Description
—————————————————
The requirement is to send an email notification to the R&D group when we release a CO with affected document items which have the owning organization of R&D *.
I tried to configure a criteria and place it in the Release workflow step but it doesn’t seem to be working. It sends an email but it does it for all documents.
Users are neither approvers nor observers nor acknowledgers. They are just notifiers.
Status Criteria Matching Type is set to All.
I use a similar technique to notify our manufacturing group in China when an ECO is released that has an affected item with the “Facilities External” field populated with China.
I have the Status Criteria Matching type set to “Some” so that no notification is sent out for ECO’s that do not relate to our China division.
I would suggest changing the Status Matching Criteria type to “Some”
What I would do is create your Criteria and add it into the workflow. Then create a User Group for R&D and add the all the users that need to be notified to the User Group. Then place the User Group in the workflow for the criteria in the Notify upon entry. If it is sending for all documents and not a specific set then I would guess you need to modify your criteria.
I have found that the workflow status criteria only looks at the data that can be viewed on change itself.
In other words – if the “owning organization” field cannot be seen at the change object level (I.E. – on the affected items tab) – you will not be able to set criteria for workflow notifications based on the value of this field.
Solution – Configure the Item Page 2 field to “read-through” to the affected items tab of the change.
In the Java client, enable the corresponding “Item P2” field to be visible on the affected items tab of the change. You can then set your status criteria at the change object level. and then the status criteria for notifications should work the way that you want it to.
NOTE- this is all assuming that the owning organization field is a Document Page Two attribute.
Try, R&D unique group id (All members to be link the group) has to be created on the server.
Then you can loop the group mail_id in every CO (MCO/ RFA/ECO/RMA).
Add them in the Notifier list (inside work flow).
Once CO is moved to Released Status, they get mail notification.
Actually we are writing a px for the above problem,
But we are getting *illegal argument exception* for
changestatus.setNotifiers(usergroup1); //Error_Line
Here is the snippet:
public class SetNotifiersEvent implements IEventAction { public IRow row1; IUserGroup usergroup; @Override public EventActionResult doAction(IAgileSession session, INode node, IEventInfo info) { try { //IChange change = null; IWFChangeStatusEventInfo changestatus = (IWFChangeStatusEventInfo) info; IChange change; String str1 = ""; //IItem itm; IDataObject obj = changestatus.getDataObject(); Collection al = new ArrayList(); if(obj instanceof IChange) { change = (IChange) obj; ITable table = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS); Iterator it = table.iterator(); while(it.hasNext()) { IRow row = (IRow) it.next(); ICell attr = (ICell) row.getCell(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_TYPE); String itemNumber = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER); IAgileList str = (IAgileList) attr.getValue(); change.logAction(str.toString()); //IAgileList[] list1 = str.getSelection(); //change.logAction(list1.toString()); change.logAction("Inside while, Before IF3-"+str); //change.logAction("Inside while, Before IF2-"+str.getName()); //change.logAction("Inside while, Before IF1-"+str.getValue()); if((str.toString()).equals("Business Process (Document Type)")|| (str.toString()).equals("Product Definition (Document Type)")) { change.logAction("Inside IF"); /*IItem item1= session.getObject(I, arg1)*/ change.logAction("ItemNumber"+itemNumber); IItem item = (IItem) session.getObject(ItemConstants.CLASS_DOCUMENT, itemNumber); ICell cell =item.getCell(ItemConstants.ATT_PAGE_TWO_LIST12); IAgileList lis = (IAgileList) cell.getValue(); change.logAction("value="+lis.toString()); String li = lis.toString(); //} List usergroup1 = new ArrayList(); change.logAction("adding notifiers2"); IQuery query = (IQuery)session.createObject(-5, "User Group"); change.logAction("adding notifiers3"); query.setCriteria((new StringBuilder("[General Info.Name] contains 'R&D'")).toString()); /*query.setCriteria((new StringBuilder("[General Info.Name] equal to R&D_Test")).toString()); */ ITable tbl = query.execute(); Iterator iter = tbl.iterator(); //ArrayList users = new ArrayList(); //IUser user; change.logAction("adding notifiers1"); for(; iter.hasNext(); usergroup1.add(usergroup)) { change.logAction("adding notifiers5"+usergroup); usergroup = (IUserGroup)((IRow)iter.next()).getReferent(); } /*usergroup1.add("R&D_Test");*/ change.logAction("adding notifiers4="+usergroup1); changestatus.setNotifiers(usergroup1); //Error_Line change.logAction("adding notifiers"); ActionResult result= new ActionResult(ActionResult.STRING,"Finished"); return new EventActionResult(info,result); } } } //} } catch (APIException e) { // TODO Auto-generated catch block e.printStackTrace(); ActionResult result= new ActionResult(-1,"Exception"); return new EventActionResult(info,result); } ActionResult result= new ActionResult(ActionResult.STRING,"Success"); return new EventActionResult(info,result); } }
I believe, you should use method sendNotification() intead of setNotifiers.
sendNotification method takes notify list,comments,priority and agileobject as arguments.
Try this method, it should work.
We want the notifiers to pop up in the window when CO is released. When we use Sendnotification() method, the notifications will fire in the run-time rather than popping up the names of notifier and displaying it to the user before sending.