Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Unable to cast object ...
Finance forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Unable to cast object of type

Posted on by 9
Unable to cast object of type 'Dynamics.AX.Application.CustTable' to type 'Dynamics.AX.Application.smmBusRelTable'.
 
 
 
 
 
 
I think so the casting code here is possibly giving error.
 
[ExtensionOf(formDataSourceStr(DirPartyQuickCreateForm,DirPartyEntity))]
final class DirPartyQuickCreateForm_DirPartyEntityDS_Extension
{
    public void initValue()
    {
       
        //FormDataSource DirPartyEntity_ds = this;
        //smmBusRelTable DirPartyEntity = DirPartyEntity_ds.cursor();
        next initValue();
           
    }
}
 
For reference some more code:
 
 [FormControlEventHandler(formControlStr(CustTable, CustCommodities_ItemNameAlias), FormControlEventType::Lookup)]
    public static void CustCommodities_ItemNameAlias_OnLookup(FormControl sender, FormControlEventArgs e)
    {
        SysTableLookup          sysTableLookup  = SysTableLookup::newParameters(tableNum(CustomerCommodities), sender);
        Query                   query           = new Query();
        QueryBuildDataSource    queryBuildDataSource;
        ;
        
        queryBuildDataSource    = query.addDataSource(tableNum(CustomerCommodities));
        
        sysTableLookup.parmQuery(query);
        
        
        sysTableLookup.addLookupfield(fieldNum(CustomerCommodities, ItemNameAlias));
        
        
        sysTableLookup.performFormLookup();
 
        FormControlCancelableSuperEventArgs cancelableSuperEventArgs = e as FormControlCancelableSuperEventArgs;
        cancelableSuperEventArgs.CancelSuperCall();
    }
 

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,963 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans