Getting Type error while invoking request template

Hi @kaustavdm , @zach_jones_noel

I updated my fdk version into 9.0.0 recently so i changed my request api call as per request method documentation but i’m getting TypeError: client.request.invokeTemplate is not a function can anyone help me to solve this

Request.json

manifest.json

app.js

Error

Thank you

Hey @Kithiyon,

Good day to you!

client.request.invokeTemplate() is part of the client JS which is imported in front-end HTML files. You would have to migrate from

<script src="https://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>

to

<script src="{{{appclient}}}"></script>

You can see the migration guide docs - App code changes section which talks about this in the third point.

This should address the error. Let us know if this helped!

Hey @zach_jones_noel
I had the same issue aswell and only after screening the migration guide the third time, I have found the missing part.

I now see, that I am not alone, so could this part maybe get a bit highlighted in the guide?
Would help to resolve similar questions coming in.

Best
Tom

2 Likes

Thank you @zach_jones_noel

I changed my script file as per documentation. i replaced my <script src="https://static.freshdev.io/fdk/2.0/assets/fresh_client.js"></script>

with

<script src="{{{appclient}}}"></script>

in my index.html file but now i’m getting app is not defined error.

app.js

error

Thanks @ThomasH for your feedback!

@Kithiyon for bring this to our notice, @Developer-Platform can you chime in to help about app is not defined error?

Hi @Kithiyon ,
I would need some more info to debug this further.

Can you please share the code for your index.html?

Also, can you check in the chrome dev tools whether <script src="{{{appclient}}}"></script> is getting replaced by <script src="https://cdn.freshdev.io/assets/app-client@2.js"></script> at runtime during fdk run?

Thanks!

Thank you @Asif

Now i’m able to invoke my requestTemplate from my app.js. I don’t know how it was solved.