GetInventoryAdjustmentList


Description

Retrieves a list of inventory adjustment summary objects that meet the specified criteria.

Parameters

Parameter

Type

Description

criteria

InventoryAdjustmentCriteria

The inventory adjustment criteria object that specifies which inventory adjustment summary objects to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetInventoryAdjustmentListResult

ArrayOfInventoryAdjustmentSummary

A list of the inventory adjustment summary objects that match the specified criteria.


Interfaces

 

Examples

The following C# example retrieves the list of inventory adjustment summary objects where the inventory transaction state is equal to “Work”. A message box displays the batch assigned to each member of the inventory adjustment summary object list.

 Legacy endpoint

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			ListRestrictionOfNullableOfInventoryTransactionState inventoryTransactionStateRestriction;
			InventoryAdjustmentCriteria inventoryAdjustmentCriteria;
			InventoryAdjustmentSummary[] inventoryAdjustmentSummaries;

			// Create an instance of the service
			DynamicsGP wsDynamicsGP = new DynamicsGP();

			// Be sure the default credentials are used
			wsDynamicsGP.UseDefaultCredentials = true;

			// Create a context with which to call the service
			context = new Context();

			// Specify which company to use (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context object
			context.OrganizationKey = (OrganizationKey)companyKey;

			// Create the restriction object
			// Retrieve only inventory adjustment with a transaction state of 'Work'
			inventoryTransactionStateRestriction = new
			ListRestrictionOfNullableOfInventoryTransactionState();
			inventoryTransactionStateRestriction.EqualValue = InventoryTransactionState.Work;

			// Create the inventory adjustment criteria object
			inventoryAdjustmentCriteria = new InventoryAdjustmentCriteria();
			inventoryAdjustmentCriteria.TransactionState = inventoryTransactionStateRestriction;

			// Retrieve the list of inventory adjustment summary objects
			inventoryAdjustmentSummaries = wsDynamicsGP.GetInventoryAdjustmentList(
			inventoryAdjustmentCriteria, context);

			// Display the batch ID for each member of the summary object list
			StringBuilder summaryList = new StringBuilder();
			foreach (InventoryAdjustmentSummary a in inventoryAdjustmentSummaries)
			{
				summaryList.AppendLine("Batch Id: " + a.BatchKey.Id);
		}
			MessageBox.Show(summaryList.ToString());
	}
}
}

 Native endpoint

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			ListRestrictionOfNullableOfInventoryTransactionState inventoryTransactionStateRestriction;
			InventoryAdjustmentCriteria inventoryAdjustmentCriteria;
			InventoryAdjustmentSummary[] inventoryAdjustmentSummaries;

			// Create an instance of the service
			DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

			// Create a context with which to call the service
			context = new Context();

			// Specify which company to use (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context object
			context.OrganizationKey = (OrganizationKey)companyKey;

			// Create the restriction object
			// Retrieve only inventory adjustment with a transaction state of 'Work'
			inventoryTransactionStateRestriction = new
			ListRestrictionOfNullableOfInventoryTransactionState();
			inventoryTransactionStateRestriction.EqualValue = InventoryTransactionState.Work;

			// Create the inventory adjustment criteria object
			inventoryAdjustmentCriteria = new InventoryAdjustmentCriteria();
			inventoryAdjustmentCriteria.TransactionState = inventoryTransactionStateRestriction;

			// Retrieve the list of inventory adjustment summary objects
			inventoryAdjustmentSummaries = wsDynamicsGP.GetInventoryAdjustmentList(
			inventoryAdjustmentCriteria, context);

			// Display the batch ID for each member of the summary object list
			StringBuilder summaryList = new StringBuilder();
			foreach (InventoryAdjustmentSummary a in inventoryAdjustmentSummaries)
			{
				summaryList.AppendLine("Batch Id: " + a.BatchKey.Id);
		}
			MessageBox.Show(summaryList.ToString());

			// Close the service
			if(wsDynamicsGP.State != CommunicationState.Faulted)
			{
				wsDynamicsGP.Close();
		}
	}
}
}


Documentation Feedback