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);
Related
I am wondering if there is a way to customize the salesorder manager form /app/accounting/transactions/salesordermanager.nl?type=fulfill&whence=
We need to add a custom field that is to be populate for the fulfillment (it is used during the one by one process, it is also needed during the bulk process)
Not sure if you can customize this page but for your use case, there is a Set Fields tab under the filters. You can choose your custom field in the tab then assign the value.
Is it possible to add a select tickbox to the PXSelectReadonly View, and make it available for the user to tick items from the grid?
I tried adding it but it is always disabled. I can understand that this is because the PXSelectReadonly does not allow updating so everything would be read-only, but is still a way to achieve this, or do you need to use a standard PXSelect view, and then disable everything except the select tickbox?
Difference between read-only and regular data views is explained in detail in the Merged and Read-Only Retrieval Modes section of the T200 training class, which can be downloaded from Acumatica Open University). Read-only data view types do not contain or execute any UI presentation logic and, in terms of presentation, logic are identical to regular PXSelect types. Have you tried enabling Select field in the RowSelected handler or BLC constructor? It would also help if you update your question with source code of your DAC and BLC.
Update based on the comment from Joseph Caruana below:
Besides the difference in data retrieval modes, PXSelectReadOnly data views now make entire grid read-only ignoring all field state configurations made at the runtime via PXUIFieldAttribute.
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.
I want to be able to get the data and sort it in-memory. I am able to get JSON data using dojox.data.JsonRestStore. Now my question is how do I store it in memory and do in-memry sorting when I click on Dojo Datagrid headers. From what I have searched so far, it is not possible to sort the datagrid in-memory/client-side as it will request the sorted data from my Rest Service. As it is custom rest service, I am not able to sort the data on server side (or is it possible?).
Thanks in advance.
Arun
Outside of XPages, you should be able to set an attribute of the grid to do this -- clientSort: true
However, this doesn't seem to take effect within XPages. I tried the following, with no success:
Adding a clientSort attribute with a value of true to the grid control (via the Dojo tab). The attribute showed up in the right place in the page source, but had no effect. (Programmatically checking the property returned a value of undefined.
Setting [grid].clientSort = true on the onClientLoad event of the page. When checked programmatically, the property would show that it is now set to true, but it had no effect.
I even tried adding it to a grid created programmatically (without the Dojo Data Grid control) and it had no effect.
It appears that either XPages is wiping out the attribute or that it just doesn't work within XPages with a remote data source. (My first two attempts used a REST service. My third attempt used a remote XML data source.)
I still think it's worth attempting to see whether it works with a local data source (like a read-write item store), but I have not had a chance to try that yet.
I am new to CRM, and I have run into a requirement where I have to show some controls (textbox, option set, etc) and custom entities (sub - grid) as readonly. But, when I made them readonly, they appears like disabled and are getting grayed out. Is there any way to make them only read only not look like disabled?
Please suggest.
Thanks,
Ashfaq.
in CRM read-only means fields are greyed out but still they are readable.
If you want to make the fields visible as normal but don't want them to be editable by the user, you need to write JavaScipt for that.
Take the following steps.
1. Make the fields editable.
2. On form's OnSave Event, call the following method to prevent the attributes to be saved.
function PreventSave()
{
Xrm.Page.getAttribute(“CRMFieldName”).setSubmitMode(“never”);
}
It will not grey out the fields and still prevent the user to change their values.
I hope it will help you.
For text fields, there is one type of text field that when set to readonly does not look like it is disabled. Off the top of my head I can't remember which type. For the other field types I have not found a way to not have them look disabled when made readonly.
Other option is not to use form fields but show the data you need to be readonly (and not grayed out) in a web resource (HTML/SL/etc). Be aware tho that if your users are using outlook with crm addin, there are limitations here when the record is viewed in the outlook reading pane.
Only other option I can think of is to not set the fields as readonly but control any field data changes with javascript.
In short, I haven't found a good way to do what you need.