Cannot access iparams during request

In order to make an external request from the app, I am using client.request.invoke to call a server method to create and handle the request. My understanding is that the iparams are appended to the options parameter and this seems to work in local testing and as a private app.

However in the current published version and during QA testing calling options.iparams.param_key seems to be failing. Is there a better way to access iparams during a POST request?

Hi Noah,

Welcome to the forum :wave: ! Can you share the code snippet that you are using to access the iparams and the iparams file ?

Also you can refer this post that speaks a bit about how normal or secure iparams behave in code :arrow_down:

from app.js

function startPerformConnectWiseControlServiceCall(methodName, argumentKeys, onSuccess, onFailure) {
var options = {
    method: methodName,
    body: window.generateConnectWiseControlPostData(argumentKeys)

client.request.invoke("performConnectWiseControlServiceCall", options)
    .then(function (data) {
        // data.message, data.requestID, data.status
    .catch(function (error) {


from server.js

performConnectWiseControlServiceCall: function (options) {

	var requestParameters = {
		headers: {
			"Content-Type": "application/json",
			"X-Api-Token": options.iparams.cwControl_api_token
		url: options.iparams.cwControl_url + '/App_Extensions/bed9fea9-752d-410f-a85e-e247f2ee42af/Service.ashx/' + options.method,
		body: options.body

I am confident the parameter names are correct since this works during local testing

Thanks @Noah can you also share the iparams.json file ?

      "cwControl_url": {
      "display_name": "ConnectWise Control Url",
      "description": "Please enter the url for your ConnectWise Control instance, e.g. 
     "type": "text",
     "required": true
    "cwControl_api_token": {
    "display_name": "ConnectWise Control API Token",
   "description": "Please enter your ConnectWise Control API token",
   "type": "text",
   "required": true,
   "secure": true
    "freshdesk_whitelabel": {
    "display_name": "Freshdesk White-label Text",
    "description": "Optional text to replace reference to 'Freshdesk' in guest invitation email. Defaults to 'Freshdesk'.",
    "type": "text",
    "required": true

I can observe that cwControl_api_token is a secure iparam. Secure iparams should ideally be accessed via iparam templating. Can you use <%= iparam.cwControl_api_token %> instead of directly accessing?

For example, inside the headers object, you could access the iparams like so, (assuming that you are making use of Request method

Let me know if it worked

I tried changing to using that instead of accessing the iparams from the options object and I got the string “<%= iparam.cwControl_api_token %>” as the token. However getting the url this way did work.

headers: {
			"Content-Type": "application/json",
			"X-Api-Token": '<%= iparam.cwControl_api_token %>',

unless I did something wrong here

I played with how I was making the requests and embedding the iparams like this did work.

Thank you

1 Like

That’s great to hear @Noah Pl. feel free to share the challenges you faced in getting it right. We’ll be happy to take it as feedback for docs/feature :slight_smile: !