Hello!
I built the msdn-example for control-addins and i got now the question how it is possible to pass data from Nav to Addin without using SourceExpr?
My example:
Customer Card, Field "Name".
I want the Backcolor/Bold changed like in the MSDN-Control-Addin example, but i want to parametrize it, so it is general Addin and not a "constant" Addin "FieldLightBlueBold", "FieldRed", "FieldGreenBoldItalic" for evry possible combination.
I checked different blogs and msdn and they always use SourceExpr with xml but that doesn't work with a "real" field.
Any help is appreciated
Thanks in advance!
Cheers,
Jan
Comments
It is a limitation in the Add-Ins that they support binding to a single value using source expressions. (Of course on the Add-In Site interface it gets additional properties like Enabled, Editable, Style, Caption etc that can be used by the Add-In to influence rendering.)
The root cause of the issue is the following:
While having a "PinkField" Add-In is a nice easy to implement HelloWorld type sample that can easily be used to demonstrate the use of an Control Add-In it is not the intended use of Add-Ins. The primary use case we had in mind at designing this feature is not to use Add-Ins to substitute elements of the UI with custom controls, that is applied to lots of fields with ease. The goal is to provide possibility to advanced visualisation like in case of the TreeMap sample: You have it in just a few place in your NAV application but it provides bigger increase in end user interaction value. Another possible scenario is when you have some client side integration component (like a Bar-Code-Reader) and you want to embedd its custom interface into the NAV user interface instead of displaying separately.
In such cases when the Add-In appears just on a few page then using a single source expression with all the required parameter channeled into an XML description is a small limitation. (I guess mostly performance issues might arise)
In your specific example as a workaround you can try to use the Style property with its 5 possible value. Or as a nastier one make the Add-In display the Caption as well and then use that to channel metainformation. Finally you might move the logic determining the display style into the AddIn. (Like create an add-in that if its value is a negative number is red, and if positive it is green.)
Whichever option you choose in you Add-In implementation make sure you just send such information to the Add-In you wouldnt be afraid to show your end user directly. It is in his box after all.
I hope it makes sense.
Gabor Pesti
“This posting is provided "AS IS" with no warranties, and confers no rights.”
Software Developer Engineer in Test
MSFT
Dynamics NAV