Hi Everyone,
Goal for today: reuse attributes of the Acumatica fields.
I am sure most of you when tried to add a new field to Acumatica, was thinking about reusing the selector from an existing fields.
For example, in a screen for RQ Request I would like to add Project ID field.
I know that this field is used in GL Journal Transaction details also in AR Invoice header screen and many other places.
There is one issue, however...
When i look at the Attributes of this field, I found scribblings that impossible to understand and therefore reuse:
This attribute is hardcoded somewhere in Acumatica, and is very hard to understand what is inside this ActiveProjectForModule...
Well, it was a problem till version 4.2. Before the browser did not display special source code.
But now, in Acumatica 4.2 onward, I can find what is behind this sacred code and reuse it the way I want.
Let me show the place where you can search for the code.
Navigate to your web site then App_Data\Code Repository\PX.Objects\PM\Descriptor\
Here we have a file Attribute.cs lets open it and find what we want, basically search for ActiveProjectForModule:
You may see, there are 4 constructor elements inside this class. Choose the best appropriate, I would take simplest one: ActiveProjectForModuleAttribute(string module)
Lets use this attribute for the newly added control at the requisition module:
1. I do not need to default anything.
2. [PM.ActiveProjectForModule(PX.Objects.GL.BatchModule.AR)] will be the attribute.
Why PX.Objects.GL. need to be added in forn - is due to Attributes are not in the main graph form and need to be declared directly.
So we have a single parameter left from the original AR Screen attribute.
And result here we are:
All the best,
Sergey.
No comments:
Post a Comment