so, basically I have 2 different pages, both with a (vip checkbox) data field. one page is a customerClass and the second page is a customer page. the customer page is kind of an instance of the customerclass so when a record for customer is created, certain fields are already populated with information from the customer class. the vip checkbox is a custom field that i created and i want to know how i can link them so when the checkbox on customerclass is ticked, the customer records created take that value and tick its own vip checkbox. im new to acumatica so please explain in detail if you can
this is the customer page. when i create a new record, the vip box should already be ticked if the customerclass vip box is ticked
Page 1 / 1
What you want is to default the value of your custom field on Customers to the value of your custom field on CustomerClass. You could use a FieldDefaulting event to achieve this, but the easier option is to define a default value on the DAC field. This is similar to how your custom field definition should look on your DAC extension for Customer:
#region UsrCustomField2 [PXDBBool] [PXDefault(typeof(SearchFor<CustomerClassExt.usrCustomField2>. In<SelectFrom<CustomerClass>. Where<CustomerClass.customerClassID.IsEqual<Customer.customerClassID.FromCurrent>>>))] [PXFormula(typeof(Default<Customer.customerClassID>))] [PXUIField(DisplayName="Custom Field 2")] public virtual bool? UsrCustomField2 { get; set; } public abstract class usrCustomField2 : PX.Data.BQL.BqlBool.Field<usrCustomField2> { } #endregion
The [PXDefault] attribute will search the customer class value that matches the current record’s customer class.
The ePXFormula] will cause the default value to be recalculated when the CustomerClassID of the Customer is changed.
I posted a reply, but it got stuck in moderation. It may be a bit until it shows up.
thanks for responding. how would i go about doing it with an event handler? would i just paste that code into the customer dac? and replace the field name (usrcustomfield2 with Usrvip)
Is there a particular reason you want to use a graph event handler?
getting errors trying to put it in the dac. I have “customer” that has the region/field defenitions and then the Customermaint which would be the graph. how do i get to customer’s extension? I was trying some other things and i referred to customer as the dac extension but apperently thats the actual dac according to chatgpt..the code you provided im supposed to implement in ‘customer’ and im supposed to substitute Usrcustomfield with my custom field Usrvip right?
i generated another customer dac extension and it already had a usrcustomfield definition. is that where im supposed to implement the code? is it supposed to be Usrcustomfield2 or am i supposed to change it to vip?
You need to replace my code field name with your VIP field and the field name on CustomerClass.
You should already have a DAC extension where your custom field is defined, UNLESS you used the DAC field generator thingy. In that case, you'd have to define one like you did. It includes a sample field 'UsrCustomField' which you can remove and replace with your specs.
published successfully, tried opening the page and this pops up, i cannot edit the page(layout,add controls e.t.c)in the project customizer
So you had used the DAC field generator thingy. You need to go delete that first because now the field is being defined in two places.
and the where do i put the code? because prior to me generating those dacs, there was nothing under code.
i’ve created new dacs that generate the fields from the database. my customers dac doesnt have a vip field even tho i have it on the page, i implemented the code on customers and it went through, tested it and it isnt working. how can i get the dac extensions? the one that already exists and where the fields im trying to reference are?
Could you share your package?
here
Hi @philipkantewa56 were you able to find a solution? Thank you!