• ajay varma
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Salesforce removed support for nooverride =1 in Lightning for winter 17, which is causing a recursive loop whenever I try to navigate to Standard object(Account) from Search List view. Its entering Loop as I've overriden View Button to point to VisualForce page.
 (I've created a Visualforce page that has an extension controller that returns a page reference to point to a URL).
I've tried sforce.one.NavigateToSobject, NavigateToUrl and all other navigation methods, but the problems is Lightning is not accepting
Nooverride as parameter in Winter 17 (Everything works fine in Summer 16)

It would be helpful if anyone can point me in right direction for Winter 17.

 
I'm having trouble rendering angularjs with the below code 

APex COntroller Code:
 
global class ApexRemoteInvokeManagerController {

    public ApexRemoteInvokeManagerController() {

    }
    
    public ApexRemoteInvokeManagerController(ApexPages.StandardController controller)
    {
  
    }
    
    @RemoteAction
    global static void saveAccountWithContact(String contactJson,String accountJson)
    {
       Account a = (Account)JSON.deserialize(accountJson,Account.class);
       insert a;
       Contact c = (Contact)JSON.deserialize(contactJson, Contact.class);
       c.AccountId = a.Id;
       upsert c;
    }
    
}

VisualForce Page as well as AngularJs
 
<apex:page controller="ApexRemoteInvokeManagerController"    
 docType="html-5.0" sidebar="false">
 <html>
 <head>
  <link href="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-   
beta.6/css/bootstrap-namespaced.css" rel="stylesheet"/>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-   
beta.11/angular.min.js"></script>
  <script>
   var accountApp = angular.module('accountApp',[]);
      accountApp.factory('accountAndContactsFactory', ['$q',   
'$rootScope', function($q, $rootScope) {
        this.save =  function() {
            var deferred = $q.defer();
            var contactJson = JSON.stringify(contact);
            var accountJson = JSON.stringify(account);
            Visualforce.remoting.Manager.invokeAction(

'ApexRemoteInvokeManagerController.saveAccountWithContact',
            contactJson,
            accountJson,
            function(result, event) {
                $rootScope.$apply(function() {
                  if (event.status) {
                    deferred.resolve(result);
                  } else {
                    deferred.reject(event);
                  }
                })
            },
            { buffer: true, escape: true, timeout: 30000 }
        );

        return deferred.promise;
    }

}]);


 accountApp.controller('MainController',function($scope,
'accountAndContactsFactory',function($scope,   
accountAndContactsFactory))
 {

  $scope.save = function(contact,account){

accountAndContactsFactory.save(contact,account).then(function(result) 
               {$scope.message = "success";},
         function(error) {$scope.message = "wrong";}
          )
    }
 });

 </script>  
 </head>
 <body>  
<div class="bootstrap" ng-app="accountApp" ng-   
controller="MainController">
<form name="simpleForm" novalidate="novalidate">
    <table>
    <tr>
        <td>First Name:</td><td><input type="text" name="FirstName" ng-  
model="contact.FirstName"/></td>
    </tr>
    <tr>
        <td>Last Name:</td><td><input type="text" required="true"   
name="LastName" ng-model="contact.LastName"/>
        <span class="error" ng-  
show="simpleForm.LastName.$error.required">Required!</span></td>
    </tr>
    <tr>
        <td>Business Name:</td><td><input type="text" required="true"   
name="BusinessName" ng-model="account.Name"/>
    <span class="error" ng-
show="simpleForm.BusinessName.$error.required">Required!</span></td>
    </tr>
     <tr>
       {{message}}
    </tr>
    <tr>
       <input type="button" ng-click="save(contact,account)" ng-  
disabled="simpleForm.$pristine || simpleForm.$dirty &&   
simpleForm.$invalid"     value="Save"/>
      </tr>
      </table>

      </form>
   </div>
   </body>
   </html>
   </apex:page>

I have tried several options like using Visualforce merge fields for remoting,  removal of html tags.. and all but the above code is not detecting angularjs and nothing execution of code happens.

Please suggest.
I'm facing an issue while working with Visualforce remoting and angularjs. Whenever I'm putting my controller code in separate js Static resource, my code doesn't work. Please help me in figuring out this. ( Below code works if i include controller script in same VF page)

My Visualforce page
   
<apex:page controller="ApexRemoteActionPageController" docType="html-5.0">
<html>
<body>
 <div class="bootstrap" ng-app="ngApp" ng-controller="ContactCtrl" >

 <h1 align="center">Click The Button</h1>
 <button ng-click="getContacts()" class="btn btn-lg btn-default btn-block">Get Contacts</button> 

 <p>
 <ul>
 <li id="{{current.Id}}" ng-repeat="current in contacts" ng-class-even="'rowEven'">{{current.Name}}</li>
 </ul>
 </p>
</div>
<apex:stylesheet value="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-beta.6/css/bootstrap-namespaced.css"/>
 <apex:includeScript value="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"/>
 <apex:includeScript value="{!$Resource.ContactCtrl}" />
</body>
</html>
</apex:page>

My Controller Static Resource
 
<script>
var ngApp= angular.module("ngApp", []); 
 ngApp.controller("ContactCtrl", ["$scope", function($scope) 
                                 {
                                  $scope.contacts = [];
                                  $scope.getContacts = function() {
               ApexRemoteActionPageController.myContacts(function(result, event) {
               $scope.contacts = result;
               $scope.$apply();
});
}
}]);
</script>

My Apex Controller
 
global class ApexRemoteActionPageController {
@RemoteAction
global static List<Contact> myContacts() 
{
   return [select id, name, email from Contact Order By LastModifiedDate DESC LIMIT 30];
}

 
I'm having trouble rendering angularjs with the below code 

APex COntroller Code:
 
global class ApexRemoteInvokeManagerController {

    public ApexRemoteInvokeManagerController() {

    }
    
    public ApexRemoteInvokeManagerController(ApexPages.StandardController controller)
    {
  
    }
    
    @RemoteAction
    global static void saveAccountWithContact(String contactJson,String accountJson)
    {
       Account a = (Account)JSON.deserialize(accountJson,Account.class);
       insert a;
       Contact c = (Contact)JSON.deserialize(contactJson, Contact.class);
       c.AccountId = a.Id;
       upsert c;
    }
    
}

VisualForce Page as well as AngularJs
 
<apex:page controller="ApexRemoteInvokeManagerController"    
 docType="html-5.0" sidebar="false">
 <html>
 <head>
  <link href="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-   
beta.6/css/bootstrap-namespaced.css" rel="stylesheet"/>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-   
beta.11/angular.min.js"></script>
  <script>
   var accountApp = angular.module('accountApp',[]);
      accountApp.factory('accountAndContactsFactory', ['$q',   
'$rootScope', function($q, $rootScope) {
        this.save =  function() {
            var deferred = $q.defer();
            var contactJson = JSON.stringify(contact);
            var accountJson = JSON.stringify(account);
            Visualforce.remoting.Manager.invokeAction(

'ApexRemoteInvokeManagerController.saveAccountWithContact',
            contactJson,
            accountJson,
            function(result, event) {
                $rootScope.$apply(function() {
                  if (event.status) {
                    deferred.resolve(result);
                  } else {
                    deferred.reject(event);
                  }
                })
            },
            { buffer: true, escape: true, timeout: 30000 }
        );

        return deferred.promise;
    }

}]);


 accountApp.controller('MainController',function($scope,
'accountAndContactsFactory',function($scope,   
accountAndContactsFactory))
 {

  $scope.save = function(contact,account){

accountAndContactsFactory.save(contact,account).then(function(result) 
               {$scope.message = "success";},
         function(error) {$scope.message = "wrong";}
          )
    }
 });

 </script>  
 </head>
 <body>  
<div class="bootstrap" ng-app="accountApp" ng-   
controller="MainController">
<form name="simpleForm" novalidate="novalidate">
    <table>
    <tr>
        <td>First Name:</td><td><input type="text" name="FirstName" ng-  
model="contact.FirstName"/></td>
    </tr>
    <tr>
        <td>Last Name:</td><td><input type="text" required="true"   
name="LastName" ng-model="contact.LastName"/>
        <span class="error" ng-  
show="simpleForm.LastName.$error.required">Required!</span></td>
    </tr>
    <tr>
        <td>Business Name:</td><td><input type="text" required="true"   
name="BusinessName" ng-model="account.Name"/>
    <span class="error" ng-
show="simpleForm.BusinessName.$error.required">Required!</span></td>
    </tr>
     <tr>
       {{message}}
    </tr>
    <tr>
       <input type="button" ng-click="save(contact,account)" ng-  
disabled="simpleForm.$pristine || simpleForm.$dirty &&   
simpleForm.$invalid"     value="Save"/>
      </tr>
      </table>

      </form>
   </div>
   </body>
   </html>
   </apex:page>

I have tried several options like using Visualforce merge fields for remoting,  removal of html tags.. and all but the above code is not detecting angularjs and nothing execution of code happens.

Please suggest.
I'm facing an issue while working with Visualforce remoting and angularjs. Whenever I'm putting my controller code in separate js Static resource, my code doesn't work. Please help me in figuring out this. ( Below code works if i include controller script in same VF page)

My Visualforce page
   
<apex:page controller="ApexRemoteActionPageController" docType="html-5.0">
<html>
<body>
 <div class="bootstrap" ng-app="ngApp" ng-controller="ContactCtrl" >

 <h1 align="center">Click The Button</h1>
 <button ng-click="getContacts()" class="btn btn-lg btn-default btn-block">Get Contacts</button> 

 <p>
 <ul>
 <li id="{{current.Id}}" ng-repeat="current in contacts" ng-class-even="'rowEven'">{{current.Name}}</li>
 </ul>
 </p>
</div>
<apex:stylesheet value="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-beta.6/css/bootstrap-namespaced.css"/>
 <apex:includeScript value="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"/>
 <apex:includeScript value="{!$Resource.ContactCtrl}" />
</body>
</html>
</apex:page>

My Controller Static Resource
 
<script>
var ngApp= angular.module("ngApp", []); 
 ngApp.controller("ContactCtrl", ["$scope", function($scope) 
                                 {
                                  $scope.contacts = [];
                                  $scope.getContacts = function() {
               ApexRemoteActionPageController.myContacts(function(result, event) {
               $scope.contacts = result;
               $scope.$apply();
});
}
}]);
</script>

My Apex Controller
 
global class ApexRemoteActionPageController {
@RemoteAction
global static List<Contact> myContacts() 
{
   return [select id, name, email from Contact Order By LastModifiedDate DESC LIMIT 30];
}

 
Salesforce removed support for nooverride =1 in Lightning for winter 17, which is causing a recursive loop whenever I try to navigate to Standard object(Account) from Search List view. Its entering Loop as I've overriden View Button to point to VisualForce page.
 (I've created a Visualforce page that has an extension controller that returns a page reference to point to a URL).
I've tried sforce.one.NavigateToSobject, NavigateToUrl and all other navigation methods, but the problems is Lightning is not accepting
Nooverride as parameter in Winter 17 (Everything works fine in Summer 16)

It would be helpful if anyone can point me in right direction for Winter 17.

 
I'm having trouble rendering angularjs with the below code 

APex COntroller Code:
 
global class ApexRemoteInvokeManagerController {

    public ApexRemoteInvokeManagerController() {

    }
    
    public ApexRemoteInvokeManagerController(ApexPages.StandardController controller)
    {
  
    }
    
    @RemoteAction
    global static void saveAccountWithContact(String contactJson,String accountJson)
    {
       Account a = (Account)JSON.deserialize(accountJson,Account.class);
       insert a;
       Contact c = (Contact)JSON.deserialize(contactJson, Contact.class);
       c.AccountId = a.Id;
       upsert c;
    }
    
}

VisualForce Page as well as AngularJs
 
<apex:page controller="ApexRemoteInvokeManagerController"    
 docType="html-5.0" sidebar="false">
 <html>
 <head>
  <link href="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-   
beta.6/css/bootstrap-namespaced.css" rel="stylesheet"/>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-   
beta.11/angular.min.js"></script>
  <script>
   var accountApp = angular.module('accountApp',[]);
      accountApp.factory('accountAndContactsFactory', ['$q',   
'$rootScope', function($q, $rootScope) {
        this.save =  function() {
            var deferred = $q.defer();
            var contactJson = JSON.stringify(contact);
            var accountJson = JSON.stringify(account);
            Visualforce.remoting.Manager.invokeAction(

'ApexRemoteInvokeManagerController.saveAccountWithContact',
            contactJson,
            accountJson,
            function(result, event) {
                $rootScope.$apply(function() {
                  if (event.status) {
                    deferred.resolve(result);
                  } else {
                    deferred.reject(event);
                  }
                })
            },
            { buffer: true, escape: true, timeout: 30000 }
        );

        return deferred.promise;
    }

}]);


 accountApp.controller('MainController',function($scope,
'accountAndContactsFactory',function($scope,   
accountAndContactsFactory))
 {

  $scope.save = function(contact,account){

accountAndContactsFactory.save(contact,account).then(function(result) 
               {$scope.message = "success";},
         function(error) {$scope.message = "wrong";}
          )
    }
 });

 </script>  
 </head>
 <body>  
<div class="bootstrap" ng-app="accountApp" ng-   
controller="MainController">
<form name="simpleForm" novalidate="novalidate">
    <table>
    <tr>
        <td>First Name:</td><td><input type="text" name="FirstName" ng-  
model="contact.FirstName"/></td>
    </tr>
    <tr>
        <td>Last Name:</td><td><input type="text" required="true"   
name="LastName" ng-model="contact.LastName"/>
        <span class="error" ng-  
show="simpleForm.LastName.$error.required">Required!</span></td>
    </tr>
    <tr>
        <td>Business Name:</td><td><input type="text" required="true"   
name="BusinessName" ng-model="account.Name"/>
    <span class="error" ng-
show="simpleForm.BusinessName.$error.required">Required!</span></td>
    </tr>
     <tr>
       {{message}}
    </tr>
    <tr>
       <input type="button" ng-click="save(contact,account)" ng-  
disabled="simpleForm.$pristine || simpleForm.$dirty &&   
simpleForm.$invalid"     value="Save"/>
      </tr>
      </table>

      </form>
   </div>
   </body>
   </html>
   </apex:page>

I have tried several options like using Visualforce merge fields for remoting,  removal of html tags.. and all but the above code is not detecting angularjs and nothing execution of code happens.

Please suggest.
I'm facing an issue while working with Visualforce remoting and angularjs. Whenever I'm putting my controller code in separate js Static resource, my code doesn't work. Please help me in figuring out this. ( Below code works if i include controller script in same VF page)

My Visualforce page
   
<apex:page controller="ApexRemoteActionPageController" docType="html-5.0">
<html>
<body>
 <div class="bootstrap" ng-app="ngApp" ng-controller="ContactCtrl" >

 <h1 align="center">Click The Button</h1>
 <button ng-click="getContacts()" class="btn btn-lg btn-default btn-block">Get Contacts</button> 

 <p>
 <ul>
 <li id="{{current.Id}}" ng-repeat="current in contacts" ng-class-even="'rowEven'">{{current.Name}}</li>
 </ul>
 </p>
</div>
<apex:stylesheet value="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-beta.6/css/bootstrap-namespaced.css"/>
 <apex:includeScript value="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"/>
 <apex:includeScript value="{!$Resource.ContactCtrl}" />
</body>
</html>
</apex:page>

My Controller Static Resource
 
<script>
var ngApp= angular.module("ngApp", []); 
 ngApp.controller("ContactCtrl", ["$scope", function($scope) 
                                 {
                                  $scope.contacts = [];
                                  $scope.getContacts = function() {
               ApexRemoteActionPageController.myContacts(function(result, event) {
               $scope.contacts = result;
               $scope.$apply();
});
}
}]);
</script>

My Apex Controller
 
global class ApexRemoteActionPageController {
@RemoteAction
global static List<Contact> myContacts() 
{
   return [select id, name, email from Contact Order By LastModifiedDate DESC LIMIT 30];
}