5 Replies Latest reply: Aug 13, 2012 2:08 AM by Gurumoorthy RSS

    Development :create a new SA Id with a defined user Id using NewEntity() !

    954309
      Hi,

      I try to create a new SA Id with a defined Id ( see code below), I expected that the Framwork creates the Service Agreement with my Id, but not, it generates a new Id. Please help on that, how I can create my SA with my specific Id.
      Thanks,


                     ServiceAgreement serviceAgreement = null;
                     ServiceAgreement_DTO saDTO = null;
                     ServiceAgreementType_Id serviceAgreementTypeId = new ServiceAgreementType_Id(new CisDivision_Id("FR"),"F0WAM");     
                     
                     startChanges();               
                          saDTO = (ServiceAgreement_DTO) createDTO(ServiceAgreement.class);
                          saDTO.setId(new ServiceAgreement_Id("1234567890"));
                          saDTO.wait();
                          saDTO.setServiceAgreementTypeId(serviceAgreementTypeId);
                          saDTO.setStatus(ServiceAgreementStatusLookup.constants.ACTIVE);          
                          saDTO.setStartDate(getSystemDateTime().getDate());                
                          saDTO.setAreEstimatesAllowed(Bool.TRUE);
                          saDTO.setCustomerRead(CustomerReadLookup.constants.NO);
                          saDTO.setSaRelationshipId(ServiceAgreementRelationship_Id.NULL);
                          saDTO.setAccountId(new Account_Id("6487037372"));
                          saDTO.setPremiseId(new Premise_Id("5282464492"));
                          saDTO.setVersion(1);
                          serviceAgreement = saDTO.newEntity();
                     saveChanges();
                     
      System.out.println(" SA Id ="+ serviceAgreement.getId().getIdValue() );