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

Notifications

Announcements

Community site session details

Community site session details

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

Form datasource field validate method extension is not executing

(0) ShareShare
ReportReport
Posted on by 6
Hi, I have written coc for inventjournaltranfer form ds field. But it is not executing. I kept debugger but not hitting, I also tried to build project many times.
Installed product version : 10.0.31 (10.0.1406.139)Installed platform version : Update55 (7.0.6651.122)
 
Here is my code :
 
[ExtensionOf(formDataFieldStr(InventJournalTransfer, InventJournalTrans, ItemId))]
final class InventJournalTransferFormDSItemField_XXX_Extension
{
    public boolean validate()
    {
        InventJournalTrans  inventJournalTrans;
        InventTable         inventTable;
        boolean             ret;
        FormDataObject formDataObject = any2Object(this) as FormDataObject;
        FormDataSource formDataSource = formDataObject.datasource();
        ret = next validate();
        inventJournalTrans = formDataSource.cursor();
        select FIELD1 from inventTable where inventTable.ItemId == inventJournalTrans.ItemId;
        if(inventTable.FIELD1 == NoYes::Yes)
        {
            Error(strFmt(/%1 MESSAGE/,inventTable.ItemId));
            return false;
        }
        return ret;
    }
}
---------------
And FYI - the extension is working for control validate (but not datasource field validate)
I have the same question (0)
  • GirishS Profile Picture
    27,829 Moderator on at
    Hi,
     
    Have you tried adding the info log inside the method without any condition?
    Does the symbols are loaded while debugging?
    Have you tried the same at onValidating event handler?
     
    Thanks,
    Girish S.
  • Martin Dráb Profile Picture
    238,534 Most Valuable Professional on at
    It tried a simple example on the same field and it didn't work out. Then I look into our application (code from Microsoft, ISVs and our customizations) and I didn't find a single CoC extension of validate() method on a data source field. There may be reason why nobody used it.
     
    Use Validating event instead.
     
    It's off-topic, but couldn't your code be written simply like this?
    public boolean validate()
    {
        boolean ret = next validate();
    
        InventTable inventTable = inventJournalTrans.inventTable();
    
        if (inventTable.Field1)
        {
            return checkFailed(strFmt("%1 MESSAGE", inventTable.ItemId));
        }
    
        return ret;
    }
  • NA-17030952-0 Profile Picture
    6 on at
    Even modified() is not executed for this form datasource datafield extension

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 437 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans