Skip to main content
Solved

linking data fields on different pages


Forum|alt.badge.img

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 customer class,see the vip box on the right? if i tick that, when i generate a customer record, its vip box should already be ticked

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

Best answer by darylbowman

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.

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

15 replies

darylbowman
Captain II
Forum|alt.badge.img+13

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 [PXFormula] will cause the default value to be recalculated when the CustomerClassID of the Customer is changed.


darylbowman
Captain II
Forum|alt.badge.img+13

I posted a reply, but it got stuck in moderation. It may be a bit until it shows up.


Forum|alt.badge.img

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)


darylbowman
Captain II
Forum|alt.badge.img+13

Is there a particular reason you want to use a graph event handler?


Forum|alt.badge.img

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?


Forum|alt.badge.img

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?

 


darylbowman
Captain II
Forum|alt.badge.img+13
  • 1596 replies
  • Answer
  • December 4, 2023

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.


Forum|alt.badge.img

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


darylbowman
Captain II
Forum|alt.badge.img+13

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.


Forum|alt.badge.img

and the where do i put the code? because prior to me generating those dacs, there was nothing under code.


Forum|alt.badge.img

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?


darylbowman
Captain II
Forum|alt.badge.img+13

Could you share your package?


Forum|alt.badge.img

here


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2624 replies
  • January 9, 2024

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


Forum|alt.badge.img

yes thank you


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