Example - Preference Service with Additional Key Fields (API 1.4.2 and EnterpriseOne Tools 9.2.1)

        //Add the preference service to the used capabilities        
        loginEnv.getUsedCapabilities().add(AISClientCapability.PREFEERNCE_SERVICE);
        //create a new preference service object used to call the service
        PreferenceService prefService = new PreferenceService(loginEnv);
         
        //create a hashmap to store the valuse        
        HashMap<String,Object> preferenceData = new HashMap<String,Object>();
                
        preferenceData.put("pref1", "Preference 1 String");
        preferenceData.put("pref2", new BigDecimal("15.45"));
        preferenceData.put("pref3",8);
        preferenceData.put("pref4", new Date());
                
                
        //call setPreferences to write the preference for the current logged in user based on the client id (Object Name), no sequence used so it will be saved as zero sequence additional fields of Form Name, ID List, Version and Language are passed.  You can pass null for any of these values also, and they will not be populated.
        prefService.setPreferences("AIS_CLIENT","W01012A", "10","ZJDE0001","E", preferenceData);
         
        // create a hashmap to store the retrieved values        
        HashMap<String,Object> preferenceDataOut=        
        prefService.getPreferences("AIS_CLIENT","W01012A", "10","ZJDE0001","E");
               
        //print response showing values were received
        out.println("Recieved: " + preferenceDataOut);
        //get individual value
        out.println("Recieved Pref 2: " + preferenceDataOut.get("pref2"));