• yogesh pTIL
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 4
    Replies
/**********APP CODE ********/
<aura:application >
    <c:AccountDisplayComponent />
</aura:application>

/********** COMPONENT CODE*************/

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="AccControllerClass">
    <aura:handler name="init" action="{!c.getResults}" value="{!this}" />
    <aura:attribute name="strAccountName" type="Account" default="{'sobjectType':'Account',
                                                                  'Name':''}"/>
    <div class="Text">
        <ui:inputText aura:id="AccountId" label="Account Name" />
    </div>
    <div>
        <ui:Button label="Click Me!" press="{!c.getResults}"/>
    </div>    
</aura:component>


/************ CONTROLLER CODE **************/

({
    getResults : function(component, event) {
        var newAccount= component.find("AccountId").get("v.value");
        var action= component.get("c.saveAccount");
        alert(''+newAccount);
        alert(''+action);
        alert(action.getState());
        
        action.setParams({
            "acc" :newAccount
        });
        
   action.setCallback(this,
            
       function(response){            
           component.set("v.strAccountName",response.getReturnValue());            
           alert(response.getReturnValue());    
             alert('Hello');
                var name = response.getReturnValue();
                alert(name);
                 var state = response.getState();
                alert(state);
                 if (state == "SUCCESS" || response.getState() == "ERROR") {
                        var name = response.getReturnValue();
                     alert(name);
                     alert(action.getReturnValue());
                     console.log(action.getReturnValue());
                        alert("hello from here"+name);
                 }
        });
        
        $A.enqueueAction(action);
    }
})

/******APEX CONTROLLER **********/

public with sharing class AccControllerClass {

    @AuraEnabled
    public static Account saveAccount(Account acc){
        System.debug('@@acc'+acc);
        List<Account>  listAccount =new List<Account>();
        listAccount.add(acc);
        insert listAccount;
        return acc;
    }
    
}

Whenever I amclicking on the convert button i am geting this error..

please help....

My visualforce code

<apex:page standardController="Lead" extensions="LeadConvertClass">    
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Convert" action="{!save}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Convert Lead">
                <apex:selectList value="{!strCompanyName}" label="Account Name" size="1">
                    <apex:selectOptions value="{!CompanyNames}" />
                </apex:selectList>
                <apex:inputField value="{!objOpportunity.Name}"/> 
                <apex:inputField value="{!objLead.Status}" />
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Task Information">
                <apex:inputField value="{!objTask.Subject}"/>
                <apex:inputField value="{!objTask.Status}" />
                <apex:inputField value="{!objTask.priority}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
                <apex:inputField value="{!objLead.Description}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Reminder">
              <!--  <apex:inputField value="{!objLead.ReminderDateTimeId}"/> -->
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

My Apex Code

public class LeadConvertClass {

    public LeadConvertClass(ApexPages.StandardController controller) {
    
        objLead  =new Lead();
        objContact =new Contact();
        objAccount =new Account();
        objOpportunity =new Opportunity();
        listCompanyNames =new List<SelectOption>();
    //    listCompanyNames.add(new SelectOption('USA','USA'));
    //    listCompanyNames.add(new SelectOption('IND','IND'));
        strId=apexpages.currentpage().getparameters().get('id');
        System.debug('@@@strId'+strId);
        objLead.status='Closed-Converted';
    
    }


   
    public Lead objLead {get ; set ;}
    public Contact objContact {get ; set ;}
    public Account objAccount {get ; set ;}
    public Opportunity objOpportunity {get ; set ;}
    public Task objTask {get ; set ;} 
    public List<SelectOption> listCompanyNames {get ; set ;}
    public String strCompanyName {get ; set ;}
    public String strId;
    public String strLeadCompany;
    public String strQuery;
    
    public List<SelectOption> getCompanyNames(){
    Lead objLead =[Select id,Company from Lead where id =:strId];
    strQuery ='Select name from Account where name LIKE \'%'+objLead.Company+'%\'';
    List<Account> listAccount=database.query(strQuery);
    listCompanyNames.add(new SelectOption('none','none'));
    listCompanyNames.add(new SelectOption('Create New Account :'+objLead.Company,'Create New Account :'+objLead.Company));
    if(listAccount!=null){
    for(Account objAccount:listAccount)
    {    
         listCompanyNames.add(new SelectOption(objAccount.name,objAccount.name));   
    }
   
   }        
    objOpportunity.Name=objLead.Company;
    return listCompanyNames;
    }
    
    public PageReference save()
    {
        System.debug(strId);
        System.debug(objOpportunity.name);
        System.debug(objAccount.name);
        System.debug(objLead.Status);
        if(strCompanyName!=null){
            insert objAccount;        
        }
        objContact.AccountId=objAccount.id;
        insert objOpportunity;
        update objLead;
        return null;
    }
}


