0 votes
282 views
in Coach Views by

1 Answer

0 votes
by (13k 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
0 answers 49 views
0 votes
0 answers 62 views
0 votes
1 answer 23 views
0 votes
1 answer 14 views
0 votes
1 answer 58 views
+1 vote
0 answers 86 views
...