Solved

Add Usr Field from License Types to Licenses Form


Userlevel 3
Badge +1

Hoping someone can see what I’m doing wrong here.  I have added a Category field to the License Types Screen (FS200900) and am trying to get it to populate Read-only to the License Screen (FS201000).

 

I have tried this a number of ways but can’t get it to work.  Here is my latest attempt which gives me an error 

 

“Error: Cannot create the ctl00_phF_form_CstPXSelector1 control.
The PXSelector attribute is missing for the UsrLicenseCategory field.”


namespace PX.Objects.FS
{
public class FSLicenseTypeExt : PXCacheExtension<PX.Objects.FS.FSLicenseType>
{
#region UsrLicenseCategory
[PXDBString(10)]
[PXUIField(DisplayName="Category")]
[PXStringList(new string[] {"C", "V", "O"}, new string[] { "Credential Service","Vaccine", "Other"})]
public virtual string UsrLicenseCategory { get; set; }
public abstract class usrLicenseCategory : PX.Data.BQL.BqlString.Field<usrLicenseCategory> { }
#endregion
}
}


namespace PX.Objects.FS
{

public class FSLicenseExt : PXCacheExtension<PX.Objects.FS.FSLicense>
{
#region UsrLicenseCategory
[PXString]
[PXUIField(DisplayName = "Category")]
[PXDBScalar(typeof(
Search<FSLicenseTypeExt.usrLicenseCategory,
Where<FSLicenseType.licenseTypeID, Equal<FSLicense.licenseTypeID>>>))]
public string UsrLicenseCategory { get; set; }
public abstract class usrLicenseCategory : PX.Data.BQL.BqlString.Field<usrLicenseCategory> { }
#endregion
}
}

 

Thanks in advance!

 

Greg

icon

Best answer by Django 2 June 2022, 19:18

View original

4 replies

Userlevel 7
Badge +5

I think you just need to go into the Project XML, search for CstPXSelector1, make sure it is related to your custom field, and then change the PXSelector to PXTextEdit.  Save that and publish and you should be able edit the form after that.

 


 

Userlevel 6
Badge +4

Your code worked for me. Also add the dropdown definition on the read only field to display the description value and not the code:

 

 

Userlevel 3
Badge +1

Thank you both for the help I have it working now but it only seems to update when I save and then reopen the record.  Do you know what changes I would need to make to get it to auto update when the License Type is selected?

Userlevel 6
Badge +4

Please add an FieldUpdated event on License Type and then update the read only field (Similar BQL than PBDBScalar)

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