• Arun Garg 9
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 17
    Replies
Hi, 

I want to display list of accounts with contacts in lightning page. Here the code i have written. Here accounts are displaying but contacts are not display. Please help me to display the accounts with contacts.

Thank you.


 
<aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
	 
    <aura:attribute name="accounts" type="Account[]" />
    <ui:button label="click this" press="{!c.myAction}" />
    <table>
            <tr><td><b>Name</b></td><td><b>Industry</b></td></tr>

    <aura:iteration items="{!v.accounts}" var="accs1" >
        <tr>   
        <td> {!accs1.Name}  </td>
         
      <td>   {!accs1.Industry}  </td> 
      <!--   <td>   {!accs1.Contacts.lastName}  </td> -->
        </tr>     
     <tr>   <aura:iteration items="{!v.accs1.contacts}" var="con1" >
            
             <td>{!con1.lastName} </td>
            
        </aura:iteration></tr>
     </aura:iteration>                                            
        </table>
    
</aura:component>








({
	myAction : function(component, event, helper) {
		var action =component.get("c.getAllAccounts");
        console.log('The action value is: '+action);
         action.setCallback(this, function(a){ 
             
            component.set("v.accounts", a.getReturnValue());
           //  console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
            console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
          
        });
        $A.enqueueAction(action);
	}
})











public class accountsWithContactsClass {

@auraEnabled
public static list<account> getAllAccounts()
    {
       list<account> accs =[select id,name,phone,industry,(select lastName from contacts) from account limit 10];
      //  list<account> accs =[select id,name,phone,industry from account limit 10];
     //   return [select Id,Name from account limit 10];
     return accs;
    }
}

 
Hi All,

Q). What is a future method ? When we are going to use Future methods? Example program for Future method and Schedulable class for Future method?

Give me reply anyone.....
public without sharing class trac_SetFieldsOnLockedOppExt {

    private final Opportunity lockedOpp;

    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
    public trac_SetFieldsOnLockedOppExt(ApexPages.StandardController stdController) {
        this.lockedOpp = (Opportunity) stdController.getRecord();
        if( this.lockedOpp.IsClosed ) {
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.ERROR, 'The current opportunity has been closed and cannot be modified.') );
        }
    }

    public PageReference saveLockedRecord() {
        PageReference pr = null;
        if( !lockedOpp.IsClosed ) {  
            update new Opportunity(
                Id = lockedOpp.Id,
                CloseDate = lockedOpp.CloseDate,
                Gate__c = lockedOpp.Gate__c,
                Annual_Web_SalesOpp__c = lockedOpp.Annual_Web_SalesOpp__c,
                Estimated_Signature_Date__c = lockedOpp.Estimated_Signature_Date__c,
                Stage_Qualifier__c = lockedOpp.Stage_Qualifier__c,
                Current_Affiliate_Annual_Sales_Revenue__c = lockedOpp.Current_Affiliate_Annual_Sales_Revenue__c,
                Percent_to_CJ__c = lockedOpp.Percent_to_CJ__c,
                Think_Big_Number__c = lockedOpp.Think_Big_Number__c
            );
            pr = new PageReference( '/' + lockedOpp.Id );
            pr.setRedirect( true );
        }
        return pr;
    }
}
I was told I needed to make the above class invocable so that the button/visualforce/field set it is associated with can be used within Skuid, or standard salesforce list view.  The class updates fields on a locked opp.
 
Hi,

We were trying to get input from user through submit form in a lightning component and with that input values create a record in a custom object. We got the input by the following code:

    <aura:attribute name="custDetail" type="CustomerDetail__c[]"></aura:attribute>
    <aura:attribute name="customerInfo"  type="CustomerDetail__c" default="{            sobjectType: 'CustomerDetail__c' }" />
    <force:inputField value="{!v.customerInfo.Name}"/>
    <ui:button label="Edit Record" press="{!c.saveDetails}"/>


Our jscontroller looks like the following

({
    saveDetails : function(component, event, helper) 
    {
    
    var dets = component.get("v.customerInfo.Name");
        alert(dets);
        //console.log('dets::'  + dets);
        //debugger;
        
    helper.save(component,dets);
    }
})


We get the name in the alert correctly when we submit.


Next the helper is as following


({
    save: function(component, dets) {
    //Save the expense and update the view
    this.upsertDet(component, dets, function(a) {
        var dets3 = component.get("v.custDetail");
        dets3.push(a.getReturnValue());
        console.log('here'+dets3);
        component.set("v.custDetail", dets3);
    });
},
upsertDet : function(component, dets, callback) {
  var action = component.get("c.saveDetailsGiven");
  action.setParams({ 
      "dets": dets
  });
  if (callback) {
      action.setCallback(this, callback);
  }
  $A.enqueueAction(action);
}
})


Apex class::

public class saveCusDetails {
     @AuraEnabled 
    public static string saveDetailsGiven(CustomerDetail__c details) {
   
    upsert details;
        system.debug('#####'+ details);
    return details.Id;
}
}


There are no errors but the record is not getting created. Any help would be appreciated.

Thank you
  • June 22, 2016
  • Like
  • 0
Hi All
can you please share interview questions and different senarios which ask for experienced sfdc developers
 
Hi,
  I have a Component showing the List of Records already inserted for an Object. In that Component one button is there called "New". I want after clicking on "New" another Modal Pop up will open where user can insert the new values of different fields of the object and can save it. After saving Pop up will close and the List of Record component will be refreshed with the new record addition details in a row along with previously inserted record details in Separate Rows of the Record List.
Hope I could able to make you undertsnad my problem. If you can please reply with Example.
Thanks,
Debasish.
Hi,

How to implement autocomplete lookup in visualforce page.
I have come across many links where the autocomplete is shown with standard object. But in my case i need to do with webservice call.
i.e When i start typing in input textbox , after typing atleast 3 characters it should hit the webservice call.


Thanks.

We've successfully added a number of Custom Fields using the Metadata API.  Our site is an Asp.net and we're using VB for coding (thought about posting to .NET Development, but our question is more API focused).  First we build a Custom Field: 
metaCustomField = New sfMetadata.CustomField
metaCustomField.fullName = "Account.TestField__c"
metaCustomField.description = "Test Field for Account"
metaCustomField.inlineHelpText = "Test Field for Account"
metaCustomField.label = "Field Label"
metaCustomField.length = 20
metaCustomField.lengthSpecified = True
metaCustomField.unique = False
Then we add the Custom Field to an Array of Custom Fields (metaCustomFields).  There are roughly 40 fields, so we limit the array to 10 and submit each batch of 10 fields using:
metaCustomFieldsResult = myMetaService.create(metaCustomFields)
This all works well, and the fields are created as desired.  The first time we created the fields, it worked perfectly and we were then able to use the Soap API to populate the Account object with data (including the custom fields).

However, for some reason, if we delete a Custom Field and then add it again, or if we test using other Salesforce logins, the fields are getting generated properly, but the permissions on the fields are no longer being set (none of the "Field-Level Security" is set to visible).  We're not sure what we changed, but we've begun looking into how to apply Permission Sets to the Custom Fields for the Account object.  There appears to be a couple concepts to consider.  First, we've seen some code for building a package.xml file listing our field permissions and then submitting the zipfile:
<fieldPermissions>
     <editable>true</editable>
     <readable>true</readable>
     <field>Account.TestField__c</field>
</fieldPermissions>
In addition, we noticed that there are some additional Metadata API functions that look like they might help, but we can't find any details or code samples on how to apply them:
' Will adding either of these lines to the
' Custom field definition help:
metaCustomField.visibleLines = 1
metaCustomField.writeRequiresMasterRead = True

' Or, define a Permission Set
metaFieldPermission = New sfMetadata.PermissionSet
' Not sure what to do with it from here...

Can anyone tell us if we are heading in the right direction, or if there is a preferred method for setting the "Visible" Field-Level Security permissions for the custom fields we have created?

  • May 23, 2014
  • Like
  • 0
HI Everyone,

I have a designed VF page as agreement document. Here I need to keep Signature like I need to enter a name in the text field and need to be shown in different font and get it saved as attachement if that particualr record. Here I am using the contact object..

Can anyone suggest on this?

Hi,

 

I have seen in many examples but donot know when and in which situation should we use <apex;repeat> within <apex:variable>.

 

CAn some one understand me with example?

 

 

 

 

.

  • August 07, 2013
  • Like
  • 0

Hi

can anyone pelase let me know below questions.

 

1. What is the use Javascript Remoting ?

 

2. If more flexible, When we need to use ?

 

3. What is the use of Actionfunction ?

 

4. What is the diffrenece between Actionfunction and Javascript remoting ?

 

5. JS remoting used for mainly calling the APEX method from javascript ? if yes what s the benefits ? can u please let me know real time scanerio ?

 

As of now, I know the js remoting the will be used for calling APEX method from javascript . i just want to know when we need to perform this ?

 

 

Thanks

Vinoth

HI all,

 

Q) What is the difference between Database.insert and Insert?

 

can you please give me rply its very urgent

 

thanks for your help....

Hello All,

I 'd an issue regarding sending emails using singleemailmessage class. Heard that we can send 10 * 1000 = 10000 emails per execution (10 arrays, each array to accomodate 1000 emails). Is this true?

But i am unable to send more than 10 emails. Could anyone plz clarify me how to do. PFB my code snippet:

 

            }

for(Permit__c p:permitList){
                 Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
                                    String subject = p.Name+' | '+p.Region__c+' | '+p.Full_State__c+' | '+p.Channel__c+' | Status=Expired';
                                    email.setSubject(subject);
                                    String emailadd = 'abc@xyz.com';
                                    String[] toAddresses = emailadd.split(',');
                                    email.setToAddresses(toAddresses);
                                    email.setHTMLBody( 'email body.' );
                 Messaging.SendEmailResult[] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); 

 

 

An error is being thrown when 10 mails are sent and is about to send 11th email.

Plz help!

Hello. Sorry if this seems like a stupid question but it's been driving me crazy. I've tried different formulas and nothing seems to work. 

 

I have a report that shows created cases and its set in the Matrix format. I have the opened date on the left. When I choose a grouping type and choose day I get the date and not the day of the week. I also try to group by "Calendar Day in Month" but still can't get the graph to report the actually day of the month. 

 

Any help would be greatly appreciated. Thank you. 

 

 

Also, i get the following when trying to use the date formula. 

 

Error: Invalid custom summary formula definition: Formula result is data type (Text), incompatible with expected data type (Number).

 

Hello,

 

I have a requirement where I need to display the columns seleted / defined for a particular listview in a custom visualforce page. 

I know that there is a property ListView. Columns in Metadata API for Salesforce, but I am not sure on how to use it in APEX Code.

Can anyone please help me with regard to this ?? Any examples on how to use this are appreciated.

 

Thanks.

Kartik