Feature.xml changes are not showing in Enable/Disable custom feature UI? - acumatica

Add custom feature checkbox is not showing in custom feature UI, My finding
var featureAttributes = cache.GetAttributes(null, field).OfType<FeatureAttribute>();
giving 0 featureAttributes, that's-why it is not visible while i have added Features.xml file with proper tag as suggested in documentation, any thing else am i missing?

All you should need is the table extension for the FeatureSet table. Here is an example:
public sealed class FeaturesSetExtension : PXCacheExtension<PX.Objects.CS.FeaturesSet>
{
#region UsrMyNewFeature
public abstract class usrMyNewFeature : PX.Data.BQL.BqlBool.Field<usrMyNewFeature> { }
[Feature(false, DisplayName = "MY NEW FEATURE")]
public bool? UsrMyNewFeature { get; set; }
#endregion
}
I end up with the following:
You will create a Feature.xml file to then limit pages related to the new feature switch.
If you need to access the switch (which might not register until added into the features.xml):
PXAccess.FeatureInstalled<FeaturesSetExtension.usrMyNewFeature>()

Feature.XML should be in root of our Project.
Attribute
[Feature(false, DisplayName = "MY NEW FEATURE")], should always be
there.
If want to see "MY NEW FEATURE" under a root then look at
below code.
region UsrMyNewFeature
public abstract class usrMyNewModuleFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, DisplayName = "MY Module FEATURE")]
public bool? UsrMyNewModuleFeature { get; set; }
endregion
region UsrMyNewFeature
public abstract class usrMyNewFeature : PX.Data.BQL.BqlBool.Field { }
[Feature(false, typeof(usrMyNewModuleFeature), DisplayName = "MY NEW FEATURE")]
public bool? UsrMyNewFeature { get; set; }
endregion

Related

Add a column to a dac with langage

I would like to add the column "Description Family" taking into account the language of the connected user. I try the function "PXLocalizableDefault", But I don't know how to use this function.
public class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
#region UsrDescription
[PXUIField(DisplayName="Famille description")]
[PXLocalizableDefault(typeof(Search<INItemClass.descr,
Where<INItemClass.itemClassID,
Equal<InventoryItem.itemClassID>>>),typeof(User.languageName????)
,PersistingCheck=PXPersistingCheck.Nothing)]
#endregion
}
Description screen:
I believe you can use PXDBLocalizableString as a replacement for PXDBString and it will provide the functionality you are looking for.
public class InventoryItemExt : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
#region UsrDescription
[PXUIField(DisplayName="Famille description")]
[PXDBLocalizableString(15, IsUnicode = true)]
public string UsrDescription { get; set; }
public class usrDescription : BqlString.Field<usrDescription > {}
#endregion
}

Acumatica - An item with the same key has already been added

I have customization project in Acumatica 2021R1 (v21.104.0018). I have a parent DAC that has an ID and multiple child DACs that use this ID with a PXParent attribute. Whenever I select the screen in the customization project editor to design it, I get an error message that says, "An item with the same key has already been added." Then, I'm not able to design the screen in the Screen Editor. The weird thing is that I don't get this message when I open the actual screen.
I'm not sure what this is referring to because there are no records in the database in the tables that I'm using for the views of the graph for the screen.
Not sure if anyone else has had this problem and knows what causes it, but Acumatica could really use some more specific error messages.
Here is my parent DAC (note: I left out the system fields here for purposes of space):
public class PSImport : IBqlTable
{
#region Import ID
[PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
[PXDefault(PersistingCheck = PXPersistingCheck.NullOrBlank)]
[PXUIField(DisplayName = "Import No.", Visibility = PXUIVisibility.SelectorVisible, Enabled = true)]
[AutoNumber(typeof(PSSetup.numberingID), typeof(AccessInfo.businessDate))]
[PXSelector(
typeof(PSImport.importID),
typeof(PSImport.description),
typeof(PSImport.fileFormat),
typeof(PSImport.status),
typeof(PSImport.description)
)]
public virtual string ImportID { get; set; }
public abstract class importID : PX.Data.BQL.BqlString.Field<importID> { }
#endregion
#region Description
[PXDBString(IsUnicode = true, IsFixed = false)]
[PXUIField(DisplayName = "Description")]
public virtual string Description { get; set; }
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
#endregion
#region File Format
[PXDBString(2, IsFixed = true, IsUnicode = true)]
[PXUIField(DisplayName = "File Format", Enabled = true)]
[PXDefault]
[PXStringList(
new string[]
{
FileFormatTypes.Flats,
FileFormatTypes.IDOA,
FileFormatTypes.MMS,
FileFormatTypes.OCR,
FileFormatTypes.Pressero
},
new string[]
{
FileFormatTypeDisplayNames.Flats,
FileFormatTypeDisplayNames.IDOA,
FileFormatTypeDisplayNames.MMS,
FileFormatTypeDisplayNames.OCR,
FileFormatTypeDisplayNames.Pressero
}
)]
public virtual string FileFormat { get; set; }
public abstract class fileFormat : PX.Data.BQL.BqlString.Field<fileFormat> { }
#endregion
#region Status
[PXDBString(2, IsFixed = true, IsUnicode = true)]
[PXUIField(DisplayName = "Status", Enabled = false)]
[PXDefault(ImportStatusTypes.Unvalidated)]
[PXStringList(
new string[]
{
ImportStatusTypes.Unvalidated,
ImportStatusTypes.Invalid,
ImportStatusTypes.Valid,
ImportStatusTypes.Released
},
new string[]
{
ImportStatusTypeDisplayNames.Unvalidated,
ImportStatusTypeDisplayNames.Invalid,
ImportStatusTypeDisplayNames.Valid,
ImportStatusTypeDisplayNames.Released
}
)]
public virtual string Status { get; set; }
public abstract class status : PX.Data.BQL.BqlString.Field<status> { }
#endregion
#region Date Imported
[PXDBDate]
[PXUIField(DisplayName = "Date Imported", Enabled = false)]
public virtual DateTime? DateImported { get; set; }
public abstract class dateImported : PX.Data.BQL.BqlDateTime.Field<dateImported> { }
#endregion
#region Date of Last Validation
[PXDBDate]
[PXUIField(DisplayName = "Date of Last Validation", Enabled = false)]
public virtual DateTime? DateOfLastValidation { get; set; }
public abstract class dateOfLastValidation : PX.Data.BQL.BqlDateTime.Field<dateOfLastValidation> { }
#endregion
#region Date Released
[PXDBDate]
[PXUIField(DisplayName = "Date Released", Enabled = false)]
public virtual DateTime? DateReleased { get; set; }
public abstract class dateReleased : PX.Data.BQL.BqlDateTime.Field<dateReleased> { }
#endregion
}
Here is one of the child DACs (right now I only have the key because I don't know all of the fields that I need yet, and I'm just trying to start designing the screens):
public class PSTranFlats : IBqlTable
{
#region Import ID
[PXDBString(15, IsKey = true, IsUnicode = true, InputMask = "")]
[PXDBDefault(typeof(PSImport.importID))]
[PXParent(typeof(SelectFrom<PSImport>.
Where<PSImport.importID.IsEqual<PSTranFlats.importID.FromCurrent>>)
)]
public virtual string ImportID { get; set; }
public abstract class importID : PX.Data.BQL.BqlString.Field<importID> { }
#endregion
}
Here is my setup DAC:
[PXPrimaryGraph(typeof(PSSetupMaint))]
public class PSSetup : IBqlTable
{
#region NumberingID
[PXDBString(10, IsUnicode = true)]
[PXDefault("PSIMPORT")]
[PXUIField(DisplayName = "Import Numbering Sequence")]
[PXSelector(typeof(Numbering.numberingID), DescriptionField = typeof(Numbering.descr))]
public virtual string NumberingID { get; set; }
public abstract class numberingID : PX.Data.BQL.BqlString.Field<numberingID> { }
#endregion
}
Here is my setup graph:
public class PSSetupMaint : PXGraph<PSSetupMaint>
{
#region Selects / Views
public PXSave<PSSetup> Save;
public PXCancel<PSSetup> Cancel;
public SelectFrom<PSSetup>.View Setup;
#endregion
}
And here is my main graph:
public class PSImportEntry : PXGraph<PSImportEntry>
{
#region Selects / Views
public PXCancelClose<PSImport> CancelClose;
public PXSaveClose<PSImport> SaveClose;
public PXSave<PSImport> Save;
public PXCancel<PSImport> Cancel;
public PXInsert<PSImport> Insert;
public PXDelete<PSImport> Delete;
public PXFirst<PSImport> First;
public PXPrevious<PSImport> Previous;
public PXNext<PSImport> Next;
public PXLast<PSImport> Last;
public PXSetup<PSSetup> PSSetup;
public SelectFrom<PSImport>.View Import;
[PXImport(typeof(PSTranFlats))]
public SelectFrom<PSTranFlats>.
Where<PSTranFlats.importID.IsEqual<PSImport.importID.FromCurrent>>.View
FlatsTransactions;
[PXImport(typeof(PSTranIDOA))]
public SelectFrom<PSTranIDOA>.
Where<PSTranIDOA.importID.IsEqual<PSImport.importID.FromCurrent>>.View
IDOATransactions;
[PXImport(typeof(PSTranMMS))]
public SelectFrom<PSTranMMS>.
Where<PSTranMMS.importID.IsEqual<PSImport.importID.FromCurrent>>.View
MMSTransactions;
[PXImport(typeof(PSTranOCR))]
public SelectFrom<PSTranOCR>.
Where<PSTranOCR.importID.IsEqual<PSImport.importID.FromCurrent>>.View
OCRTransactions;
[PXImport(typeof(PSTranPressero))]
public SelectFrom<PSTranPressero>.
Where<PSTranPressero.importID.IsEqual<PSImport.importID.FromCurrent>>.View
PresseroTransactions;
#endregion
}
I am not 100% certain, but I think this is about the ID's in the ASPX rather than the database data. For example:
<px:PXLayoutRule LabelsWidth="S" ControlSize="SM" ID="PXLayoutRule1" runat="server" StartRow="True"></px:PXLayoutRule>
Notice ID="PXLayoutRule1" in that sample. If this "ID" value of any entry in the ASPX is duplicated anywhere in the screen as an ID of another entry, you will get an error.
I had similar issues in an earlier version, especially when I would try to customize a screen and have the customization screen interface crash on me in the middle of it. I'd try deleting the screen, but I'd get orphaned files in the CstDesigner and CstPublished folder, which would really compound my issues.
Hopefully, you know how to look through your ASPX file and the Customization Project XML to check all the ID's. If you do know how to walk through all that, just add something to all of your ID values, like an X at the end. (i.e. PXLayoutRule1X) If not, gaining that familiarity is a worthy side-objective as you continue on.
If your issue is the same as I had in the past and you cannot simply find and edit the duplicate ID in the ASPX file or Project XML, here are some steps to take AFTER you backup your project and the affected folders noted in these steps. And, of course, this also assumes you are working in a development copy of your instance. (I often clone my main DEV instance to my laptop to test things like this if I am unsure so that my DEV instance stays unaffected. It just takes extra time you may or may not have.)
Delete the screen from your customization project.
Locate the folder CstDesigner and CstPublished under your instance's root folder (i.e. AcumticaDEV, Sandbox, etc. where your site exists)
Go into the Pages_XX folder (where XX is the 2 character code for your 1st 2 letters of the screen ID)
Delete the screen file(s) from there, if you find them.
If this is a custom screen, go into the Pages folder which is located in the same root folder of your instance as those folders in step 2 and repeat steps 3 and 4 in that folder.
Check for any reference to your screen in the Project XML from the file menu in the Customization Project screen and remove those sections if they exist. (This tends to relate more for customizing an existing screen.)
Publish your project.
Start over on your page and see if you still get the error.
Again, be sure to get a backup before taking these steps so that you can easily put it back if that does not resolve your problem.

Custom fields are not showing updated value when update in field updated event, Why?

I have added custom fields in customization form using the customization form, steps i have added:
1) Go to shipment form and select Transaction Grid.
2) Select Add fields.
3) Select custome and Add 4 fields and save and publish.
4) Add all 4 fields and select used and save.
5) and publish again and all 4 columns are visible.
6) I have added a user fields name Aloow (PXDBBool), UsrPClocation(Location) and UsrPCwarehouse(Site),
and i set the below attribute in warehour and location.
7) But on SOSHipLine_InventotyID_FieldUpdate event, i am setting Allow, location, warehouse all 3 values, but values are not showing in Grid, what is the resoon?
#region UsrQCSiteID
[PXUIField(DisplayName = "PC Warehouse")]
[SiteAvail(typeof(SOShipLine.inventoryID), typeof(SOShipLine.subItemID))]
[PXUIRequired(typeof(Where<usrAllow, Equal<True>>))]
[PXUIEnabled(typeof(Where<usrAllow, Equal<True>>))]
[PXDefault()]
public virtual int? UsrPCSiteID {
get; set;
}
public abstract class usrPCSiteID:PX.Data.BQL.BqlInt.Field<usrPCSiteID> {
}
#endregion UsrPCSiteID
#region UsrPCLocationID
[PXUIField(DisplayName = "PC Location")]
[SOLocationAvail(typeof(SOShipLine.inventoryID), typeof(SOShipLine.subItemID), typeof(SOShipLineExt.usrPCSiteID), typeof(SOLine.tranType), typeof(SOShipLine.invtMult))]
[PXUIRequired(typeof(Where<usrQCRequired, Equal<True>>))]
[PXUIEnabled(typeof(Where<usrQCRequired, Equal<True>>))]
[PXDefault()]
public virtual int? UsrPCLocationID {
get; set;
}
public abstract class usrPCLocationID:PX.Data.BQL.BqlInt.Field<usrPCLocationID> {
}
#endregion UsrPCLocationID
#region Allow
[PXDBBool]
[PXUIField(DisplayName = "Allow")]
public virtual bool? UsrAllow {
get; set;
}
public abstract class usrAllow:PX.Data.BQL.BqlBool.Field<usrAllow> {
}
#endregion
IS SOShipLine allow updating custom values?
The steps that you described look correct.
I recreated this scenario locally:
1 - My DAC extension looks as follows:
public class SOShipLineExt : PXCacheExtension<PX.Objects.SO.SOShipLine>
{
#region UsrPCSiteID
[PXUIField(DisplayName = "PC Warehouse")]
[SiteAvail(typeof(SOShipLine.inventoryID), typeof(SOShipLine.subItemID))]
public virtual int? UsrPCSiteID {
get; set;
}
public abstract class usrPCSiteID:PX.Data.BQL.BqlInt.Field<usrPCSiteID> {
}
#endregion UsrPCSiteID
#region UsrPCLocationID
[PXUIField(DisplayName = "PC Location")]
[SOLocationAvail(typeof(SOShipLine.inventoryID), typeof(SOShipLine.subItemID), typeof(SOShipLineExt.usrPCSiteID), typeof(SOShipLine.tranType), typeof(SOShipLine.invtMult))]
public virtual int? UsrPCLocationID {
get; set;
}
public abstract class usrPCLocationID:PX.Data.BQL.BqlInt.Field<usrPCLocationID> {
}
#endregion UsrPCLocationID
#region Allow
[PXDBBool]
[PXUIField(DisplayName = "Allow")]
public virtual bool? UsrAllow {
get; set;
}
public abstract class usrAllow:PX.Data.BQL.BqlBool.Field<usrAllow> {
}
#endregion
}
Notes about the DAC Extension:
I removed references to PXUIEnabled and PXUIRequired. If you are looking to disable the Site and the Location based on the checkbox's value, I recommend you manage this logic in the RowSelected event. (it may be feasible with your approach but I have not used it before)
The PXDefault references were also removed, given that in most cases the Shipment is created directly from the Sales Order page. As you have it right now, the field is mandatory but no default value is being assigned which will cause an error. You have 2 options: 1) indicate the value in the PXDefault() attribute, or 2) Set the property PXPersistingCheck.Nothing.
Note that your SOLocationAvail attribute has an error in the 4th parameter. You should use typeof(SOShipLine.tranType) instead of typeof(SOLine.tranType). This was generating an error when the shipment was created from the SO.
2 - My FieldUpdated event looks as follows:
public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
{
protected virtual void SOShipLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
if (e.Row == null) return;
SOShipLine line = (SOShipLine)e.Row;
SOShipLineExt lineExt = cache.GetExtension<SOShipLineExt>(line);
if (lineExt != null)
{
lineExt.UsrAllow = true;
lineExt.UsrPCSiteID=154;
lineExt.UsrPCLocationID=155;
}
}
}
Notes about the Graph extension:
I hard-coded the Warehouse and Location values. I recommend you do the same on your end while testing is being done, just make sure that the IDs exist in your DB, or that you query the CD value and then use its corresponding ID value.
Results:
When the Shipment is created from a SO, the values are being correctly assigned:

how to add a field on the Project Quotes screen PQ000025

Good morning, I want to add a new field on this screen Project Quotes but in doing so I get this message, that the table does not exist.
How should or what is the way to achieve it.
Thanks in advance
Imagen 01
The added field in the database
enter image description here
He added the field in the database and then I generated my extension.
namespace PX.Objects.CR
{
public class PMQuoteExt : PXCacheExtension<PX.Objects.CR.CRQuote>
{
#region UsrNota
[PXDBString(-1, InputMask = "", BqlField = typeof(PMQuoteStandaloneExt.usrNotaText))]
[PXUIField(DisplayName = "Nota ")]
public virtual string UsrNotaText { get; set; }
public abstract class usrNotaText : IBqlField { }
#endregion
}
public class PMQuoteStandaloneExt : PXCacheExtension<PX.Objects.CR.Standalone.CRQuote>
{
#region UsrNota
[PXDBString(-1, InputMask = "")]
[PXUIField(DisplayName = "Nota ")]
public virtual string UsrNotaText { get; set; }
public abstract class usrNotaText : IBqlField { }
#endregion
}
}
public class PMQuoteMaint_Extension : PXGraphExtension<PMQuoteMaint>
{
public PXSelect<PX.Objects.CR.Standalone.CRQuote> Test;
}
However, when I record, it does not fill the field.
that I am making a mistake or doing wrong.
Can you tell me please.
Thank you
PMQuote is not an actual DB table, but a BQL projection between tables:
CR.Standalone.CRQuote
CROpportunityRevision
CR.Standalone.CROpportunity
The way that I would tackle this is:
Add the field in table CRQuote
Extend the graph and override the Projection with the inclusion of the new CRQuote field.
UPDATE:
Based on #HB_Acumatica suggestion, step 2 would get simplified to a DAC extension (no need for the Graph extension). Much simpler to maintain in subsequent Acumatica versions!
UPDATE 2:
The extended DACs do not look correct in your question. Keep in mind that you should extend the original table (CRQuote), and the projection in order to have the value persisted.
The following definition worked correctly on my end:
//Projection extension
public class PMQuoteExt : PXCacheExtension<PMQuote>
{
#region UsrCustomField
[PXDBString(100, BqlField = typeof(CRQuoteExt.usrCustomField))]
[PXUIField(DisplayName="Custom Field")]
public virtual string UsrCustomField { get; set; }
public abstract class usrCustomField : IBqlField { }
#endregion
}
//Actual Table extension
public class CRQuoteExt : PXCacheExtension<PX.Objects.CR.Standalone.CRQuote>
{
#region UsrCustomField
[PXDBString(100)]
[PXUIField(DisplayName="Custom Field")]
public virtual string UsrCustomField { get; set; }
public abstract class usrCustomField : IBqlField { }
#endregion
}

How do you exclude a property from being persisted in Azure Table storage?

If I have a class like this:
public class Facet : TableServiceEntity
{
public Guid ParentId { get; set; }
public string Name { get; set; }
public string Uri{ get; set; }
public Facet Parent { get; set; }
}
Parent is derived from the ParentId Guid, and that relationship is intended to be filled in by my repository. So how do I tell Azure to leave that field alone? Is there an Ignore attribute of some type, or do I have to create an inherited class that provides those relationships instead?
Using latest Microsoft.WindowsAzure.Storage SDK (v6.2.0 and up), the attribute name has changed to IgnorePropertyAttribute :
public class MyEntity : TableEntity
{
public string MyProperty { get; set; }
[IgnoreProperty]
public string MyIgnoredProperty { get; set; }
}
There is an attribute called WindowsAzure.Table.Attributes.IgnoreAttribute can be set on the property you want to exclude. Just use:
[Ignore]
public string MyProperty { get; set; }
It is a part of Windows Azure Storage Extensions, which you may download from:
https://github.com/dtretyakov/WindowsAzure
or install as a package:
https://www.nuget.org/packages/WindowsAzure.StorageExtensions/
The library is MIT licensed.
This reply from Andy Cross at bwc --- Thank you again Andy.
This question an azure forums
Hi,
Use the WritingEntity and ReadingEntity events. http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.writingentity.aspx This gives you all the control you need.
For reference there's a blog post linked off here too: http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/d9144bb5-d8bb-4e42-a478-58addebfc3c8
Thanks
Andy
You may override the WriteEntity method in TableEntity and remove any properties that have your custom attribute.
public class CustomTableEntity : TableEntity
{
public override IDictionary<string, EntityProperty> WriteEntity(Microsoft.WindowsAzure.Storage.OperationContext operationContext)
{
var entityProperties = base.WriteEntity(operationContext);
var objectProperties = GetType().GetProperties();
foreach (var property in from property in objectProperties
let nonSerializedAttributes = property.GetCustomAttributes(typeof(NonSerializedOnAzureAttribute), false)
where nonSerializedAttributes.Length > 0
select property)
{
entityProperties.Remove(property.Name);
}
return entityProperties;
}
}
[AttributeUsage(AttributeTargets.Property)]
public class NonSerializedOnAzureAttribute : Attribute
{
}
usage
public class MyEntity : CustomTableEntity
{
public string MyProperty { get; set; }
[NonSerializedOnAzure]
public string MyIgnoredProperty { get; set; }
}
You could also make the getter and setter non-public in order to skip the property from being saved in the table storage database.
See: https://stackoverflow.com/a/21071796/5714633

Resources