Dear Team,

                  Problem: business process not trigger from web service.

                  How to trigger business process in wcf web service.Please guid me how to trigger?

        Thanks in advance.

Regards,

Sekhar.

Like 0

Like

5 comments

Dear Sekhar,

Here is the example of how to start business process with parameter from server side code.

using Terrasoft.Core;

using Terrasoft.Core.Process;

using Terrasoft.Core.Process.Configuration;

 

ProcessSchema schema = UserConnection.ProcessSchemaManager.GetInstanceByName("LeadManagement");

//schema = UserConnection.ProcessSchemaManager.GetInstanceByUId(leadManagementProcessUId);

 

//different engines for interpretable and compiled BP

bool canUseFlowEngine = ProcessSchemaManager.GetCanUseFlowEngine(UserConnection, schema);

if(canUseFlowEngine) {

    var flowEngine = new FlowEngine(UserConnection);

    var param = new Dictionary<string, string>();

    param["LeadId"] = Entity.Id.ToString();

    flowEngine.RunProcess(schema, param);

} else {

    Process process = schema.CreateProcess(UserConnection);

    process.SetPropertyValue("LeadId", Entity.Id);

    process.Execute(UserConnection);

}   

Hope you will find it helpful.

Regards,

Anastasia

Anastasia Botezat,

Hi Anastasia. Your code illustrates how to call a BP by passing parameters. How would one go about reading BP parameters after the execution of the business process??

 

M Shrikanth,

 

Hello,

 

You've already created a thread here https://community.creatio.com/questions/read-business-process-parameter… so we will discuss this topic there.

 

Best regards,

Oscar

Anastasia Botezat,



Hello,



Is the method async or not?

I just run a test and it did not wait for the result.



Best regards,

Solem A.

Solem Khan Abdusalam,

 

Hello,

 

This is a synchronous call, also tested out-of-the-box by calling a process with 10 000 repetitions of data reading in a cycle.

Show all comments

within a business process I have a contact object and an account object.  I want to associate them and be able to specify whether the contact is the "primary" contact or not.

 

Do I create a "Connecting contact to account" record?  if so, how?

Like 0

Like

1 comments

Dear Brian,

You can read data from Account, then read data from Contact with the following filter - http://prntscr.com/lockqu (or http://prntscr.com/lockvf if you need to find contact which is connected with certain account) 

Show all comments

Hello community,

I am trying to perform the following command from a Script Task element:

DELETE FROM [dbo].[UsrListDocuments] WHERE [Opportunity] = @P1 AND [Product] = @P2

Currently, the C# code is similar to this:

var opportunityId = Get("Read opportunity product.Opportunity");
var productId = Get("Read opportunity product.Product");
var delete = new Delete(userConnection)
        .From("UsrListDocuments")
        .Where("Opportunity").IsEqual(opportunityId)
        .Where("Product").IsEqual(productId);
        
return true;

Is this accurate? What would be the best practice in this case? The code is not working properly that´s why I am looking for your assistance.

Thanks.

Like 0

Like

2 comments

Hello,

As far as I understood your business goal, you are trying to fetch some parameters via [Read Data] element in your script task and pass it further to the Delete query.



Firstly, you need to get parameters in the [Script Task] from the [Read Data] element.

For the interpreted process the algorithm is the next:

1) Create a business process parameters and map it to the needed Read Data element. You can learn more about business parameters in our guide - https://academy.bpmonline.com/documents/technic-bpms/7-12/how-add-param…

In your example it will be something like:

[#Read opportunity product.First item of resulting collection.Opportunity#] and [#Read opportunity product.First item of resulting collection.Product#]

2) Use business-parameters in your Script-task.

var opportunityId = Get<Guid>("ProcessParam1");

var productId = Get<Guid>("ProcessParam2");

Then you need to get the userConnection in order to pass it in the Delete query:

var userConnection = Get<UserConnection>("UserConnection"); 

After that you can create a delete query:

var delete = new Delete(userConnection)

        .From("UsrListDocuments")

        .Where("Opportunity").IsEqual(opportunityId)

        .Where("Product").IsEqual(productId);

        

And execute it:

 delete.execute();

Tetiana Markova,

Thanks, Thetiana. It worked.

Show all comments

Hi,

 

Do you have any working example how to consume Azure Machine Learning web service on BPMOnline BusinessProcess and Web Service function ?

 

thanks

Antonius 

Like 0

Like

6 comments

Hello,

First, you need to set up an integration with  Azure Machine Learning web service in the bpmonline. Please, see the documentation - https://academy.bpmonline.com/documents/administration/7-12/integration…

Then you can call the web service via [Call Web Service] process element in your business process - https://academy.bpmonline.com/documents/technic-bpms/7-12/call-web-serv…

 

Tetiana Markova,

 

thanks for your reply.

I tried to consume it using as per documentation but have no luck so far.

(1) tried the webservice using Postmand (works)

 

 

 

 

 

 

 

 

(2) try using BMOnline with same parameters

2 headers parameters

Key : Authorization

Authorization : Content-Type

 

1 body parameters

 Json path : $

Data Type : text

is Array : No

Value : <copy from Postman raw body>

 

 

 

but it keep replying response 400

{"error":{"code":"BadArgument","message":"Invalid argument provided.","details":[{"code":"InputMismatchError","target":"input1","message":"Input data does not match input port schema."}]}}

 

how to fixed this ? am I missing something ?

 

thanks

 

 

Dear Antonius,

I don't see where you call the webservice. Perhaps, you didn't set a value to input1 parameter

Peter Vdovukhin,

Hi Peter,

thank you for your comments.

 

I called the web service in Business Process 

I'm not sure whether I set the input parameter correctly. the value and format is exactly same from what I used  Postman.

thanks

 

Hi Antonius,

You should deploy an application on-site, create a web service call and test network via fiddler to see what request is sent to web service. The message you've got means that bpm'online sends a request in a format that differs from that you are expecting. Then you can set up parameters in a such way that will fit to Azure learning standard.

The other option will be creating a script task with calling that webservice from c# code. If you are a developer this is the best way because allows you to do more than built-in web service call.

Peter Vdovukhin,

Hi Peter,

thank you for your comment.

I follow your suggestion by creating a script task.

(1) [in process methods setting menu] add RestSharp name space 

(2) [in script task] construct Json to be put in body parameter:

string json = JsonConvert.SerializeObject(data);

 

(3) [in script task] use RestClient to call web service and adding the necessary parameters    

var client = new RestClient("https://xxxxx.xx.azureml.net/workspaces/xxxx/services/xxx/execute?api-version=2.0&amp;format=swagger");
	var request = new RestRequest(Method.POST);
	request.AddHeader("Cache-Control", "no-cache");
	request.AddHeader("Content-Type", "application/json");
	request.AddHeader("Authorization", "Bearer FpIlxxxxxxxxxxxx");
	request.AddParameter("undefined",  json , ParameterType.RequestBody);
	IRestResponse response = client.Execute(request);

it works for me.

thanks !

 

Show all comments