I have finally managed to create a new custom workflow in contour so as to update a hidden field in one of my request form.
This request form will have an ID which will increment each time a user submit a form. However this ID is only in the DB and not in contour. With the new Custom Workflow the idea is to update this Hidden Field so that when the admin go to the View Entries in contour he sees the ID related to the form.
What am not sure is how do i retrieve this ID from DB in my custom workflow ? How do i make an SQL Connection to retrieve this value ?
My workflow applies when the form has been approved here.
Not sure where am going with this but am completely lost here, had a look Umbraco.Forms.Core.Providers
public class UpdateId : Umbraco.Forms.Core.WorkflowType { [Umbraco.Forms.Core.Attributes.Setting("Connection String", description = "SQL Connection String", prevalues = "Provider=SQLNCLI10;Server=tabata;Database=umbraco_vresorts;Uid=sql_eservices; Pwd=slash!0;", control = "Umbraco.Forms.Core.FieldSetting.TextArea")] public string Connection { get; set; }
[Umbraco.Forms.Core.Attributes.Setting("Document ID", description = "Node the log entry belongs to", control = "Umbraco.Forms.Core.FieldSetting.Pickers.Content")] public string document { get; set; }
[Umbraco.Forms.Core.Attributes.Setting("AutoID", description = "Update the ID here", control = "Umbraco.Forms.Core.FieldSetting.TextField")] public string AutoID { get; set; }
public UpdateId() { this.Name = "Update AutoID Field In Contour"; this.Id = new Guid("44f913a6-6f5e-4866-8b35-64688d1b7c35"); // 4182f9da-d0e4-4602-9874-5cbec3a5d462 this.Description = "This workflow will update the AutoID"; } public override List<Exception> ValidateSettings() { List<Exception> exceptions = new List<Exception>(); if (string.IsNullOrEmpty(LogHeader)) exceptions.Add(new Exception("'Header look up field' setting not fille out'")); if (string.IsNullOrEmpty(document)) exceptions.Add(new Exception("'Document is empty'")); return exceptions; }
public override Umbraco.Forms.Core.Enums.WorkflowExecutionStatus Execute(Record record, RecordEventArgs e) { // SqlConnection sqlConn = new SqlConnection("umbracoDbDSN"); //string sql = string.Format("SELECT * FROM [uFRecords]");
was this fixed? I am doing something similar but i am using EF instead to connect to the database. And I am inserting records not selecting. this is something i need to do though. Retrieving the latest record executed. Any luck?
Custom Workflow to retrieve ID from DB
Hi Guys,
I have finally managed to create a new custom workflow in contour so as to update a hidden field in one of my request form.
This request form will have an ID which will increment each time a user submit a form. However this ID is only in the DB and not in contour. With the new Custom Workflow the idea is to update this Hidden Field so that when the admin go to the View Entries in contour he sees the ID related to the form.
What am not sure is how do i retrieve this ID from DB in my custom workflow ? How do i make an SQL Connection to retrieve this value ?
My workflow applies when the form has been approved here.
Any suggestion please ??
Comment author was deleted
Hey Fuji, you can just make an sql connection in the way you prefer :), are you on Umbraco 4 or 6?
Comment author was deleted
Depending on the version I can share a snippet of code :)
Am on V 4 using Contour 3.0.17
Comment author was deleted
In that case you can use the old datalayer
Will something like this work ?
Not sure where am going with this but am completely lost here, had a look Umbraco.Forms.Core.Providers
//fuji
Any help on this please ?
Comment author was deleted
the prevalues property is used for dropdowns/radiobutton lists try default value instead but yeah SqlConnection is a good start
Thanks Tim. I tried removing Prevalues but cant make use of Dafault its giving me an error.
I tried that instead but how to i get to view the Ids
was this fixed? I am doing something similar but i am using EF instead to connect to the database. And I am inserting records not selecting. this is something i need to do though. Retrieving the latest record executed. Any luck?
is working on a reply...