Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Customizing the Sales Order Screen

(0) ShareShare
ReportReport
Posted on by 1,270

Hi:

I am in the process of customizing the sales order screen, to bring over information inputted in the manufacturing screen from the lot/serial form into a text box on the main screen.  I was able to get the code to display the manufacturing information into the text box on saving the bin lot screen.  However, if there is more than one line item in the sales order that is a lot item, the text box continue to display the last manufacturing no.  I will like when I click on the various sales rows with lot/serial that the manufacture no. also appears.   I am using the following code, which I was able to use on other screens and get the required results but I am not able to do so in the Sales Screen.  Could you point out what I maybe missing?  Below is the code that I am using.  Any assistance will be appreciated.

Private Sub Spread8_LineGotFocus(maintflg As Integer, retval As Integer)
      
Dim Cur As Integer
Dim SQL As String
Dim gbLotNum As String
Dim strinVtID As String


Dim myDescription As myDescription
Dim str2 As String
 Call SetObjectValue("xuser1", "")
str2 = GetObjectValue("cLotSerNbr_8")
strinVtID = GetObjectValue("cinvtid_1")
str2 = Trim(str2)
If (Len(str2) >= 1 And Len(strinVtID) >= 1) Then
SQL = "select MfgrLotSerNbr from LotSerMst where LotSerNbr='" & Trim(RTrim(str2)) & "' and InvtID='" & strinVtID & "'"
Call SqlFetch1(Cur, SQL, myDescription, LenB(myDescription))

Call SetObjectValue("xuser1", myDescription.permissionNum)
Call SetObjectValue("cMfgrLotSerNbr_8", myDescription.permissionNum)
 
 SqlFree (Cur)
Else
  Call SetObjectValue("xuser1", "na")

End If

Close (Cur)

End Sub

Thanks

Lisa

*This post is locked for comments

  • Suggested answer
    Ajit Kannan Profile Picture
    Ajit Kannan 1,240 on at
    RE: Customizing the Sales Order Screen

    Hello Lisa C Audain,

    Please try this below code

    If (Len(str2) >= 1 And Len(strinVtID) >= 1) Then

           iCurrRow = MGetRowNum(Gridhdle)

           iRetval = MFirst(Gridhdle, iMaintFlag)

           While iRetval = 0

               If StrInvtID <> "" Then

    SQL = "select MfgrLotSerNbr from LotSerMst where LotSerNbr='" & Trim(RTrim(str2)) & "' and InvtID='" & strinVtID & "'"

                   serr1 = SqlFetch1(Csr_Temp, SqlStr, Buffername, LenB(Buffername))

                   Call SqlFree(Csr_Temp)

                   If serr1 = 0 Then

                Call SetObjectValue("xuser1", myDescription.permissionNum)

                       Call SetObjectValue("cMfgrLotSerNbr_8", myDescription.permissionNum)

                       Call MUpdate(Gridhdle)

                   End If

               End If

               iRetval = MNext(Gridhdle, iMaintFlag)

           Wend

      End If

    Thanks,

    Ajit Kannan S R

  • Mark Asmus Profile Picture
    Mark Asmus on at
    RE: Customizing the Sales Order Screen

    Lisa,

    As I understand when you click on a detail line in the Bin/LotSer sub-screen grid in the Sales Order screen, then you use the value in the cLotSerNbr_8 field to lookup a value in the MfgrLotSerNbr table and then populate that value in the cMfgrLotSerNbr_8 field and in the xuser1 field.   Is the xuser1 field on the main Sales Order -> Line Items tab?

    I am not sure what may be causing the issue but here are two things to try:

    1 - Try adding this code.   It helped a somewhat similar issue we had in the Shippers screen:

    Private Sub frmLotSerial_Hide()

       Call MSetProp("cLotSerNbr_8", "Enabled", True)

       Call MSetProp("cSpecificCostID_8", "Enabled", True)

       Call MSetProp("cQtyShipInStockUnit_8", "Enabled", True)

       Call MSetProp("cwhseloc_8", "Enabled", True)

    End Sub

    2 - Instead of having your code on the Spread8_LineGotFocus event, could you add it to the cLotSerNbr_8 check event instead?  Or maybe some other event?  

    Thanks,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans