Adding a Detail line total field to a screen - acumatica

I'm trying to simply add a new total field to the Purchase Receipts screen header (the Total Amt that was removed in a more recent release of Acumatica for some reason). It seems like this should have been pretty straightforward, but I haven't been able to get any method I've tried to work; and before I try to manually total all of the detail lines myself in custom code when any change is made in the detail lines, I wanted to find out how to do this the proper way. I've tried the following methods so far that just don't seem to work and my total field remains at zero:
1.) PXFormula on the new custom field on a POReceipt DAC extension (I also tried using PXUnboundFormula since this is an unbound field):
[PXFormula(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(SumCalc<POReceiptExt.usrTotalAmt>))]
2.) PXFormula on a new custom field on a POReceiptLine DAC extension (I also tried using PXUnboundFormula since this is an unbound field):
[PXFormula(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(SumCalc<POReceiptExt.usrTotalAmt>))]
3.) PXDBCalced on a new custom field on a POReceiptLine DAC extension to perform the calc on each line:
[PXDBCalced(typeof(Mult<POReceiptLine.unitCost, POReceiptLine.receiptQty>), typeof(decimal))]
then try to total that with a new view
public PXSelectGroupBy<POReceiptLine, Where<POReceiptLine.receiptNbr, Equal<Required<POReceipt.receiptNbr>>>,Aggregate<GroupBy<POReceiptLine.receiptNbr, Sum<POReceiptLineExtension.usrLineAmt>>>> Totals;
4.) Defining a dataview method to build the view contents and total manually.
What is the proper method? Or, even if you could point me to the code from the previous release that calculated this total, I can possibly use that.

The following post finally led me to a solution that worked for me --> https://stackoverflow.com/a/36870660/7376238 by summing the total manually in the RowSelected event handler.

Related

How to get 'Bills and Adjustment' grid fields in an endpoint extension

I'm working with a client on obtaining Bills and Adjustments values through the Contract based web services. I understand that certain fields aren't available in the Default Endpoint, and have to be obtained through an extension.
I'm trying to add fields from the Bills and Adjustments' Applications tab, but I'm running into a warning that I don't understand. If I extend the Default endpoint for 'Bills' (call it 'BillExt'), and I try to add the Reference Number field from the 'Applications' tab/grid (or any other field from that grid) - I get the following warning (see screenshot below)...
Can someone explain what the issue is, and how I go about adding these fields from the 'Applictaions' tab/grid? I've added fields from the 'Approval Details' grid without this warning without a problem. Is this a warning I can disregard?
You are trying to add a field from another table/view that can return multiple rows for a single Bill.
The correct way to do this is by adding a separate collection on the object and map the view on that collection. e.g: Applications or Details collections here.
That collection will have the information for all records related to the header once you retrieve them using the ?$expand=Details on the query string request.

Customized fields in Opportunity page are getting cleared after navigating records

I am having the following inconvenient when inserting a
custom field on a DAC extension, with Acumatica 17.202.0016 and
18.103.0022 version. In both versions I followed the next steps:
1) Created a "Usr" field "UsrCustomString", on the Opportunities page
CR304000, followed by creating its controls and publishing
the customization project.
Creation of "UsrCustomString" field
2) Then I selected an existing Opportunity and assigned a value in the new field.
Updating record with new value
Checking in DB the updated value
After doing this, I noticed that after navigating
to the next record and then selecting back the
OpportunityID "OP000368", the custom field shows blank. The same happens after pressing the cancel button.
Field is shown blank
I tried this sequence in the Cases page "CR306000" and it worked
correctly. It seems an issue related to the CROpportunity DAC.
Definition of the DAC extension with "CustomString" value
The solution that #cbetabeta, worked well for me. Here is the link for the solution
Custom field on CROpportunity doesn't display saved value since upgrading from 6.10 or 2017R2 to 2018R1

Error occurs when creating an overdue charge

I use the framework to create an Overdue Charge. In previous 5.20 version, there is no issue. I upgraded the site to 6.0. Now an error occurs:
Error #115: An error occurred during processing of the field IsRUTROTDeductible : Index was outside the bounds of the array..
I create the ARInvoiceEntry graph. Next the ARInvoice DAC, and populate the header fields. Finally I call graph.Document.Insert(overduecharge). Transactions are inserted later.
I do have some user fields in an extension table 'ARRegisterExtension'. But that table uses the default InnerJoin, with the matching records from ARRegister included in the table
Please advise if an extra step must happen with RUTROTDeductible. I'm not familiar with this entity.
Try to search for RUTROT in your code.
These fields were moved to an extension in 6.0, so these fields will not be available in ARInvoice DAC any more.
If you are setting these fields anywhere, please remove this code.
These fields are for Sweden users only, so, I don't think you need to set it.

update netsuite parent field via suitescript in view mode

I have scripts that react off of, for example, a client Recalc client event. For example, on my form I have a subtab that users may add or remove items from. Based on actions on this subtab (housing a child record of the parent) I would like a field on the parent to update (say to show a total from the children records).
As I was saying, these events seem to work fine if in edit mode but they do not work correctly in view mode. (even in view mode these child records have a "Delete" option at the end of each row in the subtab. This was provided by netsuite by default.
I wondered if anyone had any tips to best allow this parent field to update real time while in updating the subtab rows with the form in view mode.
Thanks.
You can make a custom field on the parent (header) whose value is determined by saved search. For instance, make a saved search that totals the line values by transaction. Be sure to make it filter by transaction in the Available Filters tab. Make the search public so everyone can use it.
Create the custom field that sources the total from the saved search. Make sure to uncheck the "Store Value" checkbox, as you don't want to store the data, you want to reference the search results. You do this on the Validation and Defaulting tab. You'll see a field for Saved Search there. Choose the search you created above.
As you remove/add/change lines on the transaction, the field updates accordingly. In essence, you don't need a single line of code to make this work - it's all in how you create the search and the custom field that references it.
I have a similar situation posted here.
The NetSuite team answered me by email, and it happens you can't really achieve this on the view mode: some API methods are not available. Their suggestion to my case (and I think it applies to yours too) was really to force a refresh on the whole page.
Of course, you can always achieve this accessing the DOM elements directly, but this isn't a best practice, as your code can stop working if these elements change on a version update.
I had the same problem, I'm not able to restrict on view or remove edit button. But, there was one alternative solution with workflows, you can deploy workflow on child record edit mode restrictions, then if the user clicks edit on view then the record will not be available to edit. This concern will apply to custom record as well.

Is there Java/SSJS equivalent of #AttachmentModifiedTimes?

I want to show list of attachments and FileDownload control is not an option (need custom actions for every file).
To get name and size of attachments there are properties of EmbeddedObject. AFAIK, to get modified time of attachment there is only one option: to use pure #Formula, either via session.evaluate or view containing column with #AttachmentModifiedTimes.
Is there a way (Java/SSJS) to get attachment's modified (and created) time without native #Formulas? That means date stored with file shown in document properties for $FILE item.
You can add a Repeat Control to the page and bind that to the attachments (stored in a rich text field) using document1.getAttachmentList("rt_field_name"). Every item in that list is an object of class
com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder
That class has a getLastModified() method that returns the last modified time as a Double.
A couldn't find a reference on the web showing the full API, but if you use the API Inspector in the XPage Debug Toolbar (sorry for the shameless plug...) you can view all properties and methods using:
getComponent( 'id_of_repeat_control' ).getDataModel().getRowData()
UPDATE
Found the API here,
I am not 100% sure what you want to achieve.
In general you can use #AttachmentModifiedTimes() - as well as #AttachmentNames() - as SSJS.

Resources