Skip to main content
Solved

Add Usr Field from License Types to Licenses Form


greglang
Varsity I
Forum|alt.badge.img+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

Best answer by Django

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.

 


 

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img+5
  • Captain II
  • June 2, 2022

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.

 


 


Leonardo Justiniano
Jr Varsity II
Forum|alt.badge.img+5

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

 

 


greglang
Varsity I
Forum|alt.badge.img+1
  • Varsity I
  • June 2, 2022

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?


Leonardo Justiniano
Jr Varsity II
Forum|alt.badge.img+5

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings