Subaccount selector for user field - acumatica

I have added a user field to the Non-Stock Items screen that I want to hold a subaccount selection selected via a selector that works the same way as the other standard subaccount fields on that screen. When looking at source DAC for the other SubAccount fields, there is an attribute for [SubAccount...] that works in a way that I don't really understand. I also have an Account user field that uses a standard PXSelector lookup to the Account table (that works properly).
I've added a modified version of the attribute I found on the other SubAccount fields as follows:
[SubAccount(typeof(InventoryItemExt.usrCOGSAccount), DisplayName = "COGS Subaccount", Visibility = PXUIVisibility.Visible, DescriptionField = typeof(Sub.description))]
Where InventoryItemExt.usrCOGSAccount is my user field which holds the Account ID from the lookup on that user field.
However, when I use this, I get an error on rendering the screen (index outside the bounds of the array).
Bottom line: Is there a way I can make this Subaccount user field have a lookup just like the other Subaccount fields, with the F3 on each segment working independently?

Related

Is it possible to type new Value in PXSelector

I'm using already the [ValidateValue =false] in PXselector attribute, it works when typing new Value on the selector, but it does not selects to null value if I remove the value in the Selector.
the highlighted field is the field that can perform Selecting and Typing new Value. However this behavior is approachable using Autonumber Setup and use Manual Input, but that is not what I wanted.
Thanks.
I would look at the Purchase Receipts (PR000803, POReceiptEntry) screen. You can add a Location dynamically in the grid by typing in the new location name and hitting save. This is accomplished through the field LocationID with Attribute IN.LocationAttribute.

How can I replicate the segmented lookup of the subaccount for a user field

I'm adding a user field to the Order Types screen, which is an int32. I want the same lookup as the subaccount field on the Sales order screen (field name: SalesSubID). Here's what the attributes look like on that field, based on the source DAC:
[PXFormula(typeof(Default<SOLine.branchID>))]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
[SubAccount(typeof(SOLine.salesAcctID), typeof(SOLine.branchID), Visible = false)]
I've tried using these attributes on my user field, but it doesn't work at all. Unfortunately, as all too often happens in Acumatica, HOW this is implementing a segmented F3 lookup is a total black box / mystery, not covered in any training (not to mention how this field even shows up when visible is set to 'false' is a puzzle...).
So - the question is: How can I implement a segmented subaccount lookup on an int32 user field to replicate what the subaccount field is doing on the Sales Order grid?
I don't see any mention of the page so I am guessing you need to make your field in the page a PXSegmentMask
A snip of SalesSubID as defined on sales order page SO301000
<px:PXSegmentMask ID="edSalesSubID" runat="server" DataField="SalesSubID" AutoRefresh="True" />
Otherwise your DAC attributes look good.

How to add the OrderNbr hyperlink in SOLine

I have a grid which displays only SOLine and SOOrder data. In my case, SOLine is the main DAC, because the purpose of the grid is to perform mass updates of the transactions. I wish to add the OrderNbr in the grid, so the user can select and open the sales order popup. I notice the order number field does not appear as a hyperlink, if use SOOrder table in my grid. Next I try SOLine.orderNbr. However the field type is only TextEdit. Here is a workaround
I created the SOLine cache extended and defined a non-bound field. Something simple like ExtraSOOrder field. Next I create a PXAction which creates the SOOrderEntry graph and performs the redirect, and achieves the goal. I notice something odd in the grid. OrderNbr is displayed twice. Although the field is only added once in the grid, the webpage adds the field a second time. In fact, the user is unable to remove the duplicate order number field, in the column selector. The duplicate field has a yellow icon which I have not seen before.
What is the best way to add the redirect, to the sales order entry page? The behavior works perfectly for the Inventory item field in this grid. OrderNbr is more challenging.
All that was required was to add the SOOrder.orderNbr to the grid columns collection. Then assign the action to the Linkedcommand property, to that field. No need to create a cache extension for all of this.

How to add a foreign key reference to the primary key selector control

In the stock item screen, a custom grid is added. The DAC for the custom grid contains InventoryItem.inventoryID. That particular grid has a custom field in which the user wishes to search for, inside the inventory item selector control. I refer to the primary Inventory Item selector control for the stock item screen.
In normal circumstances, the customization manager allows you to select a particular field, and add that to the grid which appears inside the selector control. That is simple, since the field is a member of the same DAC. But in my case, I wish to add a column from the related data view. Since the primary data view has no knowledge of grid, the needed column is not available for selection. Also there is a high probability that records will be repeated inside the selector control, since the relation is one to many. This is acceptable.
I try the following suggestions.
1) use Cache_attached event handler, for InventoryItem.InventoryCD.
I add my own custom PXSelect statement which joins InventoryItem & CustomTable. But an error occurs: A foreign key reference cannot be created from the type 'PX.Data.PXSelectJoin`3[PX.Objects.IN.InventoryItem (ect)
2) Declare data view delegate for Items which yields type InventoryItem & CustomDAC. This approach returns no errors. However I am unable to select the user field, in the field selection panel.
3) Create a Project on InventoryItem DAC and write a PXSelect to join the two tables. I am unsure if this is the correct approach.
I wish to know if anyone has suggestions
You should follow the approach suggested here to concatenate field values from a related data view into a custom text column inside the InventoryItem table.

How to prevent a user from entering a value on a selector field for a value not in the selector list [Acumatica]

Is there a property in the ASPX control to prevent the users from typing a value? Or the property is in the DAC field declaration? In this case, the user must only select from the list of values, provided by the selector. I do not want them to enter a value manually. This is a key field in a custom screen (if this matters?)
The selector attribute by default will validate the value entered by a user unless you have ValidateValue = false on your selector.
This selector for example will allow users to select/enter any value.
[PXSelector(typeof(ARContact.contactID), ValidateValue = false)]
If you make the selector like so, then only the values from the list are allowed to be selected/entered.
[PXSelector(typeof(ARContact.contactID))]

Resources