Skip to main content

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 stringg] {"T4", "T2", "NA"}, new stringg] {"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 stringg] {"LHH", "RHH", "LHA", "RHA", "BHA"}, new stringg] {"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 stringg] {"S", "D", "LH", "RR", "R", "SL"}, new stringg] {"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

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.

 

 

 


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


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.


@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.

 

 

 


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


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