Beispiel #1
0
    /// <summary>
    /// Gets and bulk updates process triggers. Called when the "Get and bulk update triggers" button is pressed.
    /// Expects the CreateProcessTrigger method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateProcessTriggers()
    {
        // Prepare the parameters
        string where = "TriggerDisplayName LIKE N'My new trigger'";

        // Get the data
        InfoDataSet <ObjectWorkflowTriggerInfo> triggers = ObjectWorkflowTriggerInfoProvider.GetObjectWorkflowTriggers(where, null);

        if (!DataHelper.DataSourceIsEmpty(triggers))
        {
            // Loop through the individual items
            foreach (ObjectWorkflowTriggerInfo modifyTrigger in triggers)
            {
                // Update the properties
                modifyTrigger.TriggerDisplayName = modifyTrigger.TriggerDisplayName.ToUpper();

                // Save the changes
                ObjectWorkflowTriggerInfoProvider.SetObjectWorkflowTriggerInfo(modifyTrigger);
            }

            return(true);
        }

        return(false);
    }
Beispiel #2
0
    /// <summary>
    /// Creates process trigger. Called when the "Create trigger" button is pressed.
    /// Expects the CreateProcess method to be run first.
    /// </summary>
    private bool CreateProcessTrigger()
    {
        // Get the process
        WorkflowInfo process = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation);

        if (process != null)
        {
            // Create new process trigger object and set its properties
            ObjectWorkflowTriggerInfo newTrigger = new ObjectWorkflowTriggerInfo()
            {
                TriggerDisplayName = "My new trigger",
                TriggerType        = WorkflowTriggerTypeEnum.Change,
                TriggerSiteID      = SiteContext.CurrentSiteID,
                TriggerWorkflowID  = process.WorkflowID,
                TriggerObjectType  = "om.contact"
            };

            // Save the process trigger
            ObjectWorkflowTriggerInfoProvider.SetObjectWorkflowTriggerInfo(newTrigger);

            return(true);
        }

        return(false);
    }