One of the first steps in converting a form from Acrobat to LiveCycle Designer ES is to determine how much of the Acrobat scripting is supported by LiveCycle Designer ES and how much you must convert.
In general, you should convert all Acrobat scripting to an equivalent in LiveCycle Designer ES. LiveCycle Designer ES scripting takes full advantage of the highly structured nature of LiveCycle Designer ES forms, as well as useful forms-specific functionality, to make designing and implementing your forms solution faster and easier.
The Acrobat scripting you should retain include those that deal with the form’s environment and peripheral operations, such as adding attachments or multimedia, performing searches, or creating reports and handling document metadata.
For more information about converting Acrobat scripting to LiveCycle Designer ES, see the article Converting Acrobat JavaScript for Use in LiveCycle Designer ES Forms in the LiveCycle Designer ES Developer Center at http://www.adobe.com/go/learn_lc_AcrobatDeveloper.
See also 

Converting Acrobat forms that contain scripts