Solved

CROpportunityProducts: Custom field lengths changing between DAC & DAC Declaration

  • 15 April 2024
  • 6 replies
  • 44 views

Userlevel 3
Badge

Hi Guys,

I have encountered an issue where in the customisation project editor, I am writing an extension for CROpportunityProducts and below is the declaration: 

#region UsrCloser
[PXDBString(2)]
[PXStringList(new string[] {"T4", "T2", "NA"}, new string[] {"TS4000", "TS2000", "N/A"})]
[PXUIField(DisplayName="Closer")]
public virtual string UsrCloser { get; set; }
public abstract class usrCloser : PX.Data.BQL.BqlString.Field<usrCloser> { }
#endregion

#region UsrDoorHanding
[PXDBString(3)]
[PXStringList(new string[] {"LHH", "RHH", "LHA", "RHA", "BHA"}, new string[] {"Left Hand Hung", "Right Hand Hung", "Left Hand Active", " Right Hand Active", "Both Hands Active"})]
[PXUIField(DisplayName="Door Handing")]
public virtual string UsrDoorHanding { get; set; }
public abstract class usrDoorHanding : PX.Data.BQL.BqlString.Field<usrDoorHanding> { }
#endregion

#region UsrVPSpec
[PXDBString(512)]
[PXUIField(DisplayName="VP Specification (Door & VP)")]

public virtual string UsrVPSpec { get; set; }
public abstract class usrVPSpec : PX.Data.BQL.BqlString.Field<usrVPSpec> { }
#endregion

#region UsrFrameSpec
[PXDBString(512)]
[PXUIField(DisplayName="Frame Specifications (Door & VP)")]

public virtual string UsrFrameSpec { get; set; }
public abstract class usrFrameSpec : PX.Data.BQL.BqlString.Field<usrFrameSpec> { }
#endregion

#region UsrDoorFinish
[PXDBString(512)]
[PXUIField(DisplayName="Door Finish")]

public virtual string UsrDoorFinish { get; set; }
public abstract class usrDoorFinish : PX.Data.BQL.BqlString.Field<usrDoorFinish> { }
#endregion

#region UsrExtDoorParts
[PXDBString(512)]
[PXUIField(DisplayName="Additional Door Parts")]

public virtual string UsrExtDoorParts { get; set; }
public abstract class usrExtDoorParts : PX.Data.BQL.BqlString.Field<usrExtDoorParts> { }
#endregion

#region UsrHandles
[PXDBString(256)]
[PXUIField(DisplayName="Handles")]

public virtual string UsrHandles { get; set; }
public abstract class usrHandles : PX.Data.BQL.BqlString.Field<usrHandles> { }
#endregion

#region UsrIsDoor
[PXDBBool]
[PXUIField(DisplayName="Is Door?")]

public virtual bool? UsrIsDoor { get; set; }
public abstract class usrIsDoor : PX.Data.BQL.BqlBool.Field<usrIsDoor> { }
#endregion

#region UsrDoorType
[PXDBString(2)]
[PXStringList(new string[] {"S", "D", "LH", "RR", "R", "SL"}, new string[] {"Single", "Double", "Leaf and a Half", "Rapid Rise", "Roller", "Sliding"})]
[PXUIField(DisplayName="Door Type")]
public virtual string UsrDoorType { get; set; }
public abstract class usrDoorType : PX.Data.BQL.BqlString.Field<usrDoorType> { }
#endregion

However, when i publish the customisation project, the lengths change for SOME fields to the below:

Does anyone know why/how this is happening?

I have also tried just adding them via the screen editor and data access but it still happens.

 

Thanks,

Aleks

icon

Best answer by Leonardo Justiniano 15 April 2024, 20:17

View original

6 replies

Userlevel 6
Badge +4

Hi @aiwan 

If you follow step by step adding fields to the CROpportunity screen you will see field types and sizes exactly as your original definition. 

  1. Add new fields to a table

 

I added all your fields based on your DAC specification. Please note that there are 2 classes that will be affected:

 

  1. Add all additional attributes to fields (Dropdown list options)

 

You have to do it in both classes.

  1. Publish. When published, database fields are added to the database.

You can see same description in the DAC navigator.

 

What happen if you need to adjust the size of a column? You have 2 options

  1. Extend an existing column

 

Then

 

  1. If you have a local instance you can alter the table (SQL ALTER script) and then reload database definition

 

Modifying the DAC code is not enough to affect the underlaying definition of the field. DAC code will affect how that table definition will behave when interacts with the Framework. However It is important to keep those definitions in sync with any change you make in the table, whether it is on a DAC code or through Data Access field options.

 

You can find attached the package I tested.

 

Hope this helps.

 

 

 

Userlevel 3
Badge

Hi @Leonardo Justiniano,

Thank you for the advice!!!

Sorry if I wasn’t clear enough but the DAC code wasn’t modified.

I added the fields through the screen editor first, then published but didn’t check the schema to see how they added, only after i had amended the DAC attributes.

However, our VAR’s have another customisation which uses the CROpportunityProductsExt name so I had to extend it modify the class name to CROpportunityProductsDoorsExt as I have a customisation which relies on them being called different things.

I had also tried to extend the field lengths through DB scripts node but to no avail.

I think I will try to add the fields through the DB scripts node and see if that works, if not I will carry it all out in a local instance, reload the DB and then import the package into the sandbox instance.

Thanks,

Aleks

Userlevel 3
Badge

I have removed and re-added the fields through the DB scripts node:

But I still have the same issue:

When i attempt to increase the length the length stays the same.

I will test this in a local instance now.

Userlevel 6
Badge +4

@aiwan 

I don’t know if you notice that CROpportunity class has 2 versions

  • CROpportunity
  • Standalone.CROpportunity

Make sure your extensions cover both DACs.

Also you can consider assigning to your customization package a higher level to force publishing after the dependent package. Also make sure you set the option “Execute All Database Scripts ...”. At least the first time you will publish your changes.

 

 

 

Userlevel 3
Badge

Hi @Leonardo Justiniano,

 

Yes I am aware that for CROpportunity there are two DACs however, I am adding the field to CROpportunityProducts.

I will try to publish through the way that you suggested.

Thanks,

Aleks

Userlevel 3
Badge

I managed to overcome it with the SQL Alter script, I ran it in a local instance on SMS first and it worked so I added the script to the customisation project.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved