Skip to main content
Solved

Show value of Service Order Custom Field on Appointment


Forum|alt.badge.img

I have a custom field (CustPORefNbr) on my Service Orders screen that I wish to display on any Appointments spawned from the parent Service Order. I have created a custom field (UsrCustPORefNbr) on the Appointments screen that I wish to fill with the value from the parent Service Orders CustPORefNbr.

It’s a read-only field on the Appointments screen; I don’t need it to update the database. It’s fine with me if it pulls the value from the Service Orders screen (DAC) every time the Appointment is displayed.

What’s the best code for doing this?

 

Thanks in advance for any consideration. 

 

Best answer by markusray17

It is “soRefNbr” not “sORefNbr”

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

6 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 680 replies
  • April 15, 2022

Hi @davidpoole21 
You can add the BQL on the  DAC field with PXdefault attribute. 

Example code:

[PXDefault(typeof(Search<InventoryItem.baseWeight, Where<InventoryItem.inventoryID, Equal<Current<inventoryID>>>>))]

something like this
[PXDefault(typeof(Search<ParentTable.custPORefNbr, Where<ParentTable.ServiceOrderNbr, Equal<Current<ServiceOrderNbr>>>>))]


Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • April 15, 2022

If you are using a virtual field(not persisted in the database) you may want to use PXUnboundDefault instead of PXDefault. The main difference is that UnboundDefault will assign the value when data is selected from the database vs when data is inserted into the cache. 

 

If you do use PXDefault you will want to make sure to set the PersistingCheck to PXPersistingCheck.Nothing.


Forum|alt.badge.img
  • Author
  • Freshman II
  • 14 replies
  • April 15, 2022

Thanks. I didn’t realize I could put a query in an Attribute tag like that.

But I still get an error. When I do my Ctrl-Alt-Click, it says the field is SORefNbr in the FSAppointment DAC. Any idea why it isn’t finding it?

Thanks.


Forum|alt.badge.img+5
  • Jr Varsity II
  • 237 replies
  • Answer
  • April 15, 2022

It is “soRefNbr” not “sORefNbr”


Forum|alt.badge.img
  • Author
  • Freshman II
  • 14 replies
  • April 15, 2022

Really? Is that all it was? Thanks so much!


Forum|alt.badge.img
  • Author
  • Freshman II
  • 14 replies
  • May 25, 2022

I tried using the suggested [PXDefault(typeof(Search<ParentTable.custPORefNbr, Where<ParentTable.ServiceOrderNbr, Equal<Current<ServiceOrderNbr>>>>))], but publishing the customization caused our server to reboot itself endlessly.

This is the actual code from the Data Access FS.FSAppointment UsrRempCustPORefNbr nonPersistedField:

[PXString(25)]
[PXUIField(DisplayName="Customer Order")]
[PXUnboundDefault(typeof(Search<FSServiceOrder.custPORefNbr, Where<FSServiceOrder.refNbr, Equal<Current<FSAppointment.soRefNbr>>>>))]

 

What am I doing wrong? Anybody got another suggestion?


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