web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • NA-17030952-0 Profile Picture
    6 on at
    Form datasource field validate method extension is not executing
    Even modified() is not executed for this form datasource datafield extension
  • Martin Dráb Profile Picture
    235,966 Most Valuable Professional on at
    Form datasource field validate method extension is not executing
    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;
    }
  • GirishS Profile Picture
    27,825 Moderator on at
    Form datasource field validate method extension is not executing
    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.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 823 User Group Leader

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 491 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans