This question has been flagged
4239 Views

Hi,

I want to ensure that lead is assigned to the correct team to deal with it

I am able to create the lead using this code

FilterCollection contactfilter1=new FilterCollection();
contactfilter1.add("name","=","shtu");

//contactfilter1.add("hr_department_id","=","hr_department_id"); System.out.println("odoo search object"); RowCollection leadCount1 = partnerAd.searchAndReadObject(contactfilter1, new String[]{"name","email_from","hr_department_id","partner_id","parent_id"}); System.out.println(leadCount1.size()); for (Row row : leadCount1){ System.out.println("Row ID: " + row.getID()); System.out.println("Name:" + row.get("name")); System.out.println("Email:" + row.get("email_from")); System.out.println("HR:" + row.get("hr_department_id")); System.out.println("PartenerId"+row.get("partner_id")); System.out.println("parentId"+row.get("1")); } Row leadrow=leadCount1.get(0); leadrow.put("name", "BizRuntime"); Object team=null; Object [] hrId=null; for(Row row:leadCount1){ System.out.println(row.get("name")); System.out.println(row.get("email")); hrId = (Object []) row.get("hr_department_id"); if (hrId == null){ System.out.println("hr_department_id: Null"); System.out.println("hr_department_id: Null"); } else{ System.out.println("hr_department_id: " + hrId[0]); // If nou need more info, you need to create an ObjectAdapter to read } team=row.get("1"); } System.out.println("*********for department************"); Row newPartner = partnerAd.getNewRow(new String[]{"name", "email_from","hr_department_id","partner_id"}); newPartner.put("name", "zebra"); newPartner.put("email_from", "zebra@gmail.com"); newPartner.put("partner_id","1"); newPartner.put("hr_department_id",team); partnerAd.createObject(newPartner); boolean success=partnerAd.writeObject(newPartner, true); if(success){ System.out.println("record created"); } System.out.println("New Row ID: " + newPartner.getID());

So it sucessfully created a Lead but Default assign to Team As Admin

so,can you explain me how i will achieve this to create lead based on Assignee

Thanks

Avatar
Discard