Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Boye 19 posts 131 karma points
    Apr 17, 2015 @ 10:40
    Jonas Boye
    0

    Manipulating values on submit

    Hi Guys,

    Can anyone provide an example on how to manipulate values in a form?

    I've tried this, based on Tim Geyssens Quiz Calculator, but it doesn't change the values.

    Also is it possible to hook into a "on submit" event, instead of creating a workflow? I want to make sure this run on every forms, and before any other custom workflows

    public class TestWorkFlow : Umbraco.Forms.Core.WorkflowType {
    
    public TestWorkFlow () {
        this.Name = "TestWorkFlow";
        this.Id = new Guid("b770c7ed-594f-4f2e-8bb7-71fbb6dc46c9");
        this.Description = "Testing...";
    }
    
    public override WorkflowExecutionStatus Execute ( Record record, RecordEventArgs e ) {
    
        foreach (RecordField rf in record.RecordFields.Values) {
            rf.Values.Clear();
            rf.Values.Add("Changed!");
        }
    
        RecordStorage rs = new RecordStorage();
        rs.UpdateRecord(record, e.Form);
        rs.UpdateRecordXml(record, e.Form);
        rs.Dispose();
        return WorkflowExecutionStatus.Completed;
    }
    
    public override List<Exception> ValidateSettings () {
        return new List<Exception>();
    }
    
  • Jonas Boye 19 posts 131 karma points
    Apr 17, 2015 @ 11:28
    Jonas Boye
    0

    rs.UpdateRecordXml throws this exception:

    SqlCE4Umbraco.SqlCeProviderException: Error running NonQuery: 
    SQL Statement:
    DELETE FROM UFRecordsXml where id = @id
    
    Exception:
    System.Data.SqlServerCe.SqlCeException (0x80004005): The specified table does not exist. [ UFRecordsXml ]
       at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
       at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
       at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
       at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
       at umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters)
    2015-04-17 11:26:33,804 [65] ERROR Umbraco.Forms.Data.LogHelper - [Thread 54] Forms: workflow 'TestWorkFlow' failed on Submitted
    umbraco.DataLayer.SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery ---> SqlCE4Umbraco.SqlCeProviderException: Error running NonQuery: 
    SQL Statement:
    DELETE FROM UFRecordsXml where id = @id
    
    Exception:
    System.Data.SqlServerCe.SqlCeException (0x80004005): The specified table does not exist. [ UFRecordsXml ]
       at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
       at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
       at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
       at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
       at SqlCE4Umbraco.SqlCeApplicationBlock.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters)
       at umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters)
       --- End of inner exception stack trace ---
       at umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters)
       at Umbraco.Forms.Data.Storage.RecordStorage.UpdateRecordXml(Record record, Form form)
       at TestWorkFlow.Execute(Record record, RecordEventArgs e) in e:\data\Umbraco.7.2.1\App_Code\TestWorkFlow.cs:line 79
       at Umbraco.Forms.Core.Services.WorkflowService.ExecuteWorkflows(List`1 workflows, RecordEventArgs e)
Please Sign in or register to post replies

Write your reply to:

Draft