Skip to content
Microsoft Dynamics 365

If you know the primary key of an entity you can call the read operation on a web service.  The response document contains all of the fields for that entity.  The code below is an example of how to call the read operation.  I am using a custom service but the code would be very similar for whatever service you want to call the read operation on:

Query4Service

proxy = new Query4ServiceClient();

AxdQuery4 query3 = new AxdQuery4();

AxdEntity_LedgerJournalTable_1 trans = new AxdEntity_LedgerJournalTable_1 ();  

 

EntityKey[] entityKeyList = new EntityKey[1]; 

EntityKey key = new EntityKey();

 

KeyField[] keyFields = new KeyField[1];

 KeyField keyField = new KeyField();

keyField.Field = “JournalNum”;

keyField.Value = “000065_010”;

keyFields[0] = keyField;Query4ServiceReadResponse response = proxy.read(request);

key.KeyData = keyFields;

entityKeyList[0] = key;

AxdEntity_LedgerJournalTable_1[] returnedTrans = response.Query4.LedgerJournalTable_1;

Query4ServiceReadRequest request = new Query4ServiceReadRequest(entityKeyList);

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!