Add-in does'nt receive data when used on Role Center

Johannes_NielsenJohannes_Nielsen Member Posts: 206
edited 2012-10-22 in NAV Three Tier
Hi all

Quick question. :idea:

I have an Add-in Control which has a bigtext as SourceExpr.

I works fine when used on a regular card page, but when used on a cardpart page, included in a Rolecenter. The Add-in does'nt seem to get any data in the SourceExpr variable.

The add-in starts up and IS visible, but has no data available. The variable Does contain data.

Should'nt an Add-in work just the same way, as a part of a Role Center, as if it was run independently?
Best regards / Venlig hilsen
Johannes Sebastian
MB7-840,MB7-841

Answers

  • Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    Hi Johannes,
    do you have more details?
    I could not see the issue in my experiment.

    Does the page have a table set (this might make a difference in update behavior)?
    When does the source expression variable get set?

    Bthw: In NAV 2013 you just use TEXT data type. This is now Unicode and does not require you to specify a size anymore.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Johannes_NielsenJohannes_Nielsen Member Posts: 206
    Hi Christian

    Thanks for replying.

    Cardpart page hosts the Add-in. The CardPart page is included in a RoleCenter.

    CardPart Page Source is set.

    The Add-in Variable gets set "OnInit", on CardPart Page.

    If I print the data Variable on screen, the dialog appears before Role Center is displayed, showing the correct data.

    But still, the Add-in starts up, with no data, and never gain access to any.

    Strange! :shock:
    Best regards / Venlig hilsen
    Johannes Sebastian
    MB7-840,MB7-841
  • matttraxmatttrax Member Posts: 2,309
    I have put an add-in on the Role Center, but it was a self-updating one, so it made periodic calls to NAV to see if it needed new data. I can't remember if it loaded up blank initially or not. Sorry, I know that's not a ton of help.
  • deV.chdeV.ch Member Posts: 543
    Well OnInit is not right place for setting data i would say, try OnAfterGetRecord() or OnOpenPage() instead.

    I have a chart addin that i'am using in the rolecenter it works perfectly fine. It is connected to a another ListPart which displays "My Jobs" so therefore i needed the OnAfterGetRecord Trigger, but i remember having problems with the OnInit trigger and addins before on other addin-projects.
  • Christian_AbelnChristian_Abeln Member, Microsoft Employee Posts: 42
    You write that the AddIn is bound to data by Source Expression. This is great - you do not need to care about timing, in terms of when to call the AddIn. The data will be sent over as soon as the part page updates.
    In my experiments to repro your issue I have used my Lync communication AddIn on a Card part , which I bind through Source Expression to a local variable of type Text.

    Both initializing the local variable on OnInit() on in OnOpenPage() works fine.


    Can you try to use a variable of type TEXT instead ?
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Christian Abeln
    Program Manager Microsoft
    Dynamics NAV

    blogs.msdn.com/cabeln/
  • Johannes_NielsenJohannes_Nielsen Member Posts: 206
    Hi Christian

    Sorry for taking so long to get back to this issue :shock:

    And thank you so much for taking time out for trying this out for me.

    I've change to type to sourcevar to TEXT but still the same :?

    -
    I see you're using 2013, we're still on 2009 for this product.

    But anyways, I think we'll stick with having the Add-in in a task page of it's own and Not in the Role Center for now.

    I'll give it another go in 2013 when the time comes!

    I'll mark this thread as solved since it's clearly possible to run add-ins directly in a role center, just not the combination of my C# in 2009.

    Thanks again
    Best regards / Venlig hilsen
    Johannes Sebastian
    MB7-840,MB7-841
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    Hi Johannes,

    It would be very interesting to see the control or some simple control (the simpler the better) for which you can repro the issue. I know that both Christian and I would be interested.

    As mentioned previously (deV.ch) you should generally not use the OnInit trigger (this trigger is happening before the page controls are created. OnAfterGetCurrentRecord is a preferred trigger. However as Christian mentions if you are using databinding you should automatically get the updated value.

    Aside: If you are not using databinding then you might benefit from having the Add-in notify (OnControlAddIn trigger) that it is ready (e.g. when the parent changes and thus is no longer null).

    /henrik
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
  • Johannes_NielsenJohannes_Nielsen Member Posts: 206
    Hi Christian and Henrik

    I tried including a copy of this example in my Role Center and the variable data Does reach the Add-in.
    (the example uses WinForms, I use WPF)
    http://blogs.msdn.com/b/nav/archive/201 ... ample.aspx

    So the problem with data not begin sent to the add-in, must reside in my own add-in code.

    I will investigate :roll:
    Best regards / Venlig hilsen
    Johannes Sebastian
    MB7-840,MB7-841
Sign In or Register to comment.