Hi,

 

Is there a way to create an autocomplete dropdown in the user interface that keeps loading data from web service calls, based on the latest search string?

 

Thanks in advance...

Like 0

Like

8 comments

Dear Amanthena,

We do not have any ready examples, however you can achieve such task in following ways.

1. Add a dependency on the field change on client side (page schema). Retrieve the value from the field and pass it on to the web service, which in turn would send this value to the external service. Receive a response and set it to the field in order to render on UI. You can see this article on web service call from client side:

https://academy.bpmonline.com/documents/technic-sdk/7-13/how-call-configuration-services-servicehelper

2. Add a dependency on the field change on client side (page schema). Call business process from the client side. Pass a parameter to the business process, this parameter would be the entered value from the field. In the business process add a web service element, which would proceed service calls and than work with the response. You can also pass the response from the service from business process on to the page like described here:

https://academy.bpmonline.com/documents/technic-sdk/7-13/process-launch-client-module

https://community.bpmonline.com/questions/refresh-page-fields-after-process-runs-update-signal

Though, it is quite complicated task.

In any way, please keep in mind, that you need to watch overall system performance and leave some time between service calls. More information can be found here:

https://codeburst.io/throttling-and-debouncing-in-javascript-b01cad5c8edf

Regards,

Anastasia

Thank you for your reply, Anastasia! The reference material helped. The part where we make a service call from javascript and trap the response is clear. But could you help me figure out the javascript APIs that will help me clear, rebind and render it to a control in the UI. Would a dropdown be the best choice here? What do you suggest?

 

amanthena,

You can send a message from back end to front end.In case you are calling external service via business process, you can check the example here:

https://community.bpmonline.com/questions/refresh-page-fields-after-process-runs-update-signal

The idea is to use sandbox to send and hear message, after message received you set it to the field with this.set.

Also you can use web sockets to communicate between front end and back end. 

https://academy.bpmonline.com/documents/technic-sdk/7-13/clientmessagebridge-client-side-websocket-message-handler

The field type depends on the data you will be working with. 

Hope you find it helpful

Anastasia

The data is a list of key-value pairs, "value" is the user friendly description and "key" is the id that needs to be persisted in the database on selection. i figured a dropdown would be the best control for this purpose. Can we programatically reset the contents of the dropdown in javascript with the data that is returned from the server? Could you tell me how "this.set" needs to be used here?



Once again, thanks for all the help! Much appreciated!

amanthena,

To set value to a lookup (dropdown), you need to pass an object with at least to parameters displayValue and value :

this.set("Country", {value: "a570b005-e8bb-df11-b00f-001d60e938c6", displayValue: "Australia"});

Regards,

Anastasia

Thank you, Anastasia! That helps. I might also need to rebind the list of items available for selection in the dropdown from the data that is returned from the API, and not just the selected item. How do I do that?

amanthena,

Lets say you have a dropdown, which is a Country lookup, when user enters a country name you launch a web service call that returns some internal code for the country. You work with currently chosen country, but want to change others too. You can run an ESQ to the Country object when setting data for current one. When collection is returned from ESQ, you can modify it with values received from web service call.

Regards,

Anasatsia

Thank you, Anastasia! I will explore this further.

Show all comments

I've created a webservice that passes the received data from my api to a "Collection of Objects with attributes" parameter inside my business process.

I would like to know how can i convert that business process parameter to a JArray.



JArray jarray = Get("ProcessSchemaCadastros");

This is the line i have in my script task to get my data from business process parameter.

Like 0

Like

2 comments
Best reply

I found a way to pass my problem, instead of trying to convert into a JArray i used:

var entities = Get<ICompositeObjectList<ICompositeObject>>("WebService1.UsrWBCadastros_Out");

then i just worked with the data from 'entities'.

 

It's much easier to transfer a JSON from the web service to a text variable in a business process. Then parse the JSON in the business process.

I found a way to pass my problem, instead of trying to convert into a JArray i used:

var entities = Get<ICompositeObjectList<ICompositeObject>>("WebService1.UsrWBCadastros_Out");

then i just worked with the data from 'entities'.

 

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