0 votes
1.3k views
in Coach Views by

1 Answer

0 votes
by (16.3k points)

You will define a service in the coach view and create equivalent config options as per the default service inputs, in the load behaviour section code similar to this will work

The areas highlighted in bold will be specific to your implementation, the number of inputs should match the number of service inputs and param identifiers should be exact else service call will fail, in var input we are basically defining an array of inputs with labels and values

var _this = this;
var input = {RESTAPIUsername: this.context.options.RESTAPIUsername.get("value"), RESTAPIPassword: this.context.options.RESTAPIPassword.get("value"), EnvironmentHostname: this.context.options.EnvironmentHostname.get("value"), EnvironmentPort: this.context.options.EnvironmentPort.get("value")};
var serviceArgs = {
  params: JSON.stringify(input),
  load: function(data) {
console.log("service returned: ", data);  
    require(["dojo/_base/url"], function(url) {

//Do something you want wi the data heree by using data.someparam notation e.g. here we are setting the image data to a html string and updating the binding
    var imghtml = "<img alt='Embedded Image' src='data:image/png;base64," + data.imagedata + " ' />"  
    _this.context.binding.set("value", imghtml);

    });
  },
  error: function(e) {console.log("service call failed: ", e);}

this.context.options.UserImageRetrievalService(serviceArgs);

Related questions

0 votes
1 answer 583 views
0 votes
1 answer 715 views
0 votes
0 answers 384 views
0 votes
1 answer 417 views
0 votes
1 answer 255 views
0 votes
0 answers 480 views
0 votes
1 answer 458 views
0 votes
1 answer 325 views
+1 vote
0 answers 411 views

634 questions

495 answers

97 comments

2.7k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...