I am trying to add a new toolbar button next to "TAKE CASE" in Case screen (CR306000). I have customize CRCaseMaint DAC but still the button is not appearing. Can anyone please suggest.
replicated this and issue and solution was PXAction should be public. In sample above its marked as private.
code as follows works:
public class CaseExtension : PXGraphExtension<CRCaseMaint>
{
public PXAction<CRCase> Change2;
[PXButton(CommitChanges=true)]
[PXUIField(DisplayName="Change Me")]
protected virtual void change2()
{
}
}
Here is another reason. In base graph there is code
public PXAction<CRCase> takeCase;
[PXUIField(DisplayName = "Take Case", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Select)]
[PXButton]
public virtual IEnumerable TakeCase(PXAdapter adapter)
Acumatica itself has button TakeCase which blocks your button TakeCase. You need to understand, why you need another one button Take Case because Acumatica team already implemented it. Are you sure you want to replace it?
Following steps are needed for you:
1. Create class library (CL).
2. Reference in created CL dlls from Acumatica folder which start from PX.*
3. In CL add new class CRCaseMaintExt with member TakeCase like this:
public class CRCaseMaintExt : PXGraphExtension<CRCaseMaint>
{
private PXAction<CRCase> TakeCase2;
[PXButton]
[PXUIField(DisplayName = "Take Case")]
public virtual IEnumerable takeCase2(PXAdapter adapter)
{
//your custom code
return adapter.Get();
}
}
4. Take note, that case in TakeCase and takeCase matter. Also matters PXAction
5. Build CL
6. Add reference to CL to your Acumatica project.
Related
I'm extending the AccountByPeriodEnq logic, I just want to add a button on top of my screen to modify the selected GL records but it just doesnt want to show up and I can't figure out why.
Here's my code :
namespace PX.Objects.GL
{
class AccountByPeriodEnqExtensions : PXGraphExtension<AccountByPeriodEnq>
{
#region Actions
public PXAction<AccountByPeriodFilter> Letter;
[PXUIField(Visible = true, DisplayName = "Lettrer")]
[PXButton(CommitChanges = true)]
protected virtual IEnumerable letter(PXAdapter adapter)
{
IReadOnlyCollection<GLTranR> selectedTrans = GetSelectedTrans();
if (selectedTrans.Any())
{
PXLongOperation.StartOperation(this, delegate ()
{
foreach(GLTranR line in selectedTrans)
{
// UpdateSomeFieldsAndPersists
}
});
}
else
{
throw new PXException("Error");
}
return Base.Filter.Select();
}
#endregion
#region Utility
private IReadOnlyCollection<GLTranR> GetSelectedTrans()
{
return Base.GLTranEnq.Cache.Updated
.Cast<GLTranR>()
.Where(tran => tran.Selected == true)
.ToArray();
}
#endregion
}
}
Is there anything I'm missing here ?
Regards,
Edit:
To clarify i'm trying to customize the GL404000, Account Details. And using the inspector I saw the Business logic is in the AccountByPeriodEnq Graph
Using Acumatica Inspect Element feature notice that the 'Account by Period' screen (GL402000) is not using the 'AccountByPeriodEnq' graph.
It is using the 'AccountHistoryByYearEnq' graph instead so that's the graph you want to target:
You also need to declare Actions on the primary DAC of that Graph.
The one for 'AccountHistoryByYearEnq' is a little bit harder to find than usual.
You can use Acumatica Source Code page and search for 'PXPrimaryGraph(typeof(AccountHistoryByYearEnq)':
In this case it is AccountByYearFilter DAC that you should use:
[System.SerializableAttribute()]
[PXCacheName(Messages.Account)]
[PXPrimaryGraph(typeof(AccountHistoryByYearEnq), Filter = typeof(AccountByYearFilter))]
public partial class Account : PX.Data.IBqlTable, PX.SM.IIncludable
{
[…]
}
I think this is a special case for Filter, when there's no filter Account would have been the DAC to use for the Actions.
Now that you have identified the Primary Graph of the Screen (AccountHistoryByYearEnq) and the Primary DAC of the Graph (AccountByYearFilter) it should work as expected:
public class AccountByPeriodEnq_Extension : PXGraphExtension<AccountHistoryByYearEnq>
{
public PXAction<AccountByYearFilter> letter;
[PXUIField(DisplayName = "Letter")]
[PXButton]
protected virtual IEnumerable Letter(PXAdapter adapter)
{
return adapter.Get();
}
}
UI:
EDIT:
For Account detail page (GL404000), use the same code with different DAC and Graph:
using PX.Data;
using System.Collections;
namespace PX.Objects.GL
{
public class AccountByPeriodEnq_Extension : PXGraphExtension<AccountByPeriodEnq>
{
#region Actions
public PXAction<AccountByPeriodFilter> letter;
[PXUIField(DisplayName = "Letter")]
[PXButton]
protected virtual IEnumerable Letter(PXAdapter adapter)
{
return adapter.Get();
}
#endregion
}
}
With a base Acumatica install that's all that is needed for the Action to appear:
Note that you can specify explicit state and view rights for the button control, though I don't think your issue is related to access rights if you're working in a developer instance:
[PXUIField(DisplayName = "Letter",
MapEnableRights = PXCacheRights.Select,
MapViewRights = PXCacheRights.Select)]
I finally found my problem, I missed the public member for my class.
namespace PX.Objects.GL
{
public class AccountByPeriodEnqExtensions : PXGraphExtension<AccountByPeriodEnq>
{
#region Actions
public PXAction<AccountByPeriodFilter> Letter;
Thanks for your answer HB, i'll reuse it.
I need to add some logic to the CreateServiceOrder action that is shown on the CRCaseMaint screen. I've discovered that the logic actually exists in the file called SM_CRCaseMaint.cs in a class that is an extension of CRCaseMaint. This file is part of base Acumatica, so it is already an extension but cannot be edited directly without risk of losing the changes when the instance is updated. When I attempt to create a graph extension:
I get an error:
Is there any way I can edit this page?
According to Brendan's answer here, as of Acumatica version 2018R1 Update 4 (18.104.0023) you can override or redefine the content of the graph extension shipped with the product.
I did a test with CreateServiceOrder action in version 2018R2 and it worked. The debugger did break into the redefined action when I invoked Create Service Order action from a case:
using PX.Data;
using PX.Objects.FS;
namespace PX.Objects.CR
{
public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
{
[PXCopyPasteHiddenView]
public PXFilter<FSCreateServiceOrderOnCaseFilter> CreateServiceOrderFilter;
public PXAction<CRCase> CreateServiceOrder;
[PXButton]
[PXUIField(DisplayName = "Create Service Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual void createServiceOrder()
{
CRCase crCaseRow = Base.Case.Current;
FSxCRCase fsxCRCaseRow = Base.Case.Cache.GetExtension<FSxCRCase>(crCaseRow);
if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
{
Base.Case.SetValueExt<FSxCRCase.sDEnabled>(crCaseRow, true);
Base.Case.SetValueExt<FSxCRCase.branchLocationID>(crCaseRow, CreateServiceOrderFilter.Current.BranchLocationID);
Base.Case.SetValueExt<FSxCRCase.srvOrdType>(crCaseRow, CreateServiceOrderFilter.Current.SrvOrdType);
Base.Case.SetValueExt<FSxCRCase.assignedEmpID>(crCaseRow, CreateServiceOrderFilter.Current.AssignedEmpID);
Base.Case.SetValueExt<FSxCRCase.problemID>(crCaseRow, CreateServiceOrderFilter.Current.ProblemID);
Base.Case.Cache.SetStatus(crCaseRow, PXEntryStatus.Updated);
Base.Save.Press();
}
}
}
}
I was creating a new Screen with the FormDetail template where I would be having a Filter DAC and list of DAC to display on Grid. I created the page successfully. Then,I wanted to put a button on the top of the button which would pull data from api and refresh grid. So, I wrote the below code to render an action button on page(FormDetail) like this.
But, it is not working.
using System;
using PX.Data;
namespace AcumaticaSquarePOSIntegration
{
public class SquarePOSTransactionInquiry : PXGraph<SquarePOSTransactionInquiry>
{
public PXSave<MasterTable> Save;
public PXCancel<MasterTable> Cancel;
public PXFilter<MasterTable> MasterView;
public PXFilter<DetailsTable> DetailsView;
public PXAction<MasterTable> Calc;
[PXUIField(DisplayName="Calc")]
[PXButton]
protected virtual IEnumerable calc(PXAdapter adapter)
{
return adapter.Get();
}
[Serializable]
public class MasterTable : IBqlTable
{
}
[Serializable]
public class DetailsTable : IBqlTable
{
}
}
}
I even tried add
Is there anything that I am missing here?
You have two PXFilters, change the second to PxSelect and make the PXFilter your first Data view in the list.
try using PXProcessButton instead of PXButton.
Also make sure MasterView is specified in aspx as a PrimaryView.
I want to call SmartPanel to popup by press any keys.
Example: We click F3 in Selector Field. It'll popup search panel to select.
Could you please check my answer in another thread? You should have no problems utilizing PXButtonAttribute ShortcutChar property with an action opening popup.
For example, the following extension SOOrderEntry extension class will open Inventory Lookup on the Sales Order screen with the F2 key press:
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public PXAction<SOOrder> addInvBySite;
[PXUIField(DisplayName = "Add Stock Item", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXLookupButton(ShortcutChar = (char)113)]
public virtual IEnumerable AddInvBySite(PXAdapter adapter)
{
return Base.addInvBySite.Press(adapter);
}
}
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;