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}">
<div>
<p>Display Message 1</p>
</div>
</aura:if>
<aura:if isTrue="{!v.message==v.result2}">
<div>
<p>Display Message 2</p>
</div>
</aura:if>
<aura:if isTrue="{!v.message}">
<div>
<p>Display Message 3</p>
</div>
</aura:if>
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());
});
$A.enqueueAction(action);
},
HideMe: function(component, event, helper) {
component.set("v.ShowModule", false);
},
})
Here is the apex method.
public class Getscreening {
@AuraEnabled
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 ;
}}