Created
December 30, 2022 22:07
-
-
Save dianecawley/963c24f95c940cc7f8b6b71b8d84df57 to your computer and use it in GitHub Desktop.
Example of Creating Inventory Adjustment PUT and Release Action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var authApi = new AuthApi(siteURL, requestInterceptor: RequestLogger.LogRequest, responseInterceptor: RequestLogger.LogResponse); | |
AuthApi.OAuthScope scope = AuthApi.OAuthScope.API; | |
var configuration = authApi.ReceiveAccessToken(IC.AcumaticaClientID, IC.AcumaticaSecret, IC.AcumaticaUserID, IC.AcumaticaPwd, scope); | |
authApi.Configuration = configuration; | |
//Insert the Login code here.... | |
//The configuration object is used in all of the remaining API calls. | |
//Once Logged In, we can populate the InventoryAdjustmentDetail object with the transaction details: | |
var inventoryadjapi = new InventoryAdjustmentApi(configuration); List<InventoryAdjustmentDetail> adjDetails = new List<InventoryAdjustmentDetail>(); | |
adjDetails.Add(new InventoryAdjustmentDetail | |
{ | |
InventoryID = new StringValue { Value = "AALEGO500" }, | |
LocationID = new StringValue { Value = "R1S1" }, | |
WarehouseID = new StringValue { Value = "WHOLESALE" }, | |
ReasonCode = new StringValue { Value = "INADJUST" }, | |
Qty = new DecimalValue { Value = 7}, | |
LotSerialNbr = new StringValue { Value = "" }, | |
UOM = new StringValue { Value = "EA" } | |
}); | |
//Once all of the detail lines are populated, we can create the header, InventoryAdjustment object, and //add the details to it: | |
InventoryAdjustment adjdoc = new InventoryAdjustment | |
{ | |
Date = new DateTimeValue { Value = "12/22/2022"}, | |
Hold = new BooleanValue { Value = false }, | |
Details = adjDetails | |
}; | |
//Next, the data is saved by performing the PUT command. | |
InventoryAdjustment newadjdoc = inventoryadjapi.PutEntity(adjdoc, "ReferenceNbr"); | |
//And finally, the Release Action is invoked to finish the job. | |
inventoryadjapi.WaitActionCompletion(inventoryadjapi.InvokeAction(new | |
ReleaseAdjustment(newadjdoc))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment