Epicor10 C



Comments



Description

Converted Code Programming GuideEpicor ERP 10.0.700 Disclaimer This document is for informational purposes only and is subject to change without notice. This document and its contents, including the viewpoints, dates and functional content expressed herein are believed to be accurate as of its date of publication. However, Epicor Software Corporation makes no guarantee, representations or warranties with regard to the enclosed information and specifically disclaims any applicable implied warranties, such as fitness for a particular purpose, merchantability, satisfactory quality or reasonable skill and care. As each user of Epicor software is likely to be unique in their requirements in the use of such software and their business processes, users of this document are always advised to discuss the content of this document with their Epicor account manager. All information contained herein is subject to change without notice and changes to this document since printing and other important information about the software product are made or published in release notes, and you are urged to obtain the current release notes for the software product. We welcome user comments and reserve the right to revise this publication and/or make improvements or changes to the products or programs described in this publication at any time, without notice. The usage of any Epicor software shall be pursuant to an Epicor end user license agreement and the performance of any consulting services by Epicor personnel shall be pursuant to Epicor's standard services terms and conditions. Usage of the solution(s) described in this document with other Epicor software or third party products may require the purchase of licenses for such other products. Where any software is expressed to be compliant with local laws or requirements in this document, such compliance is not a warranty and is based solely on Epicor's current understanding of such laws and requirements. All laws and requirements are subject to varying interpretations as well as to change and accordingly Epicor cannot guarantee that the software will be compliant and up to date with such changes. All statements of platform and product compatibility in this document shall be considered individually in relation to the products referred to in the relevant statement, i.e., where any Epicor software is stated to be compatible with one product and also stated to be compatible with another product, it should not be interpreted that such Epicor software is compatible with both of the products running at the same time on the same platform or environment. Additionally platform or product compatibility may require the application of Epicor or third-party updates, patches and/or service packs and Epicor has no responsibility for compatibility issues which may be caused by updates, patches and/or service packs released by third parties after the date of publication of this document. Epicor® is a registered trademark and/or trademark of Epicor Software Corporation in the United States, certain other countries and/or the EU. All other trademarks mentioned are the property of their respective owners. Copyright © Epicor Software Corporation 2014. All rights reserved. No part of this publication may be reproduced in any form without the prior written consent of Epicor Software Corporation. Revision: September 05, 2014 7:43 a.m. Total pages: 38 install_E10.ditaval Converted Code Programming Guide Contents Contents 1 Introduction.........................................................................................................................5 2 Custom Code Conversion Guidelines.................................................................................5 2.1 ERP and ICE Tables.....................................................................................................................................5 2.2 Case Sensitivity..........................................................................................................................................6 2.2.1 Case Sensitivity in String Comparisons.............................................................................................6 2.2.2 Compilation Errors...........................................................................................................................6 2.3 Calling Method From Business Object........................................................................................................7 2.4 Accessing ERP Context From Within System Directive.................................................................................8 2.5 Throwing Exceptions..................................................................................................................................9 2.6 Calling Method From Standard Assembly...................................................................................................9 2.7 Compatibility Class..................................................................................................................................10 2.8 Replacing Resulting Dataset.....................................................................................................................11 2.9 Redundant Transaction Scope..................................................................................................................11 2.10 BufferCopy Considerations....................................................................................................................12 2.11 Working With Extended Data.................................................................................................................12 2.11.1 Create User-Defined Fields...........................................................................................................12 2.11.2 Access User-Defined Fields...........................................................................................................14 2.11.3 Loading Extended Data Into Various Objects................................................................................15 2.11.4 Transition Path.............................................................................................................................15 2.12 Obsolete ABL Code................................................................................................................................16 2.13 Migrating ABL Expressions.....................................................................................................................16 2.14 Using External Libraries..........................................................................................................................17 2.14.1 Create Project in Visual Studio.....................................................................................................17 2.14.2 Call External Assembly Using BPM...............................................................................................18 2.15 Debugging Using Visual Studio..............................................................................................................20 2.15.1 Locate BPM Sources.....................................................................................................................20 2.15.2 Download Debugging Project......................................................................................................20 2.15.3 Open Project in Visual Studio.......................................................................................................21 2.15.4 Create Custom Code Directive.....................................................................................................22 2.15.5 Compile the Project.....................................................................................................................24 2.15.6 Debug the BPM...........................................................................................................................25 2.15.7 How to Modify Sample Project.....................................................................................................27 2.16 Adding and Subtracting Date.................................................................................................................28 2.17 Subtracting Two Dates and Comparing to an Integer Value....................................................................28 2.18 ABL Find Last Conversion.......................................................................................................................28 2.19 Using Unassigned Local Variable Message..............................................................................................30 2.20 Epicor 10 Equivalent to Row Mod = A or U............................................................................................31 2.21 Displaying an Informational Message.....................................................................................................31 2.22 Converting a Number to a String in LINQ Expression..............................................................................31 2.23 Outputting Data to a File.......................................................................................................................32 2.24 Updating Database Tables......................................................................................................................33 Epicor ERP 10.0.700 3 ...........34 2......p file and the final Epicor 10 version.......700 ..................................25 Sample of BPM calling a .................................0.................26 Sample of a BPM That Sends an Email...............................................36 4 Epicor ERP 10..............Contents Converted Code Programming Guide 2. Converted Code Programming Guide Introduction 1 Introduction The Custom Code Conversion Utility converts snippets of Progress ABL code used in previous Epicor ERP releases to . In Epicor ERP 10.UD01 UD01. In the following example. • EPICweb Products > Epicor ERP version 10 > Documentation Important This guide is not intended to be a C# tutorial. It also provides recommendations on how to write code in BPM custom actions. Epicor ERP 10.NET C# language used by the Epicor ERP 10 framework.1 ERP and ICE Tables Epicor programs belong to either the application system (ERP) or the tools system (ICE). The primary goal of this utility is to support migration of customizations and BPM custom code conversions. The purpose of this guide is to provide guidelines on what corrections and modifications users may need to perform after the code is converted from ABL language to C#. certain schema changes were made.Tables. Sometimes conversion results may need to be adjusted to reference the correct part of the Epicor application. The updated code should look like the following: Ice.700 5 . enter your EPICweb or other assigned User Name and Password. where it now belongs.com/ABLConversionweb/.epicor. Erp. it only provides tips on how to make your custom code work in the Epicor ERP 10 framework. This guide is available for download from the following locations: • Custom Code Conversion Utility > About section • ERP 10 Application Help under System Management > Business Process Management > Working With Business Process Management section.UD01 UD01. a user-defined table reference needs to be changed from "ERP" to "ICE". On the Log in dialog.Tables. 2 Custom Code Conversion Guidelines 2. Click Login.0. Note You can access the conversion tool by clicking this link: https://scrs. Compare(string A.700 . look at the simple below: Notice that the error message has "customer" starting with a lower-case letter c. true)!=0 2.Custom Code Conversion Guidelines Converted Code Programming Guide 2.2.2 Case Sensitivity 2. and it may result in compilation errors. For example. string B.2. when new custom code is created. because the SQL server database is always set up as case insensitive.string A and string B .0. appropriate case must be taken into account.using the following code: string.Compare((string)ttJobHead_xRow["ShortChar02"].2 Compilation Errors Remember that C# is a case-sensitive language. String comparisons at the SQL server disregard the case. string. This query will cause the following error message when you try to compile the BPM: 6 Epicor ERP 10. true)==0 Sometimes converted code's case is not accurate and must be adjusted manually. “Education”. The code converter attempts to compare two strings . Also. which was not the case in ABL code.1 Case Sensitivity in String Comparisons By default. code written in C# treats string comparisons as case sensitive. you first add TipService contract assembly to the reference.0. This class returns an instance of the contract. which you can use to invoke any method available on the contract. one action) several calls are made to the same contract.dll. use the ServerRenderer and add a reference to the contract containing the particular business object. The svc variable holds the Tip contract instance. The signature of the method is displayed below: In the following example. You can use this class to make calls to any application service with the defined contract.700 7 . the GetByID() method is called from the Tip Service.System. For this purpose.Converted Code Programming Guide Custom Code Conversion Guidelines In order for the BPM to compile without errors. If within one code scope (for example. For example: Epicor ERP 10.3 Calling Method From Business Object In some cases. it is recommended to call ServiceRenderer just once. you need to call a method from a business object (BO). and then make the call. ServerRenderer is a helper class residing in Epicor. In order to make a call to the TipService method from another directive. change the first line of the query to use an upper-case letter C as shown below: 2. the BPM context is either ErpContext (for application directives) or IceContext (for system directives).700 . review the following code: In a BPM directive created for system BO "UD10". you need to access Part table which belongs to Erp context. For example.0. Therefore. Once this is implemented. • ABL Code: • C# Code: 2. the need of accessing another context within the BPM code will be eliminated. Epicor is working towards enhancing the BPM and making the default context unified. The code should look like the following: Note At the moment. within the IceContext.Custom Code Conversion Guidelines Converted Code Programming Guide The following example displays a correct conversion of ABL code to C#. Part). you will not find certain ERP tables (for example. 8 Epicor ERP 10. and you will need to use the process described above.4 Accessing ERP Context From Within System Directive You can access Erp Context from within a system directive. 0.700 9 . Add a Reference to required assemblies: 2. 1. Note Within the BPM Workflow Designer. Add the necessary Using clauses: Epicor ERP 10.BLException("My exception"). the Raise Exception workflow element is the preferred way of throwing exceptions. 2.5 Throwing Exceptions Exceptions are used to indicate that an error has occurred while the program is running. The following example displays how you can throw a business exception from within the code: throw new Ice.6 Calling Method From Standard Assembly Use the following steps when calling a method from another assembly (non-external assembly).Converted Code Programming Guide Custom Code Conversion Guidelines 2. Custom Code Conversion Guidelines Converted Code Programming Guide 3.dll. you need to add a reference to Compatibility. which can be found in the Assemblies folder.0. This class contains conversion routines and helper methods to comply with Progress ABL code functionality. • ABL Code: • C# Code: 10 Epicor ERP 10. For example: 2. You can now construct the code that calls a method from another assembly.700 .7 Compatibility Class If the Compatibility class is present in the converted code. this behaviour may occur when you have a join between a temp table and a database table: • ABL Code: • Converted C# Code: In this example.700 11 . which is held in the ttPart table. then you have the following options: • Set the values on ttPart • Replace the whole dataset Note Fetching the dataset and replacing the whole dataset using the Attach method eliminates the need of writing a lot of code. you may have a method directive action on the GetByID() method which returns a Part ID.9 Redundant Transaction Scope Usually using the Transaction Scope is not required as it is handled by the base method such as Update().Converted Code Programming Guide Custom Code Conversion Guidelines 2. remove the highlighted lines.8 Replacing Resulting Dataset The following topic describes how to replace your directive's resulting record with another record. for some reason. the code converter adds an unnecessary Transaction Scope reference. This is especially useful when the resulting dataset contains several tables. the record is retrieved using a sample method FetchRecord() and the result is replaced with myRec.FetchRecord(id). For example. var myRec = myService. Epicor ERP 10. this. For example.Attach(myRec). The usual BPM procedure provides the directive code with retrieved Part record. 2. you want to replace the whole resulting record with another record that you may have retrieved yourself using another method.dsHolder. In some cases. which needs to be manually removed.0. If. In the following example. to fix the code above. To do this. Number02. In the previous versions of the Epicor application. they are not overwritten during an upgrade. Add the needed custom columns to the extended user-defined table that you have created. after the upgrade was complete. and were causing unnecessary system load. While these additional columns were mostly sufficient for customizations. 2. navigate to System Setup > System Maintenance and open Extended User Defined Table Maintenance. This process sometimes required users to additionally update the tables/columns to make the customization compatible with the new application version. the predefined user-defined columns might not have been used at all. so users needed to export customizations and.Tables.Tables. 2.Tables. b2) The declaration of b2 then looks like the following: Erp. If you are building a BPM directive that needs unique fields. In other Epicor installations. during an upgrade. then b2 needs to be assigned a new instance on each iteration. 2.11 Working With Extended Data The following section describes what you should consider when working with Extended Data and the process of creating custom columns and their usage within the BPM functionality. 3.Part b2 = new Erp.CopyExceptFor(b1. Date03. otherwise it will lose the values from the previous iteration. the Epicor application now incorporates this functionality as a database extension.Part().Part b2. some users ran out of available columns. 12 Epicor ERP 10. use the following process to create extended user-defined fields. Find and select the table you need to extend. each table included a series of user-defined fields. import them back into the application. such as Character01. Since these tables are extensions from parent tables. Note The existing Epicor 9.0. To address these issues. the b2 reference is not initialized: BufferCopy . As a resolution. Then. you create extended user-defined tables and add columns to these tables.Custom Code Conversion Guidelines Converted Code Programming Guide 2.1 Create User-Defined Fields In Epicor ERP 10. For example.10 BufferCopy Considerations BufferCopy is used to copy from source buffer to target buffer.11.05 user-defined columns that were utilized (contained data) are automatically migrated to Epicor ERP 10 as extended data columns. The application adds a "_UD" suffix to the end of the table identifier. correct the declaration as following: Erp. Click Save. Create the extended user-defined tables and columns (fields) within the Epicor application. these user-defined fields were overwritten.700 . If BufferCopy is used in a loop. 1. in the below declaration. link it to the database by clicking the Actions menu and selecting either the Sync Current Table to the DB or Sync All Tables to DB option. the base and the user-defined tables are joined in the data model. As a result. the application adds a "_c" suffix to the end of this table column. restart the IIS. The data model is regenerated using the Epicor Administration Console. as it is performed automatically. Important Do not skip this step! Note Unlike previous versions of the Epicor application.700 13 . Regenerate the data model for the Epicor database. Pull the latest data model from the database and copy it to the local application server by restarting IIS. 6.0. The extended user defined table and columns are now fully integrated with the database. You can now monitor and update these custom columns through BPM directives. running the Directive Update program and Refreshing Signatures of directives referencing affected table(s) with UD columns is no longer needed. Epicor ERP 10. This suffix will help you identify this custom column when you create BPM directives that reference this column. 5. To do this. After the data model is successfully regenerated. 4. Add the extended user-defined table to the database.Converted Code Programming Guide Custom Code Conversion Guidelines When you save each column. You or your system administrator runs this task on the server that hosts your database. Custom Code Conversion Guidelines Converted Code Programming Guide 2. reference them using the <tablename>["UDField<>()"] syntax. user-defined fields appear as part of the primary table. so their format is fixed and they are not regenerated with the data model. Method directives work with temporary (tt) tables using tablesets. When you design a business activity query (BAQ) in BPM from within Data and Method Directives. For example: ttABCCode. When working with ttTables for Data Directives. 3.UDField<System. 2. When you construct a Data or Method Directive workflow. These tablesets are defined in the business object's (BO) contract .String>(" MyNewColumn _c") 14 Epicor ERP 10. When building a method directive that refers to user-defined fields in temporary tables.11. For example: ttABCCode. User defined tables and primary tables merge into one for the database context.MyNewColumn_c 4.dll file. 1. user-defined columns display as part of the base table. user-defined columns also appear as part of the base table.0.2 Access User-Defined Fields This topic describes how you can reference user-defined columns within BPM in Epicor ERP 10.700 . and can be directly accessed. and so you access them through different syntax. LoadExtendedData(Db). … list.3 Loading Extended Data Into Various Objects This topic discusses available extensions you can use to load ExtendedData into various objects.LoadExtendedData(Db). You may only need to manually load extended data into IceTablesets. Regeneration of the Data Model is performed. This ensures the UD fields are included in the data model.11. As part of the installation process.0. After you log into the application.700 15 . Epicor ERP 10.TipTable iceTable = new TipTable().TipTableset ts = new TipTableset(). … ts. 1.LoadExtendedData(Db). • List<IceRow>: List<IceRow> list = new List<IceRow>().11. • IceTableset: Ice. The conversion process upgrades BPM directives to follow the new extended data approach. 2.LoadExtendedData(Db).Tablesets. • IceTable: Ice.4 Transition Path This topic explains actions you need to take when you migrate UD Fields from Epicor ERP 10 Beta code prior to 10. IceTables or IceRow.Tablesets. Note Extended data is loaded automatically into table entities when data is retrieved from the database. … iceRow.Tablesets.0. It is highly recommended to review these directive to ensure their performance is optimized in the new environment.0. 2. Epicor recommends to review the following: • BPM directives that have become Outdated (as it is usual when upgrading from older builds) • BPM directives that are known to contain UD Field references in queries or custom codes. Note You only need to perform the following steps if you are migrating from Epicor ERP 10 Beta prior to version 10.600 or later. 3.600 into Epicor ERP version 10. Examples are below: • IceRow: Ice. … iceTable.Converted Code Programming Guide Custom Code Conversion Guidelines 2. The next step involves running mandatory BPM conversion.0.600.TipRow iceRow = new TipRow(). or from the converted code: lib\UpdateTableBuffer.Tip join Ice. 4. for example: Ice.0.05 application.0.600. • All tables.700 .SysRowID If the above code compiles.05 ABL expressions.Tip_UD on t. For example.Tip_UD on t. Because the data model now merges Extended Table columns with the respective base table automatically.Tip join Ice. however the body of the loop will need to be adjusted. • Custom code performing [loop on Tip from the DB] with inner [loop on Tip_UD from the DB] This code will be converted to [loop on Tip from the DB] with inner [loop on Tip from the DB]. 2. you may have an Epicor 9. When importing BPM directives referencing UD fields created in the code prior to 10. To avoid compilation errors when converting such directive.05 became obsolete in Epicor ERP 10. these directives are also automatically converted and should be reviewed for optimal performance.SysRowID = tu. To ensure a successful migration of expressions. it is sub-optimal. They need to be removed from the source code or the converted code.12 Obsolete ABL Code Certain calls that existed in Epicor 9. verify the following: • ABL expressions are functional in your Epicor 9.05 BPM directive that uses an ABL action with code that calls lib\UpdateTableBuffer.13 Migrating ABL Expressions The BPM Migration Tool is capable of migrating most of the valid Epicor 9.p 2. The most optimal way is [loop on Tip from the DB]. you should refer to the Tip entity object only to eliminate references or joins to Tip_UD altogether. remove the below call from either the original source code snippet.p.SysRowID = tu.ForeignSysRowID The migration process is likely to convert such code as follows: Ice.Custom Code Conversion Guidelines Converted Code Programming Guide Example • Previously for database queries a join between the extended table and base table was used. 16 Epicor ERP 10. arguments and functions used in expressions are known. it is recommended to convert such code into a snippet and incorporate it into the BPM Execute Custom Code element. In this example.BO. it may be reasonable to combine these .Tip is added.1 Create Project in Visual Studio The following section describes how to create a new project using the Visual Studio.p progress code files. In certain cases when Epicor 9. as we are going to make a call from Tip Update BPM Method Directive.Converted Code Programming Guide Custom Code Conversion Guidelines 2. if the external . we create the project called "ExternalBpm". Add the following references from the Server Assemblies Folder: Note that the Ice. Epicor ERP 10.Contracts.p routines into a single .05 to Epicor ERP 10. Please note that this approach may be preferred as: • It does not require .14. 1.0.05 external .p routines from Epicor 9.05 customizations contained many calls to external .p code files.NET assembly (library) of external methods.NET Visual Studio • It does not require maintaining and updating external assemblies 2. You can also consider creating an external library. 2. the project utilizes the Update Method Directive for Tip Service.14 Using External Libraries Please consider the following information when selecting the approach for migrating external . These methods can then be called from within a BPM flowchart using the Invoke External Method BPM element.p contained simple code in one or few methods. However. rather than creating an external library assembly. when you called a method in the Epicor 9.p file. Create an empty C# Class Library Type Project. which subsequently invoked other methods within the same or different . In the example below.700 17 . Custom Code Conversion Guidelines Converted Code Programming Guide Important Make sure to set "Copy Local=False" for all added references. 5.Tip. In this example. 6. Copy the whole code (or method. 2. if you already have other methods there).0. 3. navigate to System Management > Business Process management > Method Directives Maintenance.cs is used. open Method Directives. select Create Programming Interface. MyTip. Place the library assembly file to the folder for external assemblies. 3. The Programming Interface Generator Form window displays the method signature. within the CustomizationSettings property.Update method.700 . 18 Epicor ERP 10. Locate the Ice. To do this. You can rename it. 2. Add your logic into the method and compile the project. 7. The project adds the Class by default.14.2 Call External Assembly Using BPM 1. From the Actions menu.config. Usually. 4. it is the folder located within the Server\Customization\Externals folder. but this setting can be changed in the application's web. if you want. In your Epicor EPM 10 application. 700 19 .Converted Code Programming Guide Custom Code Conversion Guidelines 8. Select the method using the specified method link. 9. 10. You can now use this library and call it using the Invoke External Method workflow element. Select the external assembly by clicking the external link.0. Epicor ERP 10. you can debug execution of custom code directives.0. locate the BPM Sources folder.15.15 Debugging Using Visual Studio If you have Microsoft® Visual Studio™ 2010 or higher.2 Download Debugging Project Download the project used for debugging.0 Tools User Guide. The example that follows demonstrates how to debug the Tip. 2.700 . Debugging can be particularly useful when you need to review execution of a complex custom code. 20 Epicor ERP 10. In your environment. select the About web page.1 Locate BPM Sources In your Epicor ERP installation. review the Custom Business Process Management chapter found within the Epicor ICE 3.15.Custom Code Conversion Guidelines Converted Code Programming Guide The external Update method from ExternalBpm assembly will now be called by the BPM. For more info on custom project debugging. By default. 2. you can apply the following steps on another directive. 1.Update directive sample delivered by Epicor. see the How to Modify Sample Project topic at the end of this section. In the Conversion Utility. Tip For more detailed example. Sources are found in the BPM folder of the Server directory. 2. Important This section provides details on how you can set up a debugging project. Download the zipped file. change the relative paths manually from the Visual Studio to point to the location of Server\Bin or server\Assemblies folders. open the downloaded project in Visual Studio. Epicor ERP 10. Important Relative paths in the project file assume that the BPM subfolder is located directly under the Server deployment folder. Click the Wrapper Project for debugging link. Notice the following settings specific to the Tip.0. 3.700 21 . The below sample project is configured for Tip. If this is not the case.Converted Code Programming Guide Custom Code Conversion Guidelines 2.Update directive.15.Update sample: • The contract for Tip service displays within references. 4. Extract the project folder from zip archive into the BPM > Sources directory. 2.3 Open Project in Visual Studio For the next step. Update Pre-Processing method. 2.Bpm.Custom Code Conversion Guidelines Converted Code Programming Guide • The TipUpdate folder contains 3 files generated by BPM. 1.4 Create Custom Code Directive Use Method Directives to create a custom code directive for the Tip.0. In this sample a simple code checks if Tip Title is "A" and then updates the TipText with a string "Tip Text from BPM". Navigate to Method Directives. • The namespace and assembly name is set to Ice.700 .15. System Management > Business Process Management > Method Directives Maintenance 22 Epicor ERP 10.Update.Tip. 8.Update method. Drag and drop the Execute Custom Code workflow item in the design area. The following code is used in the Execute Custom Code item: 6. Connect Start to Execute Custom Code.0. Use the BPM Workflow Designer to construct a simple BPM workflow. 7. The BPM generates source files in Server\BPM\Sources\BO\Tip.700 23 . 4. 3.Update folder.Tip. Locate the Ice. Click Save and Enable the directive.Converted Code Programming Guide Custom Code Conversion Guidelines 2. 5. Epicor ERP 10. 15.Update.Custom Code Conversion Guidelines Converted Code Programming Guide Note The folder may contains multiple revisions . 24 Epicor ERP 10. 2.700 .config.5 Compile the Project The next step is to compile the project in Visual Studio and attach the debugger to the ASP process. Compile the project. 2. You may need to reset the server application using IIS Reset or tweak the web.cs file.0. Set the breakpoint in the custom code found in the Tip.take files from the latest one and copy them into the project's TipUpdate folder. 1. Create a new record. 2. Launch the Tip of the Day Maintenance form. Epicor ERP 10.6 Debug the BPM Fire the BPM and view the code execution in the debugger.0.15.Converted Code Programming Guide Custom Code Conversion Guidelines 3. System Setup > System Maintenance > Tip Of the Day 2.700 25 . 1. Start the Epicor ERP client and attach the debugger to the ASP process. 700 . examine variable values and so on.0. 26 Epicor ERP 10.Custom Code Conversion Guidelines Converted Code Programming Guide 3. In the Title field. 4. enter A and click Save. At this point the debugger stops at the specified break point and you can the follow code execution. Follow these steps to perform custom debugging: • Create your custom directive. • Create a new folder in the project similar to TipUpdate. the BPM populates the Tip text value. Epicor ERP 10.Converted Code Programming Guide Custom Code Conversion Guidelines 5. 2.0. • Locate the sources generated by BPM and copy to this folder.700 27 .15. Based on the custom code defined in Method Directives. based on the selected directive.7 How to Modify Sample Project You can modify the sample project to debug another directive from another service. PartTran.Today . var days = difference. if ( days > 90) 2.Value.Value. 6 days are substracted from NeedByDate: ttOrderHedRow. 28 Epicor ERP 10. Assume the below statement exists in a BPM.0. Note that subtraction is done by adding a negative number of days In the following example.Days.AddDays(-6) 2.700 .16 Adding and Subtracting Date To add or subtract days from a given date field. var difference = DateTime.Custom Code Conversion Guidelines Converted Code Programming Guide • Locate the assembly generated by the BPM and name the project assembly the same. Difference and Days are variable names and can be replaced with any variable name of your choice. 2.17 Subtracting Two Dates and Comparing to an Integer Value Use the following syntax to subtract one date from another and then compare the number of days difference to an integer value.TranDate. use the syntax as displayed below. The assemblies generated by BPM are found in Server\Customizations\BO folder.18 ABL Find Last Conversion This topic discusses manual code adjustments after the Conversion Utility processes an ABL Find Last statement.NeedByDate. Converted Code Programming Guide Custom Code Conversion Guidelines The above statement is converted by the utility as follows: Now specify an OrderBy clause to sort the data.0.700 29 . the last record becomes the first record in the returned rows: Epicor ERP 10. In this example. it may happen that a variable is not set. Details: Error CS0165: Use of unassigned local variable 'Customer_UD' Notice that in the code example.Customer_UD Customer_UD = null.Custom Code Conversion Guidelines Converted Code Programming Guide 2. reporting use of an unassigned local variable. the compiler displays an error message.700 .19 Using Unassigned Local Variable Message Within the BPM logic. 30 Epicor ERP 10.Tables. Review the following example: This code will generate the following error upon compilation: Server Side Exception There is at least one compilation error.ServiceModel Error Detail ============ Description: There is at least one compilation error. This change ensures that the variable gets set to some value regardless of the IF statement. Exception caught in: Epicor. the Customer_UD variable is only set when the following condition is met: if (Customer != null) You can correct the error by changing the second line of the example to: Erp.0. In that case. The Epicor 10 equivalent is displayed below: 2. Note that you should not use all capitalized "BPM" in the reference to the Display Mode parameter. Warning.0. Example message was placed in vMiscInfo variable. The syntax example is shown below: The last two parameters are optional. you can leave the strings empty. Error.21 Displaying an Informational Message Informational messages are useful when debugging BPMs and presenting non-exception type messages to the users.05 the status of the RowMod = 'A' or 'U' was used in this case. Note that the possible values for message type are: Information. You can publish an informational message to the user from the execute custom code node in the BPM designer.String ToString()' metho Epicor ERP 10. The possible values for the InfoMessageDisplayMode are: Individual & Grid. In Epicor 9.Converted Code Programming Guide Custom Code Conversion Guidelines 2. it should be "Bpm". Question. 2.22 Converting a Number to a String in LINQ Expression Review an example of a LINQ query below: You may receive the following exception error at runtime: Server Side Exception LINQ to Entities does not recognize the method 'System.700 31 .20 Epicor 10 Equivalent to Row Mod = A or U In many BPMs a user wants to perform a certain action if the tt record is a new record or updated record. UpdateConflict. The relevant syntax is highlighted in the example below: 32 Epicor ERP 10.Data. Exception caught in: Epicor.Custom Code Conversion Guidelines Converted Code Programming Guide d. 2.23 Outputting Data to a File The syntax shown below can be used for BPMs that write data out to a file.0.Data.String ToS tring()' method.Entity. Program: System.SqlClient.Objects.dll Method: Translate Original Exception Type: NotSupportedException The corrected code looks like the following: You should also add the using reference below in the BPM Designer > Usings tab: using System. You can create a new file as in the example below.ServiceModel Error Detail ============ Description: LINQ to Entities does not recognize the method 'System.700 . and this method cannot be translated into a store expression. and this method cannot be translated into a store expression. or replace Create with Append to append to an existing file. Converted Code Programming Guide Custom Code Conversion Guidelines 2. The Using statement starts the transaction.0. and the txscope statement ends the transaction.24 Updating Database Tables The Upgrade Conversion Programmer's Guide recommends removing redundant scoping for database updates. the Db. Note that the select query adds a With(LockHint. If we are in a BPM on an update method. The example below shows how to scope the transaction for updating the InvcDetail_UD table's Number 01 field. The reason we do this is because we do not want anyone to be able to update the record in the table before we do since we use optimistic locking and could run into concurrency issues without it. but it is still a good idea to include them as good programming practice. This is usually done due to the fact that the scoping in the BPM from the conversion tool will be promoted up to the Method the BPM is associated with.700 33 .Validate statement does the update. Epicor ERP 10. this scope may be promoted to the Update method scope.UpdLock) phrase to the select statement for the table we are going to update (the InvcDtl_UD table in this example). 25 Sample of BPM calling a . the BPM was modified to call the business objects and the .700 .05.p file and the final Epicor 10 version Epicor 9.0.05 . • Epicor 9. ABL Code was calling a . In Epicor 10.Custom Code Conversion Guidelines Converted Code Programming Guide 2.05 ABL Code: • Epicor 9.p code moved into the BPM's Execute Custom Code action.p file that called the UD14 business object and added certain data to it.P Files Contents: 34 Epicor ERP 10. Converted Code Programming Guide Custom Code Conversion Guidelines • Final Epicor 10 C# Code that Compiled in BPM designer: Epicor ERP 10.0.700 35 . 700 .0.Custom Code Conversion Guidelines Converted Code Programming Guide 2. The same functionality equivalent for Epicor 10 is shown below: 36 Epicor ERP 10.26 Sample of a BPM That Sends an Email In Epicor 9. it was possible to send emails via ABL code without using any of the BPM wizards.05. 700 Custom Code Conversion Guidelines 37 .Converted Code Programming Guide Epicor ERP 10.0. go to http://support. To access this site. To create an account. you need a Site ID and an EPICweb account.Additional information is available at the Education and Documentation areas of the EPICweb Customer Portal. .com.epicor.
Copyright © 2024 DOKUMEN.SITE Inc.