PX Illegal Argument Exception for SetNotifier function. Please someone guide me to solve this error. I have pasted the code below.

</p>
<p>public class SetNotifiersEvent implements IEventAction</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>{ <br />public IRow row1; <br />IUserGroup usergroup;</p>
<p>&nbsp;</p>
<p>@Override <br />public EventActionResult doAction(IAgileSession session, INode node, <br />IEventInfo info) { <br />try { <br />//IChange change = null; <br />IWFChangeStatusEventInfo changestatus = (IWFChangeStatusEventInfo) info; <br />IChange change; <br />String str1 = ""; <br />//IItem itm; <br />IDataObject obj = changestatus.getDataObject(); <br />Collection al = new ArrayList(); <br />if(obj instanceof IChange) <br />{ <br />change = (IChange) obj;</p>
<p>&nbsp;</p>
<p>ITable table = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS); <br />Iterator it = table.iterator(); <br />while(it.hasNext()) <br />{ <br />IRow row = (IRow) it.next(); <br />ICell attr = (ICell) row.getCell(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_TYPE);</p>
<p>&nbsp;</p>
<p>String itemNumber = (String) row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER);</p>
<p>&nbsp;</p>
<p>IAgileList str = (IAgileList) attr.getValue(); <br />change.logAction(str.toString()); <br />//IAgileList[] list1 = str.getSelection(); <br />//change.logAction(list1.toString()); <br />change.logAction("Inside while, Before IF3-"+str); <br />//change.logAction("Inside while, Before IF2-"+str.getName()); <br />//change.logAction("Inside while, Before IF1-"+str.getValue()); <br />if((str.toString()).equals("Business Process (Document Type)")|| (str.toString()).equals("Product Definition (Document Type)")) <br />{ <br />change.logAction("Inside IF"); <br />/*IItem item1= session.getObject(I, arg1)*/ <br />change.logAction("ItemNumber"+itemNumber); <br />IItem item = (IItem) session.getObject(ItemConstants.CLASS_DOCUMENT, <br />itemNumber);</p>
<p>&nbsp;</p>
<p>ICell cell =item.getCell(ItemConstants.ATT_PAGE_TWO_LIST12); <br />IAgileList lis = (IAgileList) cell.getValue(); <br />change.logAction("value="+lis.toString()); <br />String li = lis.toString(); <br />//} <br />List usergroup1 = new ArrayList(); <br />change.logAction("adding notifiers2"); <br />IQuery query = (IQuery)session.createObject(-5, "User Group"); <br />change.logAction("adding notifiers3"); <br />query.setCriteria((new StringBuilder("[General Info.Name] contains 'R&amp;D'")).toString());</p>
<p>&nbsp;</p>
<p>/*query.setCriteria((new StringBuilder("[General Info.Name] equal to R&amp;D_Test")).toString()); <br />*/</p>
<p>&nbsp;</p>
<p>ITable tbl = query.execute(); <br />Iterator iter = tbl.iterator(); <br />//ArrayList users = new ArrayList(); <br />//IUser user; <br />change.logAction("adding notifiers1");</p>
<p>&nbsp;</p>
<p>for(; iter.hasNext(); usergroup1.add(usergroup)) <br />{ change.logAction("adding notifiers5"+usergroup); <br />usergroup = (IUserGroup)((IRow)iter.next()).getReferent(); <br />} <br />/*usergroup1.add("R&amp;D_Test");*/</p>
<p>&nbsp;</p>
<p>change.logAction("adding notifiers4="+usergroup1);</p>
<p>&nbsp;</p>
<p>changestatus.setNotifiers(usergroup1); //Error_Line <br />change.logAction("adding notifiers"); <br />ActionResult result= new ActionResult(ActionResult.STRING,"Finished"); <br />return new EventActionResult(info,result); <br />}</p>
<p>&nbsp;</p>
<p>}</p>
<p>&nbsp;</p>
<p>}</p>
<p>&nbsp;</p>
<p>//}</p>
<p>&nbsp;</p>
<p>} catch (APIException e) { <br />// TODO Auto-generated catch block <br />e.printStackTrace(); <br />ActionResult result= new ActionResult(-1,"Exception"); <br />return new EventActionResult(info,result); <br />}</p>
<p>&nbsp;</p>
<p>ActionResult result= new ActionResult(ActionResult.STRING,"Success"); <br />return new EventActionResult(info,result); <br />} <br />}</p>
<p>

Forum Agile Expert Asked on March 10, 2015 in Software Development Kit (API).
Add Comment
1 Answer(s)
Best answer

Use sendNotification instead of setNotifiers. and create a Notification to send the mail to respective group.

Divakar Agile Talent Answered on March 24, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.