Passing a Parameter from a BP, to a C# , then Pass Parameters back to the BP

Hi

I may have a misunderstanding how this would work.  
 

Is it possible to start with a Business Process, have some parameters pass that to a C# code to do some work, then output parameters back?  The specialize code is not a script task, do I need to to use a script task to call my C#code?  How would it look passing parameters back to the BP?



 

 

 

Like 0

Like

1 comments
Best reply

Yes, you need to use a Script Task to call the C# code (and pass UserConnection, if needed) and then return the values from the C# code, which you could then set as params in the script task to use in the process. Let's say you have a process param called SomeParam that you want to pass to the C# code, then take the returned result and put it in a process param called ResultParam:
Script Task:

// get param
var someParam = Get<string>("SomeParam");
 
// call C# code & get returned value
var cls = new Terrasoft.Configuration.UsrMyClass();
var result = cls.DoSomething(UserConnection, someParam);
 
// set result in param to use in process
Set("ResultParam", result);

The C# code:

using System;
using Terrasoft.Core;
 
namespace Terrasoft.Configuration
{
    public class UsrMyClass
    {
        public string DoSomething(UserConnection userConnection, string someValue)
        {
            return someValue + " is done!";
        }
    }
}

Ryan

Yes, you need to use a Script Task to call the C# code (and pass UserConnection, if needed) and then return the values from the C# code, which you could then set as params in the script task to use in the process. Let's say you have a process param called SomeParam that you want to pass to the C# code, then take the returned result and put it in a process param called ResultParam:
Script Task:

// get param
var someParam = Get<string>("SomeParam");
 
// call C# code & get returned value
var cls = new Terrasoft.Configuration.UsrMyClass();
var result = cls.DoSomething(UserConnection, someParam);
 
// set result in param to use in process
Set("ResultParam", result);

The C# code:

using System;
using Terrasoft.Core;
 
namespace Terrasoft.Configuration
{
    public class UsrMyClass
    {
        public string DoSomething(UserConnection userConnection, string someValue)
        {
            return someValue + " is done!";
        }
    }
}

Ryan

Show all comments