ngForce icon indicating copy to clipboard operation
ngForce copied to clipboard

vfr not defined

Open banderson5144 opened this issue 10 years ago • 13 comments

How come when I load ngforce and I go into the Chrome console and try using vfr functions that it says its not defined?

banderson5144 avatar Jan 09 '15 16:01 banderson5144

Vfr and the associated services are, just that: angular services. You’ll need to grab ahold of the service itself in order to use them from the console. 

something like:

var vfr = angular.element('div[ng-app="pp"]').injector().get('vfr’)

where you modify the [ng-app=“pp”] selector to be the name of your app. 

then you’ll be able to access vfr

-Pkj

--  Kevin Poorman Sent with Airmail

On January 9, 2015 at 11:37:47 AM, banderson5144 ([email protected]) wrote:

How come when I load ngforce and I go into the Chrome console and try using vfr functions that it says its not defined?

— Reply to this email directly or view it on GitHub.

noeticpenguin avatar Jan 09 '15 16:01 noeticpenguin

I guess I'm just having a hard time doing a simple hello world (I.e. display a list of records). The examples that around the web are a little to advanced. Can you help me out with that.

banderson5144 avatar Jan 12 '15 16:01 banderson5144

So I figured out what my issue was. My Dev org has a namespace associated with it and you have your default Apex controller callout names hard coded (ngForceController.query). Is there a way to dynamically add a namespace?

banderson5144 avatar Jan 12 '15 21:01 banderson5144

I had the same issue where I needed a namespace.

Looking at the javascript source code, I did not see a way to dynamically add a namespace, so I ended up hardcoding it into the source code to keep the project moving forward. Basically a find/replace ngForceController to [namespace].ngForceController in the source.

Not a pretty solution, but enough to keep the project moving forward until a namespace feature is added.

mogenshoj avatar Jan 17 '15 00:01 mogenshoj

Mogenshoj, have you been able to use the remote object library? Can't seem to get it

banderson5144 avatar Jan 17 '15 00:01 banderson5144

Yes, I was able to get both remote objects and vfr queries to work. Please provide more details or code.

mogenshoj avatar Jan 17 '15 00:01 mogenshoj

I don't really have any code. Was just trying grab 10 accounts.

banderson5144 avatar Jan 17 '15 00:01 banderson5144

I was able to get all the other services working fine except remote objects

banderson5144 avatar Jan 17 '15 00:01 banderson5144

If you already created the remoteaction in a controller and return whatever you want to get out, I use something like this:

var request = vfr.send('[namespace].[controller].[action]', {}, false); request().then(function(result) { console.log(result) }, function(error) { console.log(error) });

mogenshoj avatar Jan 17 '15 00:01 mogenshoj

Yeah I have done that. I am talking about remoteobjects. Not objects returned from remote action methods.

banderson5144 avatar Jan 17 '15 00:01 banderson5144

Oh right, I misunderstood. I haven't used the remote objects, only remote actions. So I can't help with that.

mogenshoj avatar Jan 17 '15 00:01 mogenshoj

@banderson5144 are you still experiencing this issue?

noeticpenguin avatar Apr 29 '15 13:04 noeticpenguin

I am still experiencing the issue for remote objects. Error message is "Unable to invoke action 'ngForceController.getPicklistValues': no controller and/or function found". My dev org has namespace and I don't want to hard code the script with namespace. Can you please help?

snehaperiwal avatar Sep 02 '15 10:09 snehaperiwal