0

I am trying to tweak a custom lightning component a third-party developer created in our org.

Current code below:

 * This downloads the current student budget from the backend and kicks off
 * the processing of all the data.
 */
getStudentBudget: function(cmp, ev, helper) {
    var action = cmp.get('c.getStudentBudget');

    action.setCallback(this, function(a) {
        var ret = a.getReturnValue();

        if (ret) {                
            cmp.set('v.budgetForm', ret);
            cmp.set('v.showLaunchButton', true);
            helper.updateTerms(cmp);
            helper.isStepValid(cmp, ev, helper);
            helper.processTransportationTypes(cmp, helper);
            helper.populateFinancialAid(cmp, helper);
        }
    });

    $A.enqueueAction(action);
},

Currently, variable "v.showLuanchButton" is being set to TRUE based on whether a certain field on the "StudentBudget" record is checked off or not. I want to change which field is being considered for that change.

What I'm imagining is something like this:

 * This downloads the current student budget from the backend and kicks off
 * the processing of all the data.
 */
getStudentBudget: function(cmp, ev, helper) {
    var action = cmp.get('c.getStudentBudget');

    action.setCallback(this, function(a) {
        var ret = a.getReturnValue();

        if (ret) {                
            cmp.set('v.budgetForm', ret);

*************************NEW PART HERE***************************
              if (Boolean_field_I_want__c) {
                  cmp.set('v.showLaunchButton', true);
              }
*****************************************************************

            helper.updateTerms(cmp);
            helper.isStepValid(cmp, ev, helper);
            helper.processTransportationTypes(cmp, helper);
            helper.populateFinancialAid(cmp, helper);
        }
    });

    $A.enqueueAction(action);
},

What I don't know how to do is how to access the value of "Boolean_field_I_want__c".

1

If the response is a single record, you should be able to use dot notation, like this:

if(ret.Boolean_field_I_want__c){
    cmp.set('v.showLaunchButton', true);
}
  • Hi @Shane - that managed to remove the launch button, but it also removed a listview displayed on the same page. Any idea why this might be the case? The listview is part of a "Record List" component – Jwok May 31 '18 at 17:19
  • @Jwok -- I'm not sure. Post the relevant parts of the code and I'll take a look. – Shane Steinfeld Jun 2 '18 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.