Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

scan in sales line

Posted on by 2,016

greeting everyone 

i have tow question 

i'v created duplicate from this form (SalesTableLineQuantity)

and i did some modify in this duplicated 

pastedimage1603370465796v1.png

1- my for this form is let user do scan for barcode in that text box above and then if the item existing in line it will automatic will be increased 1 to  delivery now field until equal to SalesQty

how can i do that?!!

 

2- i need to create button to clear all delivery now field from all lines 

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: scan in sales line

    ok thanks that's useful

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: scan in sales line

    Hi mohammed,

    You can try clearing the value of the barcodetext field after each increment. Please try this code at the end of the modifiedfield.

    barCode.text('');

  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: scan in sales line

    thanks all for replay 

    yes i'm usin barcode scanner 

    Mr.Gunjan Bhattacharyya i used your code and it works fine but i can only use it once 

    i mean if have many (3 Quantity) from same barcode and i did first scan it's enter 1 on DeliverNow

    but when i scan again same item nothing change and not increasing the quantity for DeliverNow

    i must closed form and open it again maybe i need to improve the code to allow me scan same barcode many times

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    Gunjan Bhattachayya 35,417 on at
    RE: scan in sales line

    Hi mohammed,

    1. You can write the logic in the modified method of the "Barcode" text field. Have you added a bar code field to sales order lines? You can write logic for increasing the quantity on sales order lines.

    SalesLine   salesLineLoc;
    
    ttsBegin;
    
    select firstOnly forUpdate salesLineLoc 
        where salesLineLoc.SalesId == salesTable.SalesId
           && salesLineLoc.BarCode == barCode.text(); //Assuming that the control name for "Barcode" field is barCode
        
    salesLineLoc.SalesDeliverNow  = 1;
    if (salesLineLoc.SalesDeliverNow <= salesLineLoc.SalesQty)
    {
        salesLineLoc.update();
    }
        
    ttsCommit;
    
    salesLine_ds.reread();
    salesLine_ds.refresh();

    2. You can add a new button and write the logic to clear the Deliver now field for all lines in the clicked method .

    SalesLine   salesLineLoc;
    
    update_recordset salesLineLoc 
        setting SalesDeliverNow = 0
            where salesLineLoc.SalesId == salesTable.SalesId
        
    salesLine_ds.reread();
    salesLine_ds.refresh();

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,696 Super User on at
    RE: scan in sales line

    Hi Mohammed,

    My two cents here:

    1) Do you already have barcode scanner? There are devices (USB barcode scanner) which could read a barcode and convert it in text. It is then acting as an additional keyboard.

    2) You can decide to create a button and add coding on or the form on a table or in a separate class. The method could have an update_recordset command with a where clause for the best performance. docs.microsoft.com/.../update-recordset

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans