I am trying to pass recordid to apex method, but its going null everytime. below is my code. Kindly advise.

 <aura:handler name="init" value="{!this}" action="{!c.validate }"/>

 <aura:attribute name="message" type="String"/>
 <aura:attribute name="appid" type="String" default="{!v.recordId}" access="global" /> 
 <aura:attribute name="result"  type="String" default="Go"/>
 <aura:attribute name="result2"  type="String" default="No"/>

  <!--  <ui:button label="GO" press="{!c.validate}"/>-->

<aura:if isTrue="{!v.message==v.result}">
                   <p>Display Message 1</p>
<aura:if isTrue="{!v.message==v.result2}">
                   <p>Display Message 2</p>
<aura:if isTrue="{!v.message}">
                   <p>Display Message 3</p>

Here is the Javascript of this component:


validate:function(cmp, evt, helper) {
     //var appid = cmp.get("v.recordid");

    var action = cmp.get("c.GetScreeningResult");
    action.setParams({ "appid" : cmp.get("v.recordid") });

    action.setCallback(this, function(a) {
        cmp.set("v.message", a.getReturnValue());


HideMe: function(component, event, helper) {
  component.set("v.ShowModule", false);



Here is the apex method.

public class Getscreening {
public static String GetScreeningResult(string appid){

string result = 'No';
system.debug('Application id is = '+appid );
list<application__c> id = [select id from application__c where id = :appid ];
string appqueryresults = String.valueOf(id[0]);
system.debug('appqueryresults' + appqueryresults );
    return appqueryresults ;


1 Answer 1


recordid is not correct. It should be recordId. Javascript attributes are case sensitive.

  • 1
    Thank you @salesforcesas, that was very silly from my end :) Jul 30, 2019 at 12:34

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.