Copied to clipboard

Flag this post as spam?

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


  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Apr 25, 2012 @ 09:55
    Kalle Ekstrand
    0

    Is it possible to change state from approved to submitted?

    I need to change state from approved to submitted, is that possible?

    It would also be very helpfull to manage this from the UI.

    //Kalle

  • Tim Geyssens 6419 posts 15021 karma points MVP 2x c-trib
    Apr 25, 2012 @ 10:55
    Tim Geyssens
    0

    This is the source for the approve record record action

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Umbraco.Forms.Core.Services;
    
    namespace Umbraco.Forms.Core.Providers.RecordActions
    {
        public class ApproveRecord : RecordActionType
        {
            public ApproveRecord()
            {
                this.Description = "Approves a record";
                this.Icon = "approve.png";
                this.Id = new Guid("cb126b72-9011-11df-a4ee-0800200c9a66");
                this.Name = "Approve";
            }
    
            public override Enums.RecordActionStatus Execute(Record record, Form form)
            {
                RecordService s = new RecordService(record);
    
                if (s != null)
                    s.Approve();
    
                s.Dispose();
    
                return Enums.RecordActionStatus.Completed;
            }
        }
    }
    And to change the state back to submitted  rs.Record.State = FormState.Submitted

     

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Apr 25, 2012 @ 11:02
    Kalle Ekstrand
    0

    Would it be possible to use your own states, like for example "Rejected", "Delivered" etc.?

  • Tim Geyssens 6419 posts 15021 karma points MVP 2x c-trib
    Apr 25, 2012 @ 11:07
    Tim Geyssens
    0

    If you want to execute workflows on states you can't use custom ones only the default ones

  • Tim Geyssens 6419 posts 15021 karma points MVP 2x c-trib
    Apr 25, 2012 @ 11:08
    Tim Geyssens
    0

    But if it's just to store a custom state you can add a hidden field and then set the value of that to your custom state...

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Apr 25, 2012 @ 11:23
    Kalle Ekstrand
    0

    Ok, so if I use a hidden field called "active" and want to change the value from "1" to "0". Could I then use the same code for that?

  • Kalle Ekstrand 181 posts 259 karma points c-trib
    Apr 25, 2012 @ 15:53
    Kalle Ekstrand
    0

    Hello again Tim.

    Would it be possible to call an record action from front end?

    //Kalle

  • Tim Geyssens 6419 posts 15021 karma points MVP 2x c-trib
    Apr 26, 2012 @ 09:19
    Tim Geyssens
    0

    Well record actions are for extending the records viewer if you don't want to extend that and just execute some code you don't need the record action...

Please Sign in or register to post replies

Write your reply to:

Draft