Skip to end of banner
Go to start of banner

Permanent Workflows Lab

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Objective: Create a Permanent Workflow that will run every hour and bring the list of people whose attributes have been modified.

Credentials:

User ID: Test

Password: P@$$w0rd

  1. Start the 20331B-NYC-DC-05 virtual machine. Wait for the virtual machine to display the Desktop.

  2. On your Desktop, Right-click Workflow Studio (WFS), and then click Run as administrator.

  3. Wait for WFS to start and enter your credentials.

 

  1. In Solution Explorer, right-click on the Developer Packages folder, create a new folder called DemoLabs, and click the Ok button.

  1. Add New Folder dialog box will appear from it; select the following options.

  • User Interface > Lookup Control

  • User Interface > Forms

  • User Interface > UI Pages

  • Workflows > Applications

And click the Ok button.

  1. Expand the Developer Packages folder, find the DemoLabs folder, expand it under the DemoLabs folder, expand the Workflows folder, right-click on the Applications folder, hover your mouse on the New Workflow option and Click on Permanent Workflow.

  1. It will load the Permanent Workflow Template.

  2. Click on the Save button to save your Permanent Workflow and give it the name Demo_PermanentWF.

  3. Now go to the properties tab and create two properties of type string.

  4. Now double click on the DoWork activity or right click on the DoWork activity and then click on Edit DoWork_ExecuteCode

  5. It will open the code editor for you where you can write your custom logic to perform any task or action.

  6. In this code editor I will write the code that will call my stored procedure that we made above and that stored procedure will return me the values and I will write down those values in a text file. Here is the code to do that

    // Calling my stored procedure and passing the 5 as an input for my stored procedure
    E.TList<C.Person> people = C.Person.GetTList("HS_Custom_Person_GetModifiedPeople", new Object[] {5});
    
     String Topheader = "FirstName,LastName,Department,Login";
     
     //Initiating the StringBuilder Object
       StringBuilder Data = new StringBuilder();
     
     //We are using StringBuilder because StringBuilder objects are mutable and they offer better performance than string objects of type System.String when heavy string manupulation is involved
       Data.AppendLine(Topheader);
     
     //Looping through the items returned by the stored procedure and storing it in StringBuilder object
     foreach(var person in people)
     {
     	string line = string.Format("{0}{1}{2}{3}", person.FirstName, person.LastName, person.Department, person.Login);
     	Data.AppendLine(line);
     }
     //Here we are creating a file on our local machine
     string fileName = this.OutPutFilePath + "\\" + this.FileNamePrefix + DateTime.UtcNow.Ticks.ToString() + ".txt";
     var file = File.CreateText(fileName);
     //Here we are writing the data into our newly created text file.
     file.Write(Data.ToString());
     file.Dispose();
    

  • No labels