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 :
Microsoft Dynamics AX (Archived)

RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

(0) ShareShare
ReportReport
Posted on by

I have added a field Studid in Protable.extension form( feild added on projtable table and form)

I need hyperlink on studid so that it should open form of Form2 with data source table2(table2 have studid field)

trying jump ref as below:

class HyperlinkEventHandlerOverrides
{

public static HyperlinkEventHandlerOverrides construct()
{
return new HyperlinkEventHandlerOverrides();
}

public void studid_OnJumpRef(FormDataObject _targetField)
{
StudentTable::jumpRefstudId(_targetField.getValue(), OpenMode::Edit);
}

}
=========================
class HyperlinkEventHandler
{

[FormDataSourceEventHandler(formDataSourceStr(ProjTable, ProjTable), FormDataSourceEventType::Activated)]
public static void ProjTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{

var overrides = HyperlinkEventHandlerOverrides::construct();
sender.object(fieldNum(ProjTable, studid)).registerOverrideMethod(methodStr(FormDataObject, jumpRef),
methodStr(HyperlinkEventHandlerOverrides, studid_OnJumpRef), overrides);

}

}
==============
Form2>table > method > jumpRefstudId

public static void jumpRefstudId(studid _id, OpenMode _openMode = OpenMode::Auto)
{
studtable studinfoTable;
MenuFunction menuFunction;
Args args = new Args();

if (_id)
{
studinfoTable = studTable::findbyid(_id);
}

if (!studinfoTable)
{
return;
}

args.record(studinfoTable);

menuFunction = new MenuFunction(menuitemDisplayStr(From2),MenuItemType::Display);
menuFunction.openMode(_openMode);
menuFunction.formViewOption(FormViewOption::Details);
menuFunction.run(args);
}

by this my functionality is working fine > i m getting link and it is navigating to correct records, but before that . I go on all projects > when i select any project at that point I am getting this error:

RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Hi Mayur Chavhan,

    You use registerOverrideMethod in Activated event handler, Activated  is called multiple times, that's why you getting this error. Instead of using Activated change it to OnInitialized, it is called only once.

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Hi,

    I am getting this error on oninitialized also.

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Hi ievgen Miroshnikov ,

    Its working on initialized now. But due to this cod mentioned above my existing functionality is not working properly ..like ...i have studid dropdown in projtable create form ,this dropdown is not working coz of my code.

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    when i click on dropdown field studi id in projtablecrete form i am gettign errro:

    Unable to cast object of type 'Dynamics.AX.Application.ProjTable' to type 'Dynamics.AX.Application.studenttable

  • Mea_ Profile Picture
    60,284 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Could you please elaborate your second issue, are you getting this error when you select value from the lookup or when you go to main table clicking on the field?

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Hi,

    Yes i am getting this error when i click on lookup.

    If i manually enters my studdi in lookup field it accept it without error but if i click on loop up i ll get this error or unable to cast object.

  • Mea_ Profile Picture
    60,284 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    So it has nothing to do with original question ? Don't ask 2 questions in the same thread, it's hard to follow them, always create new thread for new question.

    Do you have any code for lookup method ? Because you posted only jumpref implementation.

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Writing in this thread coz, getting this error only after writing above code. previously this lookup functionality was working fine.

    no code is written for lookup ... it comes through relation with student table.

    does in any way my jumpref method is affecting this.

  • Community Member Profile Picture
    on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    Hi ievgen Miroshnikov,

    Appologies from my side. Lookup functionality has nothing to do with my code.

    It was just build and sync issue. I compiled all models. sync is done.

    then my functionality worked fine.

    Thanks for guidance.

  • Mea_ Profile Picture
    60,284 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'jumpRef'. You can only override a method once per instance.

    No worries, if your issue is solved please mark answer(s) that helped you as verified to close this thread.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans