1

Using Tridion Object Model API, what is the correct way to remove Component Process from a Tridion schema?

Assigning Schema.ComponentProcess to Nothing does not seem to be working. VBScript sample code is included below:

testSchemaID = "tcm:3-123456-8"
Dim oSchema
Set oSchema = TDSE.getObject(testSchemaID, 2)
oSchema.ComponentProcess = Nothing
oSchema.Save(True)
Set oSchema = Nothing
3
  • What are you trying to do using deprecated VBScript? And what version of Tridion are you on? Mar 24, 2014 at 21:27
  • @NickoliRoussakov It's to automate the removal of component process from hundreds of schemas in Tridion 2011-SP1-2. Mar 24, 2014 at 21:52
  • 1
    How are you plugging in this VB code, via a Template, Workflow, Event System? You really should be using the Core Service API and/or Powershell for this. Mar 24, 2014 at 22:20

2 Answers 2

3

You can try using combination of C# and CoreService to remove the associated component process from the schema. The following code should help you get started:

    static void Main(string[] args)
    {
        SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient("netTcp_2013");
        var schema = client.Read("tcm:64-159-8", new ReadOptions()) as SchemaData;
        Console.WriteLine("Before: {0}",schema.ComponentProcess.Title);
        schema.ComponentProcess = new LinkToProcessDefinitionData();
        schema = client.Update(schema, new ReadOptions()) as SchemaData;
        Console.WriteLine("After: {0}",schema.ComponentProcess.Title);
        Console.ReadKey();
    }
1
  • 1
    Please note that I'm running this on Tridion 2013 and the endpoint name will change when using Tridion 2011 :)
    – Kunal
    Mar 25, 2014 at 10:13
1

As others have noted, the core service API is now preferred over the old TOM, however I think this is incidental to the problem at hand.

You have not specified what isn't working. The code looks alright to me, although it's been a while, and I don't have your scenario set up to test. Do you have error messages? If so - please update your question.

My first suspicion is that it may not be possible to remove the association while there are active activity instances based on this process. If this is the case, you might find it interesting to review this old blog post where I demonstrate automatically finishing workflow processes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.