How to set the currency of a GL transaction in code - acumatica

I'm creating transactions in code using graph objects for GLTran, and I'd like to be able to set/change the currency as you would on the screen. I only have access to the 'CuryInfoID' field - which isn't a currency. The control on the screen is a bit cryptic, as it's not a field in the Batch DAC - it seems to be its own control.
Is there a way in C# code, using the graph object, to set the currency ID to something like 'USD', or 'GBP' as you can in the control on the screen?
What's the best way of dealing with this?

you should be able to set the Batch DAC (GLTran's parent header record).
batch.CuryID = "USD"
Set this before inserting your GLTran lines. Do not worry about setting CuryInfoID as this should be set for you after setting CuryID and saving.

Related

How to Enable Fields when used from API

How can I set fields to be updateable in the API but, read-only on the screen?
I have a view with a custom table defined in a Graph extension. I am using the (ViewName).AllowUpdate = false; on the RowSelected event of the primary DAC. This works fine to make all of the fields in the view disabled on the screen but, I can't update the fields in the API. Is there some way to detect that the graph is being used in the API versus the screen?
TIA!
What you can do is in the row selected event instead of affecting the restriction at cache level, which as you said affects the API as well, you can use the PXUIFieldAttribute to achieve the same scenario without affecting the API.
Ex: PXUIFieldAttribute.SetReadOnly([ViewName].Cache, null, [Condition or just set as true])
This will set all the fields in that view as readonly, without having to repeat the line for all the fields currently in the screen.
I had a similar requirement to allow edit on a custom field in Shipment graph only through API and not through UI.
You could use the Graph.IsContractBasedAPI method that returns true if the request came through contract based API as shown below:
PXUIFieldAttribute.SetEnabled<SOShipLineExt.usrBOLQty>(cache, e.Row, Base.IsContractBasedAPI);

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.

How to disable Replicated Data Population in Docusign programmatically?

According to Docusign
Data Population Scope is a great way to speed up the signing process by duplicating their data throughout the document automatically
I want to prevent this replication from happening programmatically.
Is there an argument I can pass to Text that would prevent this? Maybe something like:
Text(data_label="some_unique_label")
I tried doing
Text(name="some_unique_name")
This did not prevent data linking between other Text fields. According to the Docusign documentation I need to set a unique data label for each Field. However, I am not finding a data_label option for Text.
You're looking for the tabLabel parameter.
Data is populated between fields that have the same tabLabel, so if you make those unique, they won't share data.

How to enable customization textbox in CA304000 screen?

I adding some customization field in CA304000 ( Finance ->Cash Managerment -> Transaction) but these text field automaticaly disable.
Can you guy help me please ?!
Looking at the CATranEntry graph in CAAdj_RowSelected you will see the entire row is marked as enabled = false (PXUIFieldAttribute.SetEnabled(sender, adj, false);)
You need to extend this graph and CAAdj_RowSelected to enable your fields with similar logic found in the graph already. For example there is already a check for determining if the transaction is released:
PXUIFieldAttribute.SetEnabled<CAAdj.curyControlAmt>(sender, adj, adjNotReleased);
You will use this same syntax for your custom fields with something like this
PXUIFieldAttribute.SetEnabled<CAAdj.usrTNVName>(sender, adj, adjNotReleased);
Use the same logic found in the base graph for how adjNotReleased gets set and use it in your extension.

CRM2011: Is it possible to set subgrid value via javascript?

I have a subgrid on a form, I want to show different value which is calculated base on another field on the form.
I don't want to save to database, just for display purpose, is it possible to set the value use javascript?
I'm afraid the answer to this is no.
There's no concept of 'calculated fields' in MSCRM, I found this a disappointment when I switched to MSCRM from SalesLogix which does support display-only calculated fields.
The only way you could possibly do this without data changes would be hacking the DOM of the grid control, but this is very much unsupported and could get really, really complicated.
If you're willing to concede to make schematic changes, you could add a new field to the entity, and use a workflow process to update the field on save of the entity. Then just add this field to your grid.
You may create a chart with custom calculation on it.
If interested, ask me to know what I mean.

Resources