• ZHANG XING
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am attempting to complete the aforementioned trailhead step on a Windows 10 machine. When I attempt to test the setup via sfdx force:auth:jwt:grant, I get the following error:

This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - user hasn't approved this consumer

When it gives the error, SFDX provides a list of possible issues to check for. I have done so repeatedly. I have gone through the Trailhead step backwards and forwards. Every other part seems to work just fine. This part does not. Unfortuntely the Google results haven't really been all that helpful, so now I turn to you oh great and powerful forum. What do you say?
Hi there, The below script works well on case list views. however the problem is with the refresh, after the page refresh list view changes to something else. It not showing the selected list view, instead it's showing the first view or random(not sure). 

Is there way to update records, refresh the list view and select the same list view ? 

{!REQUIRESCRIPT("/soap/ajax/34.0/connection.js")} 

var records = {!GETRECORDIDS($ObjectType.Case)}; 
var newRecords = []; 

if (records[0] == null) 

alert("Please select at least one row") 

else 

for (var n=0; n<records.length; n++) { 
var c = new sforce.SObject("Case"); 
c.id = records[n]; 
c.Status = "Canceled"; 
c.ownerid='{!$User.Id}'; 
newRecords.push(c); 


result = sforce.connection.update(newRecords); 
window.location.reload(); 
}
 

Hello

 

I'm having an issue rerendering a pageblocktable after a record is inserted via a simple modal javascript/visualforce form. The strange thing is that I can see that the method that populates the table is called after the insert (I've checked the debug log) and that the number of rows returned is 1 more than before the insert. If I refresh the page it displays the record. The code follows:

 

VisualForce

 

<apex:page controller="RecipeController"> <!-- Javascript removed to ease readability --> <!-- datatable with list --> <apex:sectionHeader title="Recipes"/> <apex:form > <apex:actionStatus id="status" startText="Updating..."></apex:actionStatus> <apex:pageBlock title="Current Recipes" id="recipeList"> <apex:pageblocktable value="{!recipes}" var="recipe"> <apex:column > <apex:facet name="header">Name</apex:facet> <apex:outputfield value="{!recipe.name}"/> </apex:column> <apex:column > <apex:facet name="header">Short Description</apex:facet> <apex:outputfield value="{!recipe.ShortDescription__c}"/> </apex:column> <apex:column > <apex:facet name="header">Rating</apex:facet> <apex:outputfield value="{!recipe.Rating__c}"/> </apex:column> </apex:pageblocktable> <apex:pageblockbuttons location="top"> <apex:commandButton value="New" onComplete="YAHOO.recYippee.showMe();" rerender="recipeEdit"/ > <apex:commandbutton value="Refresh" status="status"/> </apex:pageblockbuttons> </apex:pageBlock> </apex:form> <!-- Modal window opened by javascript --> <div id="EditNew" style="display: none" > <div class="hd"> <apex:outputText value="Recipe Details" /> </div> <div class="bd"> <apex:actionregion > <apex:form id="RecipeEdit"> <apex:pageBlock title="List of stored recipes"> <apex:pageblocksection > <apex:inputField value="{!r.name}"/> <apex:inputField value="{!r.ShortDescription__c}" /> <apex:inputField value="{!r.Ingredients__c}" /> <apex:inputField value="{!r.CookingInstructions__c}" /> <apex:inputField value="{!r.CostPerPerson__c}" /> </apex:pageblocksection> <apex:pageblockButtons location="bottom"> <apex:commandButton value="Save" action="{!saveRecipe}"/> <apex:commandButton value="Cancel" immediate="true" oncomplete="YAHOO.recYippee.hideMe();" /> </apex:pageblockButtons> </apex:pageBlock> </apex:form> </apex:actionregion> </div> <div class="ft" style="font-size: 10px;"> <apex:outputPanel layout="block"> Please click the 'Save' button to store the recipe or cancel to return to the previous page. </apex:outputPanel> </div> </div> </apex:page>

 

 Apex Code

 

public class RecipeController{ private Recipe__c recipe = new Recipe__c(); private List<Recipe__c> recipes = new List<Recipe__c>(); public Recipe__c r{get{return recipe;}set{recipe=value;}} public RecipeController(){} public List<Recipe__c> getRecipes(){ recipes = [SELECT name, shortDescription__c, rating__c, costPerPerson__c, cookingInstructions__c, ingredients__c FROM recipe__c]; return recipes; } public void setRecipes(){} public PageReference SaveRecipe(){ upsert r; return null; } }

 

The javascript is not the issue, as I've used it in other places and it works fine. Any ideas?