I'm doing a Dynamics CRM integration from a Java application and I've followed the example from the CRM training kit and managed successfully to connect and create accounts and contacts.
Now I'm having some problems with adding some more fields in the account creation and when connecting a contact with an account.
For instance I cannot create accounts with "address1\_freighttermscode" that is a picklist.
My code is the following:

```
private static OrganizationServiceStub.Guid createAccount(OrganizationServiceStub serviceStub, String[] args) {
    try {
        OrganizationServiceStub.Create entry = new OrganizationServiceStub.Create();
        OrganizationServiceStub.Entity newEntryInfo = new OrganizationServiceStub.Entity();
        OrganizationServiceStub.AttributeCollection collection = new OrganizationServiceStub.AttributeCollection();
        if (! (args[0].equals("null") )) {
          OrganizationServiceStub.KeyValuePairOfstringanyType values = new OrganizationServiceStub.KeyValuePairOfstringanyType();
          values.setKey("name");
          values.setValue(args[0]);
          collection.addKeyValuePairOfstringanyType(values);
        }
     if (! (args[13].equals("null"))){
          OrganizationServiceStub.KeyValuePairOfstringanyType incoterm = new OrganizationServiceStub.KeyValuePairOfstringanyType();
          incoterm.setKey("address1_freighttermscode");
          incoterm.setValue(args[13]);
          collection.addKeyValuePairOfstringanyType(incoterm);
        }

        newEntryInfo.setAttributes(collection);

        newEntryInfo.setLogicalName("account");

        entry.setEntity(newEntryInfo);

        OrganizationServiceStub.CreateResponse createResponse = serviceStub.create(entry);
        OrganizationServiceStub.Guid createResultGuid = createResponse.getCreateResult();

        System.out.println("New Account GUID: " + createResultGuid.getGuid());

        return createResultGuid;
    } catch (IOrganizationService_Create_OrganizationServiceFaultFault_FaultMessage e) {
        logger.error(e.getMessage());
    } catch (RemoteException e) {
        logger.error(e.getMessage());
    }

    return null;
}

```

When it executes, I get this error

```
[ERROR] Incorrect attribute value type System.String

```

Does anyone have examples on how to handle picklists or lookups?

To connect the contact with the account I'm filling the fields `parentcustomerid` and `parentcustomeridtype` with the GUID from the account and with "account", but the contact does not get associated with the account.