Skip to main content

Notifications

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)
  • 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
    Martin Dráb 230,868 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
    GirishS 27,821 Super User 2024 Season 1 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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans