Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ({
- doInit : function(component, event){
- var action = component.get("c.getStatus");
- var currentId = component.get("v.recordId");
- action.setParams({
- recordId : currentId
- });
- console.log(currentId);
- action.setCallback(this, function(response){
- var state = response.getState();
- if (component.isValid() && state === "SUCCESS"){
- $A.log(response);
- component.set("v.currentStep", response.getReturnValue());
- }
- else {
- console.log("Failed with state" + state);
- }
- })
- $A.enqueueAction(action);
- },
- onStepChange : function(component, event) {
- var action = component.get("c.saveStatus");
- var currentId = component.get("v.recordId");
- action.setParams({
- recordId : currentId
- });
- action.setCallback(this, function(response){
- var state = response.getState();
- if(component.isValid() && state === "SUCCESS"){
- var currentStep = component.get("v.currentStep");
- component.set(currentStep, response.getReturnValue());
- }
- else {
- console.log("Failed with state" + state);
- }
- })
- $A.enqueueAction(action)
- }})
- public with sharing class ApexController {
- @AuraEnabled
- public static list<Object__c> getStatus(Id recordId){
- return[SELECT Id, status__c FROM Object__c WHERE Id=:recordId];
- }
- @AuraEnabled
- public static Object__c saveStatus(Object__c newStatus){
- upsert newStatus;
- return newStatus;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement