Using a custom table/DAC in a generic inquiry in 2020R2 - acumatica

I am upgrading a customization project from 2019R1 to 2020R2. I have several custom tables/DACs that I reference within generic inquiries. In 2019R1, I'm able to select from these and it works fine without error.
In 2020R2, an obsolete table error is raised for existing customizations and I'm not able to select new custom DACs at all.
Is there an attribute or another way to suppress this error and allow visibility of new custom DACs so they can be used within generic inquiries?
Here is the code for my custom DAC:
namespace P1S
{
[System.SerializableAttribute()]
[PXCacheName("P1S Shipment Serial Nbrs.")]
public class PSSOShipSerialNbrs : PX.Data.IBqlTable
{
... column definitions ...
}
}

Unpublishing all customizations and then re-publishing from the main Customization Project screen (SM.20.45.05) fixes the error. Custom DACs are also now visible in the table selector.

Related

Is there a way to prevent creation of a data class item in C# WindowsForms UserControl

If I create a UserControl, to create and edit an instance of a data class e.g. Person in C# WindowsForms (call it PersonControl), the framework automatically adds an instance of Person in PersonControl.Designer with some default values for the properties and fills the item controls with those values. This behavior has a number of side effects which I would like to avoid.
Question: is there a defined way to prevent creation of a data class instance in UserControl.Designer?
I think you missing the DesignerSerializationVisibility attribute. If you have a custom control every public property that you add will automatically be serialized. You can use this attribute to disable the serialization for a property. I also recommend to add the Browsable attribute which will hide the property from the designer. If you want more control over serialization, like you want to serialize only when another property is set to true you can create a special named method which will then called by the designer Defining Default Values with the ShouldSerialize and Reset Methods. There was a MSDN Magazine where a lots of winform learning resource was relased there are some gems about winform internal working. If you interested in you can quickly look trhrough it. My favorite is. Create And Host Custom Designers With The .NET Framework 2.0
Sorry but i didn't mention another attribute DefaultValue You can use the attribute the following way.
public partial class PersonEditControl : UserControl
{
[DefaultValue(null)] // This attribute tells the designer if the property value matches what we specified in the attribute(null) it should not store the property value.
public PersonData? Person { get; set; }
public PersonEditControl()
{
InitializeComponent();
}
}

How do I add a Lead Source option

I'm trying to add options to the Source dropdown on the Leads screen. The field uses the CRMSourcesAttribute class to define the existing list. After simply creating a new attribute class to add my own items, I extend the CRLead.Source CacheAttached event to use my new attribute class instead. The result is that there is no change - the new dropdown items are not shown. After doing this, if I inspect the field and select the Drop Down Values button, I do actually see the new options in the Drop Down Values popup window. Any ideas on what could be preventing the new options from displaying in the dropdown itself?
Here's how I configure it in my LeadMaint graph extension:
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(CRMSourcesAttribute))]
[CRMSourcesExt] // list with old + new options
protected virtual void _(Events.CacheAttached<CRLead.source> e) { }
(v20R2)
Another option is to use code and create a new attribute class with new options, then override the DAC field to use it instead. However, as far as I know, you still have to go through the steps of activating the new options in the workflow customizations UI for each of the fields you're overriding. But then you can refer to the new options in code without having to search the list's AllowedValues at runtime.
With help from a colleague, I was able to get it working, and “without code” through screen workflow customization. I removed my code, then customized it with a new custom Workflow copied from the default. Not sure yet of the ramifications of this, like if we can access the new options in other real code or not, but I see how to create these options now. It has to also be done for both Lead and Opportunity in this scenario. It’s a bit tedious and ethereal (good word) though. I can see this easily causing problems and unexpected results for us we’ll want to watch out for.
Update 5/28/21: I added the options in the Workflow customizations for the field, then copied the default workflow to a new workflow, activated it, and activated the new options for each state/transition. I don't like it, but Acumatica tells me "that's just the way it is now". Note: you'll want to do this for other places referencing CRMSourcesAttribute as well, such as Opportunity.

Default Sales Order/Quote menu disappers after publishing customization

We are in to acumatica 20 r2 and when we publish the custom package, the default report menu print salesorder/quote option disappears.
We have custom reports which are added by overriding the initialize method of salesorderentry graph in my extension.
public override void Initialize()
{
base.Initialize();
base.Base.report.AddMenuAction(embroideryreport);
base.Base.report.AddMenuAction(embroiderysoreport);
base.Base.report.AddMenuAction(screenprintreport);
base.Base.report.AddMenuAction(screenprintsoreport);
}
I am not able to figure out the reason for missing report. I have upgraded the workflow to latest version and still having the issue.
UPDATE
I did not call base.Initialize() initially and since the default report is not coming, I thought it may be due to not invoking the base method.
I have tried bahaa-zantout suggestion and the base report is already tagged to the report menu and when I commented on the code in Initialize method for adding the report the default report appeared again under-report menu.
It looks like there is conflict in the workflow and I am not able to figure it out.
I have tried to add those report in the workflow action section and tagged them to Report and the entire report menu disappeared
Change you initialization method to....
public override void Initialize()
{
base.Base.report.AddMenuAction(embroideryreport);
base.Base.report.AddMenuAction(embroiderysoreport);
base.Base.report.AddMenuAction(screenprintreport);
base.Base.report.AddMenuAction(screenprintsoreport);
}
From Acumatica DEV documentation portal
You do not need to explicitly invoke the Initialize() method on the previous extension levels; these methods are called automatically. Invoking base.Initialize() makes no sense, because the base variable points to the base class, which is PXGraphExtension (not the base graph). The PXGraphExtension class defines Initialize() as an empty method.
You could attempt the following in attempt to restore the toolbar menu item.
Navigate to the Sales Order screen in the customization project
Go to the Actions
Locate the missing print options (ie. printSalesOrder) and place the Toolbar folder in the original folder in this case "Reports". If it doesn't work try moving to "Actions" and see if it appears.
See example screenshot.
I am not sure it is due to this statement or not but when I changed the following statement it fixed the issue
[PXButton(SpecialType = PXSpecialButtonType.ReportsFolder)]
to
[PXButton]
for Report action
public PXAction<SOOrder> embroideryreport;
[PXUIField(DisplayName = "Embroidery Production Report", MapEnableRights = PXCacheRights.Select)]
//[PXButton(SpecialType = PXSpecialButtonType.ReportsFolder)]
[PXButton]

Unable to Open Cash Sale Form in customization Editor in Acumatica

I am Unable to Open Cash Sale Screen in Customization Editor of Acumatica, after I have added a new tab control with a Grid inside. I have assigned a custom DataView in the data member property of the Grid Control.
It Gives up the following error "The Customization Project Must Be Published before the screen can be edited. Error : The View CommissionCalcView does not exist".
Here "CommissionCalcView" is the name of my custom view, and it is Present in ARCashSaleEntry Extension of my project.
My Code Goes here....
using COMMISSIONMAPPING;
using PX.Objects.AR.Standalone;
namespace PX.Objects.AR
{
public class ARCashSaleEntry_Extension : PXGraphExtension<ARCashSaleEntry>
{
public PXSelect<CommissionCalculation,
Where<CommissionCalculation.cashSaleDocType,
Equal<ARCashSale.docType>,
And<CommissionCalculation.cashSaleRefNbr,
Equal<ARCashSale.refNbr>>>> CommissionCalcView;
#region Event Handlers
#endregion
}
}
Error Image
I have experienced this many times as well. The problem for me tends to be an error in how I define fields in a DAC extension or in improperly defining the view in the form.
In this case, you have BQL that is trying to compare CommissionCalculation (table selected in the BQL) to ARCashSale (table not selected in the BQL). Try adding Current<> on the ARCashSale references in the view so that it pulls the current value from the cache for ARCashSale in the base graph.
using COMMISSIONMAPPING;
using PX.Objects.AR.Standalone;
namespace PX.Objects.AR
{
public class ARCashSaleEntry_Extension : PXGraphExtension<ARCashSaleEntry>
{
public PXSelect<CommissionCalculation,
Where<CommissionCalculation.cashSaleDocType,
Equal<Current<ARCashSale.docType>>,
And<CommissionCalculation.cashSaleRefNbr,
Equal<Current<ARCashSale.refNbr>>>>> CommissionCalcView;
#region Event Handlers
#endregion
}
}
This was an issue with the development process and missing dlls, i removed the dll from the bin folder of my website and removed any key fields from my DAC, and rebuilt the project,
The problem was resolved

I can't get the launch function to work on the Related Entity control

This relates to and extends an existing StackOverflow case that has been answered -
How to place a 'Related Entity' lookup on a field (many thanks to Acumatica support on this as well)
I have a custom screen that adds a 'Related Link' control, like this:
And this works as expected. I've also included several custom screens as entities to link to by adding the NoteID, RefNoteID, RelatedEntity fields to their DACs and the PXRefNoteSelector attribute to their view declarations. Everything works as expected, except that the pencil icon doesn't launch to the entity / screen that's been selected.
Is there something (an attribute, perhaps) that I'm missing in the DACs that needs to be added in order to launch to the selected entity?
You need to decorate the custom entity DAC with PXPrimaryGraph attribute and pass the maintenance page graph type in parameter:
[PXPrimaryGraph(typeof(CustomEntityMaint))]
[Serializable]
public class CustomEntityDAC : PX.Data.IBqlTable
{
}

Resources