Skip to main content

I am working in the Customization Project Editor.  I went in and added on the Customer Screen a new custom field usrDate_Of_Loss.  I think its BAccountExt.usr_Date_Of_Loss.  I added it to the customer. 

I also added a usrDateOfLoss to the invoice 

ARRegisterExt.usrDateOfLoss I believe is what it is called. 

I also added the Default code and the Formula attributes where the custom field is declared in the Customization Project Editor.  I am  adding it to the Attributes section,  I put in bold below: 

 

pPXDBDate]
DPXUIField(DisplayName="Date Of Loss")]

            Where<Customer.CustomerID, Equal<Current<ARInvoice.CustomerID>>>>), 
            PersistingCheck = PXPersistingCheck.Nothing)]
tPXFormula(typeof(Default<ARInvoice.CustomerID>))]

 

It is looking up I hope that custom field from Customer to put in the Invoice DateofLoss Field. 

The error on validation is: 

\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(36): error CS0426: The type name 'CustomerID' does not exist in the type 'Customer'
\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(36): error CS0426: The type name 'CustomerID' does not exist in the type 'ARInvoice'
\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(38): error CS0426: The type name 'CustomerID' does not exist in the type 'ARInvoice'
\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(36): error CS0426: The type name 'CustomerID' does not exist in the type 'Customer'

 

Do I need to add declarations to the Attributes section in Customization Project Editor, that doesn’t seem to make sense. Any help would be appreciated.

Image below

 

your issue is Casing. Types in this area are camel case with the first letter being lower case.

So it should be ARInvoice.customerID

The field names after the dot should be lowercase.this would be everywhere in those attributes. Your custom field is good but the rest need adjusted.


Thats fantastically simple to fix. Thank you!


And to close the loop, Customer.CustomerID had to be Customer.acctCD.  So changing case and the wrong field made it work.  Thanks


But the default is not working of course...


Something else to watch for is that you should avoid using the underscore character in your DAC field names.


@ddunn thanks for pointing that out. I had meant to mention it. In Acumatica Business Logic the underscores drive some of the functionality and if you have underscores in your field names it can make other customization harder. I won’t necessarily break anything but will make it harder to customize business logic related to those fields later.


@edwardmcgovern97  Try this Default Attribute: 

"PXDefault(typeof(SearchFor<BAccountExt.usrDate_Of_Loss>.
In<SelectFrom<BAccount>.
Where<BAccount.bAccountID.IsEqual<ARInvoice.customerID>>>))]

You’ll need to have the using:

using PX.Data.BQL.Fluent;

 


Are we saying that the default is not happening because of the underscores? 

 


@edwardmcgovern97 - No, it’s just not a best practice.


If I’m right, the default is not happening because you’re searching for the value of a DAC extension of BAccount, but your Where is pulling from Customer (a completely different table). You could also change your statement to:

cPXDefault(typeof(Search<BAccountExt.usrDate_Of_Loss, 
Where<BAccount.baccountID, Equal<Current<ARInvoice.customerID>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]

I don’t like the old BQL so I used F-BQL


Ok I am trying the code you suggested and it does not seem to fire. I get no default

 


Apologies, I didn’t see you were using the visual editor. I don’t believe you can use ‘using’ there. F-BQL may work there without that, or if not, use my BQL version.


I get no prompt for anything missing when I compile without the using and deploy and still get no default using yours or my code


I may have been wrong about the tables. I actually think that since they restructured the BAccount and Customer relation, you may have been right. However, in your original attribute, you used Customer.customerID, which is not a valid field, as you saw, but Customer.acctCD is also not going to match.

Try this: 

>PXDefault(typeof(Search<BAccountExt.usrDate_Of_Loss , 
Where<Customer.baccountID, Equal<Current<ARInvoice.customerID>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]

 

I’m not sure if you need the Current<> or not. I’d try it both ways.

Don’t think I can help you more than that.


Got it.  Customerid is an integer.  Acctcd is the string holding the account 

But I tried yours and 

\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(36): error CS0426: The type name 'baccountID' does not exist in the type 'Customer'
\App_RuntimeCode\PX_Objects_AR_ARRegister_extensions.cs(36): error CS0426: The type name 'baccountID' does not exist in the type 'Customer'

Sorry, case again.

 

>PXDefault(typeof(Search<BAccountExt.usrDate_Of_Loss , 
Where<Customer.bAccountID, Equal<Current<ARInvoice.customerID>>>>),
PersistingCheck = PXPersistingCheck.Nothing)]

 


Its not defaulting.  I’m wondering if the problem is the 

>PXFormula(typeof(Default<ARInvoice.CustomerID>))]

which I thought was trying to trigger the default after customerID has changed


I tried to set it to a different field

[PXFormula(typeof(Default<ARInvoice.dueDate>))]

and it still doesn’t work. When I change DueDate the field doesn’t default

 

What I am trying to do is change the value of the user_Date_Of_Loss to the usrDateOfLoss from the Customer screen when the customer is selected.   Should I put this on the change event of the customer or somewhere else????


Hi @edwardmcgovern97 - were you able to find a solution? Thank you!


@darylbowman Thank you for the (patient) explanation about case sensitivity - it helped me finish up a customization today!


Reply