Quantcast
Channel: Acumatica Singapore
Viewing all articles
Browse latest Browse all 110

Updating one field from another. Easy Customization.

$
0
0
Hi Guys,

What if we need not just add a field to a database schema, but also to update it from another field.
Based on certain event. Below is the example of customization that takes content of Description field and pushes it into newly added field.

1. Add new field to a screen. I had explained earlier how to do it. This time I add text edit field, 30 characters long.


2. Added Data Event: Field Updated to the Description field, so on the change of content it will get triggered.



3. Under description field I added a code, that takes content of the field and updates UsrDesc2 field:

protected void Batch_Description_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
   var row = (Batch)e.Row;
   var Description = row.Description;
      if (Description != null)
      {     
        row.UsrDesc2 = Description;
      }  
}
 
 
4. Last is to add property of the Description field to do commit, so every time we try to update it, it will push data to UsrDesc2 field as well.
 
 
Finally here is what we got:
 
 
I am sure, adding If's and Switches into the code is not a problem :)
 
All the best,
 
Sergey.

Viewing all articles
Browse latest Browse all 110

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>