Global Action not working

  • 1
  • Problem
  • Updated 3 years ago
I have created a global action on a table. The action calls a snippet which I have defined in the Resources tab. When I click on the Action button, nothing seems to happen. I have also added an alert() code in the snippet to check if the snippet gets called at all. But nothing happens. Any suggestions to solve this problem? 

Thanks in advance
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Goutham J

Goutham J

  • 568 Points 500 badge 2x thumb
Can you click on "F12" and look at console. Is it throwing any error?

Thanks,
Goutham
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb
I opened the console with cmd + Space --> console. I cannot see any errors thrown in the console window.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Checking a simple thing: make sure the name of your snippet is the same as the name that you entered in the global action settings.
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb
Thanks for the suggestion Matt. It is the same name. In fact, I just copied the name of the snippet and pasted it in the global action settings. No change to the result. 
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Hi Namrata,

What is the "Resource Location" property set to on your snippet? Also, can you paste the actual contents of your snippet?
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb
Ben,

Resource Location Property is In-Line(Snippet). Here is the content of the snippet. The alert code is there to check if the Snippet gets called. The snippet calls fetches data from Yodlee and saves it in application model.

var appModel = skuid.model.getModel('applicationYod');
var appRow = appModel.data[0];
alert("callYodlee Snippet called");
var result = sforce.apex.execute('SkuidYodleeCallCtrl','doYodleeCallForParty',
    {   
        applicationId : appRow.Id,
        partyId : appRow.Contact__c
    });

alert(result);
window.location.reload();

Thanks,
Namrata
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Hmm, everything looks totally fine to me. I'm baffled if you're not getting any javascript errors. Can you grant login access to skuid following these instructions?
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb
sure I can do that.. I am uploading a screen shot. After I read your comment, I opened Inspect element --> console and I see these errors...I had opened the CMD + SPACE --> console, but that didn't give any errors.

Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
var appModel = skuid.model.getModel('applicationYod');

That line is returning null. Make sure you have a model named 'applicationYod'

Also, in general, .getFirstRow() is better than .data[0]
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,470 Points 10k badge 2x thumb
Yeah Matt is right, can't read property 'data' of undefined most likely means your getModel call is not returning a model. Make sure your 'applicationYod' is the exact, case sensitive name of your model.
Photo of Namrata

Namrata

  • 332 Points 250 badge 2x thumb
Thank you for the suggestion Matt. The snippet gets called. But now it throws another error.

Uncaught TypeError: Cannot read property 'push' of undefined

XMLHttpRequest cannot load https://na34.salesforce.com/_ui/common/request/servlet/JsLoggingServlet. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://genesisextn.na34.visual.force.com' is therefore not allowed access.

What should I look at to resolve this issue? Thanks again for your comments.