# Assigning a value from one data field to a custom data field on the same "PORel" form **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2017-01-11 20:45 UTC **Views:** 4292 **Replies:** 5 **URL:** https://www.epiusers.help/t/assigning-a-value-from-one-data-field-to-a-custom-data-field-on-the-same-porel-form/36874 --- ## Post #1 by @BA-Quest (I've already performed several searches in the Epicor ICE/Tech Guide for this and, even though the information returned essentially states that, _"yep - you can perform BPM logic by using our nifty BPM Workflow Designer, or by inserting custom C# code into the BPM"_, the reassurance that it can be done and the rudimentary examples of where to find the tools does little to actually show me **how** to solve my specific issue with a solid, fully understandable example. So, I truly appreciate the RTFM suggestions ahead of time, but they do absolutely nothing to help me.) That said... My company is using Epicor 10. One of our departments is interested in adding a custom text field to the "Purchase Order Entry" form that is intended to capture the "originally promised date" for vendor shipping on ordered parts. The reason this is a requirement, is because, if the vendor needs to call us back to redefine the shipping time frame, we would need to adjust the available "Promised Date" field to reflect that, but we'd lose the metrics concerning when the vendor told us they'd ship the parts originally. This helps our Supply Chain team "grade" vendors on when and how often they change shipping windows with our company. I've adjusted some default form elements within "Date/Quantity" group (aka - "grpDateQuantity") of the "Release Dock Panel" (aka - "Erp.UI.App.POEntry.Panels.ReleaseDockPanel") by moving them to the top right of the group. This way, I could successfully pull down the "Our Qty" and "Supplier Qty" fields to make room for the new custom "Original Promise Date" field (aka - "[C]dteOrigPromiseDate"). So - the physical arrangement on the Purchase Order Entry form is acceptable. I've also added a custom Originally Promised Date field to the POEntry table as a "user defined" table via Epicor's GUI (which is actually a "table view" in SQL). Now it's time to deal with the logic to populate the new "Original Promise Date" (OPD) field. The requirement is... upon an insert or update of an existing PO Entry record, if there is no value in the OPD field when the PO Entry data is updated into the SQL record, then take the value from the "Promised Date" field and populate it to the OPD field _(this assumes that the PO has been recorded for the first time and hence, a promised shipping date has been negotiated with the supplier on that PO)_. I'm a little wordy there, but it's pretty basic. If no data exists in field "AA" on the PO Entry form during a SQL transaction to the Epicor DB; do nothing. If data exists in the "AA" field; then write the exact same value to field "BB". What assistance might the community have for me in either using the BPM Workflow Designer, or writing custom C# to perform this task? I must say... using the "Specify C# expression" window to set a field value using a BPM workflow element has been rather interesting - as any expression I've ever tried in that module returns a "BPM00 : Expression should contain only one statement" error... even if I try to play it's game and enter nothing but "x == y;" into the module. Thanks in advance for any advice you might wish to offer. --- ## Post #2 by @josecgomez You want to use the Specify C# expression as you mentioned, however do not use the semi colon epicor will add that in the back end. Just set ttPOheader.MyField_C= ttPOHeader.PromisedDate That should do it, the condition you should be able to set using a conditional block before the assign. --- ## Post #3 by @BA-Quest Thanks for the quick response Jose. Interestingly, I actually stumbled across some of your helpful training videos on YouTube. So - thank you for spending your time to publish that content for the development community. The information you provide on your channel is more development-minded, which I can appreciate. I'll give the C# expression route a shot with the logic you have provided. Thanks again -- I'll respond here to let you know how things turn out. --- ## Post #4 by @BA-Quest Still having a bit of an issue. I think I might be confusing my approach by trying to add C# code expressions into BPM visual workflow containers. I'm stuck even before getting out of the gate by, first, trying to evaluate the custom "Original Promised Date" field for an "IsEmpty" condition. If the field has no value, then I need to move on to the next evaluation, which would be to determine whether or not the default "Promised Date" field has a value. If so, then I need to assign the OPD value with the same value found in the PD field. There does not seem to be a way to evaluate: The **ttPORel.PromiseDt** field of **the changed row** **is not equal to** **""**. There appears to be no choice for an empty string. If I try to simply put (2) double quotes into the "Specify C# expression" module, I receive the following error: BPM00 : Result of expression cannot be compared with variable of "System.DateTime?" type. Since it is structured as a date field on the Purchase Order Entry form, I'm guessing the evaluation should be against a NULL value and not "" (empty string) -- perhaps? --- ## Post #5 by @josecgomez Yeah if you look at the error it tells you is a DateTime? Type that is a nullable datetime just check the .HasValue property on it --- ## Post #6 by @BA-Quest Thanks, Jose - looks like that solved it for me. Much appreciated. The logic tests out pretty well. --- **Canonical:** https://www.epiusers.help/t/assigning-a-value-from-one-data-field-to-a-custom-data-field-on-the-same-porel-form/36874 **Original content:** https://www.epiusers.help/t/assigning-a-value-from-one-data-field-to-a-custom-data-field-on-the-same-porel-form/36874