You need to sign in to do that
Don't have an account?
AMCDeveloper
Open CTI - Issue with RunApex API
Invoking Apex class using RunApex API.
We are able to involke the ApexClasses created by the Administrator on the development Org
We are NOT able to invoke the Apex Classes installed from a ManagedPackage on the same Org.
Does RunApex API support invoking classes installed from a ManagedPackage?
Hi,
Yes, runApex supports calling methods from a managed package. You need to follow the below syntax.
sforce.interaction.runApex('<package_NameSpace>.<ClassName>', '<MethodName>', 'param='+value, CallBackFunction);
Replace package_NameSpace, ClassName, MethodName, param & value with the exact values.
Let me know if u have any query on same and if this post helps u plz give KUDOS by clicking on the star to the left.
Thanks & Regards,
I have tried with the above format as well but it wouldn't work.
I have tried the NameSpace.ClassName.Methodname from a Test Apex Class for the same and it works fine.
global class amctest{
webService static String get123()
{
return AMCOpenCTINS.UserLoginInfo.getLoggedInUserInfo();
}
}
When I do the same using runApex, it wouldn't work.
Error "Cannot Load Apex Class: AMCOpenCTINS.UserLoginInfo"
sforce.interaction.runApex("AMCOpenCTINS.UserLoginInfo", "getLoggedInUserInfo", "", getLoginInfoCallback);
Hi,
Quick Check: if the class is declared "global" & method is declared as "webService static", you can call the Apex method using runApex.
Also check if you have included the "interaction.js" Script in your page
<apex:includeScriptvalue="/support/api/25.0/interaction.js"/>
I am able to invoke apex classes that are not part of a ManagedPaclage
Only issue is with the classes part of a managed package.
Hi,
Have you included your test page in "Call Center" settings & invoking it from there?
For Example if you VF page name is TestPage, then edit your call center URL and point to "https://c.na11.visual.force.com/apex/TestPage". Now this page will load as a SoftPhone and it will be able to execute the test you are running.
We don't use VF pages for our softphone.
We have aspx based softphone that includes open CTI API in it's java script "interaction.js" and invokes all the API calls.
All the Open CTI API calls works except runApex().
Error "Cannot Load Apex Class: AMCOpenCTINS.UserLoginInfo"
sforce.interaction.runApex("AMCOpenCTINS.UserLoginInfo", "getLoggedInUserInfo", "", getLoginInfoCallback);
While at the same time Apex class created by Administrator works fine.
sforce.interaction.runApex("amctest", "get123", "", getLoginInfoCallback);
I would like eliminate if it is my Org configuration or the Managed Package issue Or something else.
Thank you!
I am having the same issue. Adding the namespace doesn't work. If I leave it off it will work in my dev environment but then will fail when I deploy. Did you figure this out?
Ok if I include the namespace when I deploy the managed package everything works fine. If the namespace is present in my dev environment though it does not work..... What am I missing here?
My Test Org has a Namespace and have the same issue.
Issue: Open CTI API (RunApex) doesn’t work with Managed Package Apex Classes on Orgs that have a Namespace defined.
If you have issue with Managed Packages and RunApex, make sure you use an Org that doesn't have Namespace defined.