Copied to clipboard

Flag this post as spam?

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


  • gilad 185 posts 425 karma points
    Dec 01, 2011 @ 18:39
    gilad
    0

    add workflow event programatically

    helllo everyone.

    it is possible to add event programatically?

    for exam : like to add a handlers for document event ( after publish , before save , etc.. )

    that what i want to do :

    1) I want to cancel the operation if some condition occurs.

    2) I wnat to update some hidden fields before they save in entires. that should be some data that i want the user( web site admin) see in theform entries , but the user how fill the form not see this fields.

    i can change this values via JS , but i preffer to change them programatically when submit or when the form is loaded...

    thanks in advance. cheers

  • gilad 185 posts 425 karma points
    Dec 04, 2011 @ 19:04
    gilad
    0

    here is example for record approved event..

    (if form set to auto approved this event activated every time the form is sending )

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Umbraco.Forms.Core;
    using Umbraco.Forms.Core.Services;
    using umbraco.cms.businesslogic.web;
    using umbraco.BusinessLogic;

    namespace customEvents
    {
        public class formsEvent : umbraco.BusinessLogic.ApplicationBase
        {
            public formsEvent()
            {
                RecordService.RecordApproved +=new EventHandler<RecordEventArgs>(RecordService_RecordApproved);
            }

            void RecordService_RecordApproved(object sender, RecordEventArgs e)
            {
                    RecordService rs = (RecordService)sender;
                    //// check something
                    // if (true)  -  delete Record
                    // { rs.Delete(); }
             }
        }
    }

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies