web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

WHSWorkExecute (Emulator) BatchVerification - cannot set control from code

(1) ShareShare
ReportReport
Posted on by 97

Hi guys

Im struggling with the BatchVerification control, which is presented to the user to confirm the Batch Number.
This can be configured on the Mobile Menu Item -> Work confirmation setup.

So when the user picks something and this setting to confirm the batch is set, the user has to confirm the Batch number (e.g. Scanning)

But i cannot set this controls value from code. To me it looks like this specific control is bugged, every other control I tested can be set via code.

My goal is describe in this post which seems to work in AX2012:
https://cloudblogs.microsoft.com/dynamics365/no-audience/2015/04/28/barcode-scanning-in-the-mobile-device/
tldr; I want to set the BatchId from scanning the initial ItemId (GS1 Barcode) which contains the information of the BatchId

but the same code for setting the controls value does not work in D365, for example like this:

fieldValues.insert(WHSWorkExecuteDisplayVerificationControls::BatchVerification, 'test');
// or
controlData.processControl(WHSWorkExecuteDisplayVerificationControls::BatchVerification, 'test');

does anyone have a clue? :)
thanks!

I have the same question (0)
  • WillWU Profile Picture
    22,361 on at

    Hi Raphael Bucher,

    Could you please share more information(such as screenshot) about what do you want to achieve?

    If you want to access a control from a form, you could use FormRun.design().controlName("Yourcontrol");

    Hope this helps.

  • Verified answer
    Raphael Bucher Profile Picture
    97 on at

    Hi, I should have been more clearer. Sorry for that.
    I'm talking about the D365 Warehousing App and the Emulator (accessed through URL /?mi=action:WHSWorkExecute)
    There is no such thing as Forms to access these controls, since it's used by the Mobile Application and the Device Emulator.

    I think I found a viable way to solve this, if anyone ever runs into the same problem.. here is my solution:

    Extend the ProductConfirmation Control (this is where we usually scan the barcode):

    [ExtensionOf(classStr(WhsControlProductConfirmation))]
    public final class WhsControlProductConfirmationClass_BEC_Extension
    {
        public boolean process()
        {
            if (!this.dataEqualsWorkLineItemNumber() &&
                WHSRFMenuItemTable::find(pass.lookup(#MenuItem)).BarcodeSplit)
            {
                this.barcodeSplitItemSearch_BEC();
            }
    
           return next process();
        }
        
        private void barcodeSplitItemSearch_BEC()
        {
            InventInventItemSearch localInventItemSearch = InventInventItemSearch::construct();
            localInventItemSearch.parmBarcodeSplit(true);
    
            // custom search class is triggered, which splits the barcode accordingly
            InventInventItemSearchResult localInventItemSearchResult = localInventItemSearch.search(this.parmData());        
    
            if (localInventItemSearchResult.parmBatchId_BEC())
            {
                // set the extracted ItemId
                this.parmData(localInventItemSearchResult.parmItemId());
    
                if (localInventItemSearchResult.parmBatchId_BEC() == context.workLine.inventDim().inventBatchId ||
                    this.matchFlexibleOrderCommittedBatch_BEC(localInventItemSearchResult.parmBatchId_BEC()))
                {
                    // create a dummy pass entry, which will be used to replace the BatchVerification entry later on
                    pass.insert(WHSWorkExecuteDisplayVerificationControls::BatchVerification   '_BEC', localInventItemSearchResult.parmBatchId_BEC());
                }
                else
                {
                    fieldValues.insert(WHSWorkExecuteDisplayVerificationControls::BatchVerification   '_BEC', '');
                    this.fail("@WAX:IncorrectBatch");
                }
            }
        }
    }

    And then extend your specific WhsWorkExecuteDisplay Class, mine was WhsWorkExecuteDisplayUserDirected:

    [ExtensionOf(classStr(whsWorkExecuteDisplayUserDirected))]
    public final class WhsWorkExecuteDisplayUserDirectedClass_BEC_Extension
    {
        container displayForm(container _con, str _buttonClicked)
        {
            container con = next displayForm(_con, _buttonClicked);
    
            // replace the BatchVerification control value with the dummy value
            con = this.replaceBatchVerification_BEC(con);
    
            return con;
        }
    
        private container replaceBatchVerification_BEC(container _con)
        {
            container con = _con;
    
            int batchControlIndex = this.indexOfBuildControlFromContainer(con, WHSWorkExecuteDisplayVerificationControls::BatchVerification);
    
            if (batchControlIndex &&
                pass.exists(WHSWorkExecuteDisplayVerificationControls::BatchVerification   '_BEC'))
            {
                con = this.setControlDataFromContainer(con, WHSWorkExecuteDisplayVerificationControls::BatchVerification, pass.lookup(WHSWorkExecuteDisplayVerificationControls::BatchVerification    '_BEC'));
                pass.remove(WHSWorkExecuteDisplayVerificationControls::BatchVerification   '_BEC');
            }
    
            return con;
        }
    
    }

  • WillWU Profile Picture
    22,361 on at

    Hi partner,

    Thank you for your sharing.

  • chmanrubia Profile Picture
    35 on at
    Hi everyone,
     
    Maybe it's too late for you, but there is a simple way to solve this issue. Following this route: "warehouse management > Setup > GS1 > Barcode data generic setup" is necessary to create a new register with the following information:
     
     
    Once completed, the system can verify the batch number using GS1 codes.
     
    Regards,

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans