Field Value not saving - acumatica

I have a custom screen with 2 tabs, both of the tabs uses 2 different Views. When I make changes on the second tab's (Preferences) field I have to be on the first tab (Collection Options) in order to save the changes made on the second tab (Preferences).
Screenshot 1: Preferences tab
Screenshot 2: "DataSource: CollectionOptionsGraph" Properties
Screenshot 3: "Tab: CstPCTab1" properties
Screenshot 4: "Collection Options' Grid: View" properties
Screenshot 5: "Preferences Form: ViewPreference" Properties
Code snipped of Graph
public class CollectionOptionsGraph : PXGraph<CollectionOptionsGraph>
{
// public PXSelect<CollectionOptions, Where<CollectionOptions.id, Greater<Zero>>> View;
public PXSelect<CollectionOptions> View;
public PXSave<CollectionOptions> Save;
public PXCancel<CollectionOptions> Cancel;
public PXSelect<ProofOfDeliveryPreferences> ViewPreference;
public PXSave<ProofOfDeliveryPreferences> SavePreference;
public PXCancel<ProofOfDeliveryPreferences> CancelPreference;
}

Related

Adding custom action to Special Folders of action menu on Bills and Adjustments (AP301000) screen

I would like to add a custom action to the Bills and Adjustments (AP301000) screen which navigates to a report. I want to add the action to the special folder in acumatica (action menu) as shown on screenshot 1 where the red line is.
Screenshot 1: Action Menu
Below code is used to add the action to the menu
public class APInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AP.APInvoiceEntry>
{
public override void Initialize()
{
base.Initialize();
//this added the report to the reports menu
Base.report.AddMenuAction(SupplierInvoice);
}
public PXAction<PX.Objects.AP.APInvoice> SupplierInvoice;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Supplier Invoice")]
protected void supplierInvoice()
{
if (Base.Document.Current.RefNbr != string.Empty)
{
//create parameters for report! Check report by editing it to see what reports are needed
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["RefNbr"] = Base.Document.Current.RefNbr.ToString();
parameters["DocType"] = Base.Document.Current.DocType;
//the report number gets set below and parameters are sent with
throw new PXReportRequiredException(parameters, "AP641500");
}
}
}
}
The error which I get is shown in below screenshot
Screenshot 2: Code error
The issue I encountered is that the report folder for the Bills and Adjustments (AP301000) screen in the screen editor of the customization does not the Layout Properties as shown in the screenshot below:
Screenshot 3: Bill and Adjustments (AP301000) Screen Editor
The Acumatica Version I am currently using is: 22.101.0085
How could I possibly fix the error in order to add the action in the action menu of the screen?
You can apply a Category to the action that should position it correctly in the category:
public override void Initialize()
{
base.Initialize();
SupplierInvoice.SetCategory("Reports");
}

How can I disable the Employee Timecard (EP406000) 'update' button

I've been able to disable the insert and delete buttons on the Employee Timecards screem (EP406000) - but the update button doesn't seem to care. Here's my code:
protected void TimecardFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
Base.create.SetEnabled(false);
Base.update.SetEnabled(false);
Base.delete.SetEnabled(false);
}
It works for the insert and delete - but not for the update. I noticed in the source code that the code for the update button is a little different in that it doesn't have a [PXUIField] attribute, along with a few others. The insert and delete buttons have a similar setup and attributes, but update is definitely different. Not sure if this is why.
Bottom line: How can I disable the update button on the Employee Timecard (EP406000) screen?
Your diagnostic that the Update action is missing the PXUIField attribute is spot on.
Some button properties functionality requires having a PXUIField attribute.:
You can redefine the Update action to add the PXUIField attribute:
using PX.Data;
namespace PX.Objects.EP
{
public class TimecardPrimary_Extension : PXGraphExtension<TimecardPrimary>
{
public PXAction<TimecardPrimary.TimecardFilter> update;
[PXButton(Tooltip = Messages.EditTimecardToolTip, ImageKey = PX.Web.UI.Sprite.Main.RecordEdit)]
[PXUIField]
protected virtual void Update()
{
EPTimeCard row = PXSelect<EPTimeCard, Where<EPTimeCard.timeCardCD, Equal<Current<TimecardWithTotals.timeCardCD>>>>.Select(Base);
if (row == null) return;
PXRedirectHelper.TryRedirect(Base, row, PXRedirectHelper.WindowMode.InlineWindow);
}
protected void TimecardFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
Base.create.SetEnabled(false);
Base.update.SetEnabled(false);
Base.delete.SetEnabled(false);
}
}
}
Adding the PXUIField attribute will make the SetEnabled method work:
If you double-click on a grid record it will invoke the Grid default action (update in this case).
When double-clicking the record it will notify the user that the action is disabled:
To prevent invoking a disabled default action, you can customize the grid action bar to remove the default action:

Acumatica Determine which button was clicked (Save or Complete)

Activity screenshot
How can I determinate which button was clicked in Acumatica on the Activity screen (CR306010)?
I need to determinate on the Acumatica Activity screen which button was clicked: Save button, Save & Close or Complete.
I tried idea to use Acumatica PXContext.Session.SetString.
I overrided CRActivityMaint BLC and markAsCompleted() inside in order to set buttonclicked value for Complete button:
public delegate void markAsCompletedDelegate();
[PXOverride]
public void markAsCompleted(markAsCompletedDelegate baseMethod)
{
baseMethod();
PXContext.Session.SetString("buttonclicked", "Complete");
}
but I can't find a way to set for the same key (buttonclicked) value "Save" (when save button was clicked) and value "Save & Close" when Save & Close button was clicked.
I need to find a way somehow to set:
PXContext.Session.SetString("buttonclicked", "Save"); - for Save button;
PXContext.Session.SetString("buttonclicked", "Save & Close"); - for Save & Close button;
Is that possible in Acumatica to set it inside of some overeided method like:
**Pseudocode:**
public delegate void needToFindSaveDelegate();
[PXOverride]
public void needToFindSave()
{
baseMethod();
PXContext.Session.SetString("buttonclicked", "Save");
}
and:
**Pseudocode:**
public delegate void needToFindSave&CloseDelegate();
[PXOverride]
public void needToFindSave&Close()
{
baseMethod();
PXContext.Session.SetString("buttonclicked", "Save&Close");
}
I would be very thankful for any help how it can be accomplished.
Thanks in advance.
Have a nice day.
I have found out that Acumatica add the action name to the HttpRequest Parameters in the __CALLBACKPARAM parameter. So you can get which action has been called by checking it. You will need to add System.Web to your solution for being able to work with HttpContext.
string actionName =HttpContext.Current.Request.Params["__CALLBACKPARAM"].Split('|')[0]
Below is screenshoot of the value in case of pressing save button on Sales Orders Page:
And here is case of the Save and Close press:

Adding a Customized Button to a Processing Page [Acumatica]

I am trying to customise an Acumatica Processing Page by adding my own processing button. I have tried the usual methods of extending the processing page but unfortunately the button is not displayed on the page.
public class APPrintChecks_Extension : PXGraphExtension<APPrintChecks>
{
public PXAction<APPayment> Test;
[PXProcessButton]
[PXUIField(DisplayName = "Button Test")]
protected virtual IEnumerable test(PXAdapter adapter)
{
return adapter.Get();
}
}
I do not want to override the existing functionality provided by the processing button and as such would like to add my own.
Thanks.
The primary view of the Process Payments / Print Checks page is Filter which is of type PrintChecksFilter. So you need to have your PXAction on that Type. Try to replace
public PXAction<APPayment> Test;
with
public PXAction<PrintChecksFilter> Test;

Customize Add Stock Item in SO and PO

currently I am doing some customization in "add stock item" of Sales Order and Purchase Order in acumatica, in this customization I added "Marked For" column but it is not editable even though its already there, how can I make it editable for the users?
Attached here is the screenshot of customized "add stock item".
Things done:
Extended SoSiteStatusSelected DAC.
Edited .aspx and added Marked For Column
Add your field to your SOOrderStatusSelected DAC extension. It has to be an unbound field because the DAC is not bound to a table. You can add further logic in event handlers to persist to database.
public class SOSiteStatusSelectedExt : PXCacheExtension<PX.Objects.SO.SOSiteStatusSelected>
{
[PXString]
[PXUIField(DisplayName="Marked For")]
public virtual string UsrMarkedFor { get; set; }
public abstract class usrMarkedFor : IBqlField { }
}
Enable the field in SOOrderEntry graph extension in the RowSelected event:
public class SOOrderEntryExtension : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOSiteStatusSelected_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
PXUIFieldAttribute.SetEnabled<PX.Objects.SO.SOSiteStatusSelectedExt.usrMarkedFor>(sender, e.Row, true);
}
Tested in Acumatica v6.10.0010 for SalesOrder screen:
Digging into SOSiteStatusLookup which is inherited from INSiteStatusLookup you will find that 'OnRowSelected' it is disabling all fields except for 'Selected' and 'QtySelected' columns. To override this, try adding the following to a SOOrderEntry graph extension for any field you want to add to this view as editable from your extension...
protected virtual void SOSiteStatusSelected_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
{
del?.Invoke(sender, e);
PXUIFieldAttribute.SetEnabled<MyExtension.MyField>(sender, e.Row, true);
}
Replace 'MyExtension' with your class extension name and 'MyField' with the mark for field name.

Resources