Why was this change required?
In the remanufactured cartridge industry there is an accepted failure rate of in the region of 2%. So out of 30’000 lines a month, that’s up to 600 returns. With that level of transactions to process, every automation we can apply makes a difference.
In this example I have an issue where the customer services team don’t always mark the ‘return’ flag field correctly when raising the Rma line. As a result the accounts team raise a credit and some of the lines don’t process as they are marked as to be returned and have a returned quantity of zero.
Process overview
This event had been added to various event handlers on the Rma forms.
- Check if any of the Rma lines are marked as “return” if not end
- if any are marked as return offer the user the option to continue anyway, to clear the return flags or cancel
- if the user chooses to clear the return flags, do this on all related lines using an Ido update request.
Here’s the VB Code
Function PBTI_CheckReturnFlag() As Integer
Application.ShowMessage(“Started”)
Dim responsermaitems As LoadCollectionResponseData
Dim result As wsMsgBoxResult = Nothingresponsermaitems = Me.IDOClient.LoadCollection( _
"SLRmaitems", _ "RmaNum, EvalCode_2, RmaLine", _ "RmaNum = '" & ThisForm.CurrentIDOCollection.CurrentItem("RmaNum").Value & "' and ReturnItem = 1" _ & " and DerQtyReceived = 0", _"CreateDate Desc", 0)If responsermaitems.Items.Count > 0 Then
result = Application.ShowMessage(responsermaitems.Items.Count & ” line(s) are set as returns but none have been received. ” _
& vbCrLf & vbCrLf _
& “Press YES if you would like to automatically change all these to not be returned items and credit them.” _
& vbCrLf _
& vbCrLf & “Press NO if you would like them to be left as retrun items and for them not to be credited” _
& vbCrLf _
& vbCrLf _
& “Press CANCEL to abort and change nothing” _, MsgBoxStyle.YesNoCancel)
If (result = wsMsgBoxResult.wsYes) Then
Dim updateRequest As UpdateCollectionRequestData
Dim rowcount As Integer = 0
While rowcount < responsermaitems.Items.Count
Dim updateItem As IDOUpdateItem
‘ create a new UpdateCollection requestupdateRequest = New UpdateCollectionRequestData(“SLRmaitems”)
‘ create a new update item for the row we loaded
updateItem = New IDOUpdateItem(UpdateAction.Update, responsermaitems.Items(rowcount).ItemID)
‘ add CustNum property from LoadResposne, not modifiedupdateItem.Properties.Add(“ReturnItem”, “0”, True)
‘ add the update item to update requestupdateRequest.Items.Add(updateItem)
‘ save changesMe.IDOClient.UpdateCollection(updateRequest)
rowcount = rowcount + 1
End While
Return 0
ElseIf (result = wsMsgBoxResult.wsNo) Then
Application.ShowMessage(“You Pressed No”)
Return 0
Else
Return -1
End If
Else
Return 0
End If
End Function