+ Start a Discussion
Dhilip DussaDhilip Dussa 

Need help on apex pages

Hi,

Need help on returning value

I have created a site with vf page i need to return the values

the requirement i receive any message from thirdparty i need to show that

public class ControllerContacts{

   public Class wrapper{
        @AuraEnabled Public String Messages;
        @AuraEnabled Public String frmNumber;
        @AuraEnabled Public String currentpage;
    }
    @AuraEnabled
    public Static list<wrapper> init(){
        list<wrapper> wrapperList = new list<wrapper>();
        wrapper q = new wrapper();
        q.currentpage = ApexPages.currentPage().getParameters().get('MessageUUID');
        q.Messages = ApexPages.currentPage().getParameters().get('Text');
        q.frmNumber = ApexPages.currentPage().getParameters().get('From');
        wrapperList.add(q);
        system.debug('wrapperList========>>>>'+wrapperList);
        String fromNumber      = ApexPages.currentPage().getParameters().get('From');
        String text            = ApexPages.currentPage().getParameters().get('Text');
        
        IF(fromNumber != NULL && text !=NULL){
            SreeBolt__Twilio_Messages__c twilio = new SreeBolt__Twilio_Messages__c(SreeBolt__From_Number__c = '+'+fromNumber,SreeBolt__Message__c = text);
            insert twilio;
        }
        return wrapperList;
    }
}

=============================================================
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global" controller="ControllerContacts">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute type="List" name="Message"/>
    <aura:attribute type="List" name="Number"/>
    hello: {!v.Message}
    {!v.Number}
    <aura:iteration items="{!v.Message}" var="Msg">
        hello : {!Msg.Messages}
    </aura:iteration>
</aura:component>
=================================================================
({
    doInit : function(cmp, event, helper) {
        var action = cmp.get("c.init");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                cmp.set('v.Message', response.getReturnValue());
                cmp.set('v.Number', response.getReturnValue());
            console.log(cmp.get('v.Message'));
                console.log(cmp.get('v.Number'));
            }
        });
        $A.enqueueAction(action);
    }
})