Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

SetObjectValue on Grid

(0) ShareShare
ReportReport
Posted on by 504

We often do minor customizations via Customization Manager and VBA.  Sometimes this involves setting a value using SetObjectValue. 

In this case the client is on SL2015, and we have a button on the order header that retrieves data with a SQLFetchStatement.  The data is then displayed for the end user via a MsgBox statement.  That works well.

Our next step then is to take the same data and position it in the soline or grid.  Again, typically we'd do this with a SetObjectValue but grids are a bit more challenging.  The update needs to happen for one line only for one particular inventory Id.  My question is how do I get the cursor to focus on the specific inventory Id and then update a field in this case the unit price.  The line will already exist.  I just need to focus on it and update the unit price field?

Please advise.  Look forward to a response.

J

 

*This post is locked for comments

  • CFROTON Profile Picture
    4,710 on at
    RE: SetObjectValue on Grid

    To get focus on a line, there is a LineGotFocus event that could be used.  if I am misinterpreting what you need, let me know.

    This example accumulates the total transaction amount in Accounts Payable Voucher and Adjustment Entry (03.010.00) and defaults the transaction amount for each line to the amount required to “balance” the document to the details. Place the following three lines in General_Declarations:
    Dim Original#
    Dim Sum#
    Dim LineAmount#
    Sub spread1_linegotfocus(maintflg%, retval%)
    Original = Val (GetObjectValue ("cOrigDocAmt"))
    If maintflg = INSERTED and Original <> 0 Then
    Sum = Val (GetObjectValue ("cDocBal"))
    LineAmount = FPSub (Original, Sum, 2)
    Serr1 = SetObjectValue ("cTranAmt", Str$(LineAmount))
    End If
    End Sub

    More on the LineGotFocus event is in the User Manual "Customization Manager Reference Visual Basic for Applications" page 44

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,001 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,833 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans