Error While Fetching Partner ID in Employee

I am facing a problem while writing a service to convert partner into the employee.

I have add
import com.axelor.apps.base.db.Partner;
import com.axelor.apps.base.db.repo.PartnerRepository;

and Also Inject all.

Here I get the Customer ID when through a function (On Button) .

Partner partnerObj = request.getContext().asType(Partner.class);
Long partnerID = partnerObj.getId();

and Here I want to add this ID to the Employee :

Employee newEmployeeObj = new Employee();

But it show an error message.

Error message

Your support is highly appreciated.

bro, partnerId is long, and contactPartner is of type Partner, you need to align the types.

Good Morning.

Mr Zeeshan, you should pass « partnerObj » to newEmployeeObj.setContactPartner

i.e newEmployeeObj.setContactPartner(partnerObj);

let me know, If you need any further assistance

1 « J'aime »