Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Nov 30, 2011 @ 14:17
    Bo Damgaard Mortensen
    0

    Submit/Approve document workflow

    Hi all,

    I'm currently building a site where members are allowed to post new documents in Umbraco. For this, I'm using Contour and the workflow is as follows:

    • The member creates a new record, which creates a new document. This document isn't published yet.
    • The administrator receives an email with an approve and deny link. If he/she clicks the "approve" link, the document will be published. If he/she clicks the "deny" link, the document will remain unpublished and will show up in the members "Denied"-list.
    Now, the million-dollar question is: does the ID of this newly created document exist somewhere in the record? And if so, how exactly do you get the value of it in XSLT and C#?
    Thanks a lot in advance.
    - Bo

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Nov 30, 2011 @ 17:39
    Bo Damgaard Mortensen
    0

    Also, as a side-question:

    I kinda gave up on the above as it seems there's no relation between the created document and the record. So I decided to go with the recordservice which seem to work really well. However, i'm a bit stuck on how to retreive the prevalues of a dropdown list in Contour. My list isn't using any datasource or prevalues source, just the regular prevalues you can add when you create the field.

    I'm trying to get the selected value just the way I am getting all the other values from the form, but instead of getting the value I am getting a GUID back (?) This is what I'm doing:

    string myvalue = string.Empty;
    if(record.GetRecordField("MyDropDownList").Values.Count > 0)
    myvalue = record.GetRecordField("MyDropDownList").Values[0].ToString(); 

    Does anyone know how to get the selected value? :-)

    Thanks in advance.

    - Bo

  • Comment author was deleted

    Dec 01, 2011 @ 10:14

    Hey Bo,

    It won't be stored by default but should be possible to do with a little update. Add a hidden field on the form, and then populate that with the created document id

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Dec 01, 2011 @ 13:03
    Bo Damgaard Mortensen
    0

    Hi Tim,

    Thanks a lot for your suggestion! :-) I actually fooled a bit around with it yesterday. Created a hidden field and set the default value of it to: {document.Id}, but it didn't seem to work. Have I missed something here?

    Thanks again, it's greatly appreciated!

    - Bo

  • Comment author was deleted

    Dec 01, 2011 @ 13:21

    well don't think that will work since you want to set it to the id of the document that has been created with the workflow, you'll need a custom workflow type then (but if you start from the existing it should be pretty easy to add that)

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Dec 01, 2011 @ 14:39
    Bo Damgaard Mortensen
    0

    Hi Tim,

    Thanks again! :-)

    My initial idea was to access the RecordSubmitted event and grab the data from the fields, create the document manually in C# and send a notification e-mail to the administrator.

    The only thing I am missing is to be able to pull the value from the dropdownlist, as written in my above code. It seems I'm only getting the GUID. I've searched high and low, but can't find anything on how to access dropdownlist fields.

    Do you know how to do this? :-)

    All the best,

    Bo

  • Nick 101 posts 123 karma points
    Feb 14, 2013 @ 10:48
    Nick
    0

    Hi Bo,

    I'm in the very same situation!

    I managed some sort of solution but it's a bit long winded.

    If you do:  e.Record.GetRecordField("DropDownList").ValuesAsString() you get the Guid of the selected option.

    If you do  ((System.Web.UI.WebControls.ListControl)e.Record.GetRecordField("DropDownList").Field.FieldType.Editor).Items;

    You get all the ListItems. Then you can use FindByValue method. So what I've done is:

     var myList = ((ListControl)e.Record.GetRecordField("DropDownList").Field.FieldType.Editor).Items;

     var selectedItem = countryList.FindByValue(e.Record.GetRecordField("DropDownList").ValuesAsString()).Text;

    And now selectedItem contains the Text of the selected dropdown item.

    I'm still surprised there isn't an easier way, like e.Record.GetRecordField("Country").SelectedText or something

Please Sign in or register to post replies

Write your reply to:

Draft