Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2655 karma points c-trib
    Feb 04, 2010 @ 18:25
    Tim
    0

    Workflow Not Showing In Contour

    I've created a workflow, using the template in the documentation. I've given it a new GUID, and removed the settings (the task carries out some maintenance stuff that doesn't need any settings). However the Workflow isn't showing up in the dropdown when I add a workflow.

    The workflow compiles ok, and I'm not getting any errors, so I'm a bit stumped as to why it isn't appearing in the list. The class is in a DLL with a couple of other related classes (utility classes for the task, and a publishEvent, which is being picked up by Umbraco correctly). Does anyone have any ideas why a workflow wouldn't show up in the list?

  • Harald Ulriksen 207 posts 248 karma points
    Feb 05, 2010 @ 11:31
    Harald Ulriksen
    0

    Can you post any source?


    Best regards,
    Harald

  • Tim 1193 posts 2655 karma points c-trib
    Feb 05, 2010 @ 12:27
    Tim
    0

    Sure:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    using

     

    System;

    using

     

    System.Collections.Generic;

    using

     

    System.Linq;

    using

     

    System.Text;

    using

     

    umbraco.BusinessLogic;

    using

     

    umbraco.cms.businesslogic.web;

    using

     

    Umbraco.Forms.Core;

    using

     

    Umbraco.Forms.Core.Enums;

    namespace

     

    Epiphany.AskAnExpert

    {

     

    /// <summary>

     

    /// Workflow class to publish a question to the AAE area of the site for approval

     

     

    /// </summary>

     

    class PublishQuestion : Umbraco.Forms.Core.WorkflowType

    {

     

    public PublishQuestion()

    {

     

    this.Id = new Guid("de889e2d-1c28-4767-a0ef-eee75216a8ab");

     

    this.Name = "Publish Ask An Expert Question";

     

    this.Description = "Publishes the form as an ask an expert question on the site";

    }

     

     

    public override List<Exception> ValidateSettings()

    {

     

    return new List<Exception>();

    }

     

     

    public override WorkflowExecutionStatus Execute(Record record, RecordEventArgs e)

    {

     

    //create new page and map the form to it

     

     

    //Get the type you would like to use by its alias

     

    //and the user who should be the creator of the document

     

    DocumentType dt = DocumentType.GetByAlias("AskAnExpertQuestion");

    umbraco.BusinessLogic.

    User author = umbraco.BusinessLogic.User.GetUser(0);

     

     

    string question = record.RecordFields[new Guid("96d62921-70b7-457f-9c23-d356ba6abef8")].ValuesAsString();

     

    string background = record.RecordFields[new Guid("a932b211-4222-4cd1-8bc3-6464c644fba2")].ValuesAsString();

     

    string area = record.RecordFields[new Guid("a1c6e101-da6d-4d3e-beb2-5e4198804562")].ValuesAsString();

     

    string firstName = record.RecordFields[new Guid("e76ed39d-0f60-4f75-9426-ee8f0b422efa")].ValuesAsString();

     

    string surname = record.RecordFields[new Guid("8da8815a-fadb-4dfb-8587-ed4ea269f89b")].ValuesAsString();

     

    string screenName = record.RecordFields[new Guid("d6cddf93-4235-4712-9cc3-46f0881114fa")].ValuesAsString();

     

    string emailAddress = record.RecordFields[new Guid("6490dab3-d70f-4a56-890c-abd88685a1c2")].ValuesAsString();

     

    //get page name. If the question is longer than the maximum allowed, shorten it to the first sentence

     

    string pageName = question;

     

    if (pageName.Length > 150)

    {

     

    if (pageName.IndexOf(".") > 0)

    {

    pageName = pageName.Substring(0, pageName.IndexOf(

    "."));

    }

     

    else

    {

    pageName = pageName.Substring(0, 150);

    pageName = pageName.Substring(0, pageName.LastIndexOf(

    " ")).Trim();

    }

    }

     

     

    //create a document with a name, a type, an umbraco user, and the ID of the document's parent page.

     

    //To create a document at the root of umbraco, use the id -1

     

    Document doc = Document.MakeNew(pageName, dt, author, Convert.ToInt32(area));

    doc.getProperty(

    "question").Value = question;

    doc.getProperty(

    "background").Value = background;

    doc.getProperty(

    "firstName").Value = firstName;

    doc.getProperty(

    "surname").Value = surname;

    doc.getProperty(

    "displayName").Value = screenName;

    doc.getProperty(

    "emailAddress").Value = emailAddress;

     

    //after creating the document, save it, but don't publish it

    doc.Save();

     

     

    //return the completed status

     

    return WorkflowExecutionStatus.Completed;
    }

     

  • Harald Ulriksen 207 posts 248 karma points
    Feb 05, 2010 @ 12:59
    Harald Ulriksen
    1

    Try to mark your class as public. As far as I can remember the default access modifier in C# is internal, hence it cannot be accessed by an other assembly.

  • Tim 1193 posts 2655 karma points c-trib
    Feb 05, 2010 @ 13:15
    Tim
    0

    Ahah, that was it! I am a tool, I should have spotted that earlier, thanks!

    :)

  • Harald Ulriksen 207 posts 248 karma points
    Feb 05, 2010 @ 13:38
    Harald Ulriksen
    0

    Excellent, can you please mark this topic as solved?

    Thanks,
    Harald.

  • 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