Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Create Lead using java API based on Assignee

By
vikash
on 1/18/15, 7:40 PM 981 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/18/15, 7:40 PM
Seen: 981 times
Last updated: 3/16/15, 8:10 AM