You need to sign in to do that
Don't have an account?
David Joshua
a problem with the OnClick JavaScript for this button or link was encountered : what did i do wrong ?
Hello,
I've made a custom button with some JavaScript behind which calls an API.
If anybody has a better understanding of this then me, any advice or input would be greatly appreciated !
Thanks in advance !
I've made a custom button with some JavaScript behind which calls an API.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} //alert('alert test'); var returnStatus = sforce.apex.execute("FranceOperations_RemoveStore", "resetSelectedFields", {id:"{!France_Operations__c.Id}"}); var returnSplited = returnStatus.toString().split("--"); if(returnSplited[0] != '0') { alert(returnSplited[1]); } console.log("object published after modification "+"{!France_Operations__c.Id}"); location.reload();And when I use it, here is the error that I get :
a problem with the OnClick JavaScript for this button or link was encountered : {faultcode:'soapenv:Client', faultstring:'No service available for class 'FranceOperation_RemoveStore'',}The thing is the error state 'FranceOperation_RemoveStore' but the code behind my button calls a class named "FranceOperations_RemoveStore". There is a -s after 'operation'. I am 100% sure of that since I have checked it twice. Is there some kind of basic error I am missing ? It looks like I did not connect my button properly to my class and its method. Or maybe I am missing something else ?
If anybody has a better understanding of this then me, any advice or input would be greatly appreciated !
Thanks in advance !
You class should be GLobal class as below
Here is my class :
So those are the 2 classes I use :
updateAG is used to do my POST and removeStore is called to erase data while passing through my API.
With that, I think you have it all.
Basically, what I need to do is to click on that button. The button will call an API and datas will be updated on some server. Then when this update is done, fields in my sObject(s) in SalesForce will be cleared too.
Here are the tracks I have followed to solve my issue :
- with sharing / without sharing: not relevant here.
- global/public : not relevant either. The class called is already set on global.
- namespace : though I thought that might be the reason of my error, my colleague told me we have no namespace so...
- package : the current track I am following.