ccoenraets / forceng Goto Github PK
View Code? Open in Web Editor NEWMicro-Library to use Salesforce REST API in AngularJS apps
License: MIT License
Micro-Library to use Salesforce REST API in AngularJS apps
License: MIT License
When using force.getUserID() on ionic it was not able to find oaurth.id and would crash the app.
I have fixed it in my copy by modifying the loginWithPlugin() function to pass the userId from creds returned getAuthCredentials into Init and adding it to the oaurth object.
I now have a userId item in oauth that can be used in the getUserId() function.
Is there a way to have two requests fired in parallel? Currently when I send two requests, the defer function for the second request is the one that is handling the response from the first request.
force.query(query_one).then(
function (response_one) {
handleResponse(response_one);
});
force.query(query_two).then(
function (response_two) {
handleResponse(response_two);
});
I am trying to login to a community via the simulator or actual device. When I run force-server and login via the browser, everthing works fine but in the simulator context I get a page not found error:
I have changed the loginURL in forceng.js:
var loginURL = 'https://mycommunity.force.com/',
my proxyURL is localhost:8200... does this need to be something else for the simulator?
Hey, I have tried you app using force-server and it runs perfectly, great tutorial. However, I am trying to run your app on an Android device, but it opens up to a blank screen and the code stops at the oauthPlugin = cordova.require("com.salesforce.plugin.oauth"); line. Now I don't believe this is an issue on your part, as it seems more of a problem with my configuration of cordova. But have you come across this issue before or have any possible solutions?
Thanks!
Does forceng.js support angular4 app as well or do we need to convert it into forceng.ts file?
all functions related to blobs that can be found on forceTK... are not available on forceng:
blob = function (path, fields, filename, payloadField, payload, callback, error, retry)
createBlob = function (objtype, fields, filename,
payloadField, payload, callback,
error, retry)
updateBlob = function (objtype, id, fields, filename,
payloadField, payload, callback,
error, retry)
Please add a license somewhere to your repository and/or your library source so that users can be sure they are using your library in accordance with the terms you want.
I've noticed that sometimes when I am performing some action when a promise comes back from some kind of request - it is possible that the request will hand back a promise that does not belong to the current request (the one I expect will be evaluated). For example:
return force.query('SELECT Id, FROM PricebookEntry').then(function(response) {
pricebookentries = response.records;
});
return force.query('SELECT Id, FROM Account').then(function(response) {
accounts = response.records;
});
If I perform these two queries in parallel - I have seen times where the response callback for the Account query will return the results from the PricebookEntry query. It's like the wires are getting crossed. I got around the problem by doing each successive call in a .then() block but that doesn't seem ideal.
Looking at the forceng source - I see this in the code:
function request(obj) {
if (!oauth || (!oauth.access_token && !oauth.refresh_token)) {
deferred.reject('No access token. Login and try again.');
return;
}
var method = obj.method || 'GET',
headers = {},
url = getRequestBaseURL();
deferred = $q.defer();
Notice that the deferred is defined as a window variable (not var). So the deferred is actually shared across requests, which is interesting - and looks to be by design. Can you explain if this is the case and it is indeed supposed to operate like that? And if so, how to best perform multiple asynchronous requests without worrying about getting information for another request during promise resolve?
Thanks!
@ccoenraets is this going to be updated to match the salesforce 7.0, or does this project is already dropped?
thanks
Hi, can we please update this repo to match the latest SalesforceCordova SDK 5.1.0 ?
There is a small bug in request function - it's fixed on my fork.
('deffer' might throw undefined errors in some circumstances)
refreshToken() should be treated as defer - in error function of http.request is treated as $http.
when I use browser with proxy it`s working fine and able to login to app with browser plugin.but when I am build my app and try to open in Android it shows empty screen instead of login screen with out any exception.
did i miss any thing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.