Support Topics Documentation Slack YouTube Blog

CustomServices.invoke does not recognize the input parameters

Backendless Version (3.x / 5.x, Online / Managed / Pro )

Online

Client SDK (REST / Android / Objective-C / Swift / JS )

JS

Application ID

53CA60C1-87D8-49ED-9374-63A251B05366

Expected Behavior

Call another custom service from a JS service using:

Backendless.CustomServices.invoke(‘CampaignService’, ‘getCampaign’, { campaignId }).then(response => console.log(response));

Should return the correct response.

Actual Behavior

Using

Backendless.CustomServices.invoke(‘CampaignService’, ‘getCampaign’, { campaignId }).then(response => console.log(response));

Returns the same response as if no “campaignId” has been passed as a parameter.

More Details

I have a Codeless service called CampaignService with a method getCampaign that accepts an input in the form of path?campaignId=some-campaign-id-here. When I test this endpoint in the business logic section with the test Id “371B83F8-360B-35A0-FF25-D09C80545A00” it works, but when invoking the same method from inside my other service GoogleAdsCampaignService (method: updateGoogleAdsCampaign), it returns as if I didn’t pass any parameter.

Parameters passed to the invoke method seems fine, logging the value it looks like this:
{ campaignId: ‘371B83F8-360B-35A0-FF25-D09C80545A00’ }

Maybe I’m missing something here on how to correctly pass parameters using the invoke method?

Thanks in advance for your help.

Hello, @rmaturi

We will investigate your problem and inform you about the result.

Regards,
Inna

We were able to reproduce your problem.
The internal ticket BKNDLSS-20340 is created, we will let you know about solution.

Regards,
Inna

Try the following solution.
When method parameter is only one, you should not pass parameter name, it is enough to pass just value:

Backendless.CustomServices.invoke(‘CampaignService’, ‘getCampaign’, ‘371B83F8-360B-35A0-FF25-D09C80545A00’)
.then(function (response) { console.log(response)})

Regards,
Inna

@Inna_Shkolnaya Hello Inna! Your suggestion works like a charm, Thank you for your help!