Skip to main content
Version: Next

Valider automatiquement une étape de workflow sur escalade de relance

Voici le code à mettre dans une nouvelle action de la bibliothèque. L'action est à appeler sur escalade de relance du workflow.

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

using Avanteam.Workflow.Runtime;
using Avanteam.Workflow.ComponentModel;
using Avanteam.Workflow.ComponentModel.Shared;
using Avanteam.Workflow.ComponentModel.Runtime;

using Avanteam.Application;
using Avanteam.Application.DataSource;


namespace Avanteam.Kernel.Scripting
{

public class CSCode
{

public bool Execute(Hashtable parameters)
{

ApplicationDataSource dataSource = parameters["ApplicationDataSource"] as ApplicationDataSource;
Instance instance = parameters["Instance"] as Instance;

// TODO - Add your code here
TimerRules rules = parameters["Timer"] as TimerRules;
if (rules == null)
{
OnError(parameters, "timer", 9999, "Timer not set");
return true;
}


// Invoke the current instance
dataSource.UserName = "Automatique";
instance.Childs[0].Runtime.InvokeInstance(instance.Childs[0]); // 0 pour effectuer la première action de la liste

// Disable Emailling
rules.RevivalMail.SendEMail = false;


return true;
}

private void OnError(Hashtable context, string prefix, int errCode, string errLabel)
{
context["ErrorCode." + prefix] = errCode;
context["ErrorText." + prefix] = errLabel;
}
}
}