### 

Error: Value 'Call' cannot be converted from Text to core.apexpages.el.adapters.metadata.VFSObjectELAdapter*

This Error is visible under Subject Field















 

Hi,
I want to integrate facebook account with my developer org 
so if any cases posted to my facebook wall could be captured in my org..
this is my visualforce code...
Actually i want to show the loading image button on click of upload attachment  button
On click of select Attachment the apex method is being called which makes the page to rfresh...
i want to avoid the page refresh...
and rerender cannot be used on <apex:inputfile>
////////visualforce code /////////

<apex:page standardController="Account" extensions="extendAccountforstandardController">
<apex:form id="frm">
<apex:pageBlock >
<apex:pageblockSection >
<apex:inputFile value="{!objAttachment.body}" fileName="{!objAttachment.name}"/> 
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Select Attachment" action="{!selectAttachment}" rerender="none" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:actionRegion >
<apex:pageBlock id="pgBlkId" >
<apex:pageBlockSection >
<apex:inputField value="{!objAccount.parentid}"/>

</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:outputpanel id="image">
<apex:commandButton action="{!attachRecord}" value=" upload attachment" reRender="image" status="actStatusId" />
</apex:outputpanel>
 <apex:actionStatus id="actStatusId" >
<apex:facet name="start"  >
<img src="/img/loading.gif" />                    
</apex:facet>
</apex:actionStatus> 
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:actionRegion>
</apex:form>
</apex:page>

///// Apex Code

public class extendAccountforstandardController {

    public PageReference attachRecord() {
    
    System.debug('@@objAccount.id'+objAccount.id);
    
     System.debug('@@objAccount.parentId'+objAccount.parentId);
      
      objAttachment.parentId=objAccount.parentId;
      objAttachment.body=bodyAttachment;
      objAttachment.name=nameAttachment;
      
      if(objAccount.parentid!=null){    
        
            insert objAttachment;
        
        }
        return null;
    }

    public blob bodyAttachment;
    
    public string nameAttachment;
    
    public Account objAccount { get; set; }

    public Attachment objAttachment {get; set;}
    
    public extendAccountforstandardController(ApexPages.StandardController controller) {

        objAccount =new Account();
        objAttachment=new Attachment();

    }
    
    public void selectAttachment(){
    bodyAttachment=objAttachment.body;
    nameAttachment=objAttachment.name;
    System.debug(''+'@@nameAttachment'+nameAttachment);
    }
}

 
Hi,
I want to integrate facebook account with my developer org 
so if any cases posted to my facebook wall could be captured in my org..
this is my visualforce code...
Actually i want to show the loading image button on click of upload attachment  button
On click of select Attachment the apex method is being called which makes the page to rfresh...
i want to avoid the page refresh...
and rerender cannot be used on <apex:inputfile>
////////visualforce code /////////

<apex:page standardController="Account" extensions="extendAccountforstandardController">
<apex:form id="frm">
<apex:pageBlock >
<apex:pageblockSection >
<apex:inputFile value="{!objAttachment.body}" fileName="{!objAttachment.name}"/> 
</apex:pageblockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Select Attachment" action="{!selectAttachment}" rerender="none" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:actionRegion >
<apex:pageBlock id="pgBlkId" >
<apex:pageBlockSection >
<apex:inputField value="{!objAccount.parentid}"/>

</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:outputpanel id="image">
<apex:commandButton action="{!attachRecord}" value=" upload attachment" reRender="image" status="actStatusId" />
</apex:outputpanel>
 <apex:actionStatus id="actStatusId" >
<apex:facet name="start"  >
<img src="/img/loading.gif" />                    
</apex:facet>
</apex:actionStatus> 
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:actionRegion>
</apex:form>
</apex:page>

///// Apex Code

public class extendAccountforstandardController {

    public PageReference attachRecord() {
    
    System.debug('@@objAccount.id'+objAccount.id);
    
     System.debug('@@objAccount.parentId'+objAccount.parentId);
      
      objAttachment.parentId=objAccount.parentId;
      objAttachment.body=bodyAttachment;
      objAttachment.name=nameAttachment;
      
      if(objAccount.parentid!=null){    
        
            insert objAttachment;
        
        }
        return null;
    }

    public blob bodyAttachment;
    
    public string nameAttachment;
    
    public Account objAccount { get; set; }

    public Attachment objAttachment {get; set;}
    
    public extendAccountforstandardController(ApexPages.StandardController controller) {

        objAccount =new Account();
        objAttachment=new Attachment();

    }
    
    public void selectAttachment(){
    bodyAttachment=objAttachment.body;
    nameAttachment=objAttachment.name;
    System.debug(''+'@@nameAttachment'+nameAttachment);
    }
}