Encountered a situation on a data integration project for one of our DynamicWeb clients. Trying to use a Code expression in a data mapping. The team is following the documentation here under "Scripting" that shows how to use data values from the source row in your code expression via data["field_name"]
https://doc.dynamicweb.dev/manual/dynamicweb10/integration/setup/activities.html?tabs=general#scripting
When they try to run the integration, they’re get an error compiling the code expression that seems to indicate that `data` is not something that exists in the current context (see exception message and stack trace below).
Also, they are doing a bit of decompiling and looking at the CodeExpressionEvaluator class, it indeed looks like it does NOT actually pass a 'data' parameter into the expression being executed. Is there missing something here, or is there really no way to access the row data from within a code expression?
Error: Error occurred when compiling code expression: Decimal.Parse(data["List_Price"], System.Globalization.NumberStyles.AllowCurrencySymbol System.Globalization.NumberStyles.AllowDecimalPoint System.Globalization.NumberStyles.AllowThousands, new System.Globalization.CultureInfo("en-US")) CS0103: The name 'data' does not exist in the current context Stack: at Dynamicweb.Extensibility.ExpressionEvaluators.CodeExpressionEvaluator.CompileExpression(String expression) at Dynamicweb.Extensibility.ExpressionEvaluators.CodeExpressionEvaluator.Evaluate(String expression) at Dynamicweb.Extensibility.ExpressionEvaluators.ExpressionEvaluator.ExpandValue(String value) at Dynamicweb.DataIntegration.Integration.ScriptTypes.CodeScriptType.GetValueTyped(Object input) at Dynamicweb.DataIntegration.Integration.ScriptTypeProvider`1.GetValue(Object input) at Dynamicweb.DataIntegration.Integration.ColumnMapping.GetScriptValue() at Dynamicweb.DataIntegration.Providers.EcomProvider.EcomDestinationWriter.Write(Dictionary`2 row, Mapping mapping, Boolean discardDuplicates) at Dynamicweb.DataIntegration.Providers.EcomProvider.EcomProvider.RunJob(Job job)
Let me know if you need any more info.
Thanks!
KF