String Writer

my tech stuffs…

Archive for March 2011

Coming back to ASP.NET

leave a comment »

I was quite away from ASP.Net development for more than 2 years that means when I was introduced to ASP.Net MVC framework. After that I moved to MOSS and Tridion development. Now I might get an opportunity, in a couple of months, on ASP.Net. I’m sure that I need to learn lot from newer version of .Net frameworks, esp ASP.Net MVP framework 3.

So thinking of starting with ASP.Net MVC framework.

I think I can start with MSDN which has complete set for beginners :)

Written by visvabalaji

March 16, 2011 at 12:54 am

Posted in WCM

Tagged with ,

Trigger mail from Tridion Workflow

with 2 comments

One of the most-wanted requirement from all customers is that notifying users through email. When they have some level of approvers to approve the content before they get published, the current user or next level approvers can be notified via mail.

I’ve earlier done this same implementation in ASP.Net & MOSS but Tridion is bit different. Sending mail is no different than traditional C# way. C# is to write mail related code and VB Script is to invoke it. Thats it…

Tridion allows this implementation in 3 simple steps. This simple example is just to understand its process… other business logics can be included later according to our requirements.

Implementation

1) Create custom dll using C#

2) Create workflows using Visio

3) Define workflow actions using VB Script

1) Create Custom dll using C#

Assuming that you now have fair idea about developing custom assemblies in Tridion. I’m starting directly with a code snippet.

Let’s create a custom class to define a C# method which has mailing piece of code.


namespace WorkFlow
{

  [System.Runtime.InteropServices.ComVisible(true)]
  [System.Runtime.InteropServices.ProgId("WCMReq.WorkflowSamples")]
  public class MailUtility
  {

     public bool NotifyUser(object workItem)
     {

        try
        {
           If(workItem is Component)
           {
               Component comp = (Component)workItem;
               String message = “Current approval level of “ + comp.Title + “ is “ + comp.ApprovalStatus.Position;
               return SendMail(message);
           }
           return false;
        }
        catch (Exception ex)
        {
           WriteLog(ex.Message);
        }
     }

     private bool SendMail(string message)
     {
       …
     }
  }
}

2) Create workflows using Visio

Assuming that you are already defined workflows using Visio Tridion extention.

3) Define workflow actions using VB Script

Open any workflow automatic action and include the following VB Script code.


Dim workobj
Set workobj= CreateObject("WCMReq.WorkflowSamples")
workobj.NotifyUser(CurrentWorkItem.GetItem())
Set workobj= Nothing

Written by visvabalaji

March 9, 2011 at 7:30 am

Posted in Tridion

Tagged with , , , ,

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: