I recently had a javascript onclick event stop firing on my visualforce page. The strange thing is that there have not been any changes made to the page or the object related to the event.

Here is the page script:

<apex:includeScript value="https://service.apsona.com/sfdc/apsona_inline.min.js"/>
<script type="text/javascript">
// hack that prevents Salesforce from always putting focus
// on the first date field
window.onload = function() { }
// script to make sure Apsona has session ID
sforce.connection.sessionId = "{!$Api.Session_ID}";
// Test added 6/23/2016 by Sridhar, ---@---.com
sforce.connection.serverUrl = UserContext.siteUrlPrefix + sforce.connection.serverUrl; 
// For Apsona Merge Action (Cash Control Form link in VIP Attendees section) added by Michelle Regal @nimadmin on 6/27/2016
function callApsona(){
    apsona.runAction ('buttonMerge', { 
            'element': this,
            'actionId': 'a2OF0000002GRXhMAO', 
            'recordId': '{!Campaign.Id}', 
            'linkFieldId': 'Id'                 


And here is the code that calls the script:

<span onclick="callApsona();return false;" style="text-decoration:underline;">Cash Control Form</span>

When I click the text, the page refreshes, but nothing else happens. Here's the error that comes up when I use Chrome developer tools:

Developer Tools Errors

So it looks like the script to capture the Salesforce session ID isn't firing correctly. Any idea why this would suddenly stop working (on 3/9)?

  • 2
    The problem with external script is that it can be updated. This is why it's better to use static resource. Could it be possible that apsona_inline.min.js file has been updated? Mar 13 '17 at 13:13
  • @MartinLezer I've been assured that the file has not been updated. The script is connected with a managed package. Mar 13 '17 at 13:23
  • I can think of three issues :- 1. As it is a an managed package, some configuration might have been changed? 2. Does it require any key, because it says, 'apsona_key' of undefined. 3. License of package not expired?
    – Raul
    Mar 13 '17 at 13:27

Thanks for the suggestions, everyone. As it turns out, there was an error with the apsona_inline.min.js file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.