• Surya P
  • NEWBIE
  • 50 Points
  • Member since 2020

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 10
    Replies
My related list of an object has a picklist field. I want few values from that field to be removed. How can I do this. 
Thanks in advance for your help.
Hi,
I have question regarding wrapper class usage in Lightning.
I have a wrapper class which contains list,integer and string. My client side controller returns wrapper class values. Now how can I separate list values from the given result.
Kindly help me with this question.

Thanks and Regards
Surya
 
Hi,
Kindly help where I'm wrong in the following Image.
"Style" and "div" showing in diffrent colour.The page does not show any error but style is not applied to the page.

User-added image

Thanks & Regards
Surya
Hi,

How can we create two lookup fields in a custom lightning component? 

For example I have 3 custom objects and on one object I need to create a button and onclicking this button I need to create multiple records for this object using a custom component. When creating multiple records, there should be two look up fields which are related to other two custom objects.

Kindly help me,how to achieve this requirement.

Thanks & Regards
Surya
I have wrote a test class for an Apex class,but the code coverage is 42%.

Kindly help me where I'm wrong in the code.

Apex Class:
public class InsertContactsToAccount {
    
    
   @AuraEnabled
    public static void saveContacts(List<Contact> listContact, Id recordId)
    {
        list<contact> conlist = new list<contact>();
        Insert listContact;
        for(Contact a:listContact){
            a.AccountId = recordId;
            conlist.add(a);
        }
        update conlist;
    } 
}

Test Class:
 
@isTest
public class InsertContactsToAccountTest {
    static testMethod void saveContactsTest(){
        
        Account a = new Account();
        a.Name ='Test';
        insert a;
        
        Contact c = new Contact();
        c.LastName = 'Test';
        insert c;
        
        c = [select id from Contact where id =:c.id];
        c.AccountId = a.Id;
        update c;
        
        List<Contact> con = [select id from Contact where id =:c.id];
        InsertContactsToAccount.saveContacts(con,a.id);
        
    }

}

Thanks in Advance 

Regards
Surya
I have created Lightning componet and added the component as quick action on Account object, by using this action I'm able to create contacts but these contacts are not related to the account record. I have also used the interface "force:hasRecordId", but still i could not create contacts related to that particular record.
Kindly help me how to create multiple contact records for a particular account record using lightning components.

Thanks
Surya
Hi Team,

I'm new to Salesforce. I have a question regarding assigning leads to campaigns.
I came across this use case where I need to fetch all the lead records from leads object (based on certain criteria: eg say not assigned to campaign) and from this list of records i need to create new campaigns and assign only 200 lead records to each campaign as campaign members and this process should continue till all the records in the list are assigned. So could you kindly help me with the code for this scenario.

Thanks in advance.

Cheers,
Surya
Hi all-
I'm taking my first stab at visualforce pages. I am trying to generate a pdf of an opportunity record and having it attach to the record via a custom button. I feel like i'm close because I can see the pdf working when I just load the VF page (with fields populated), and then the button I created is "generating" an attachment on the record, but I'm missing something in the middle becuase the pdf attachment fields are empty. I've pieced together code samples I found online.

The first thing I did was create a VF page, pdfOpp:

<apex:page standardController="Opportunity" renderAs="pdf">
<center>
<h1>PRE-ADMISSION PHONE SCREEN</h1>
</center>

<table>
<b>DETAILS:</b>
<hr/>
<tr><th>Pre-Admission Phone Screen Name:</th>
    <td><apex:outputText value="{!Opportunity.Name}"/></td>
    </tr>
<tr><th>Owner:</th>
    <td><apex:outputText value="{!Opportunity.Owner.Name}"/></td>
    </tr>
<tr><th>Created Date:</th>
    <td><apex:outputText value="{0,date,long}">
        <apex:param value="{!Opportunity.CreatedDate}"/>
        </apex:outputText></td>
    </tr>
 <tr><th>Account Name:</th>
    <td><apex:outputText value="{!Opportunity.Account.Name}"/></td>
    </tr>
 <tr><th>Stage:</th>
    <td><apex:outputText value="{!Opportunity.StageName}"/></td>
    </tr>
</table>
</apex:page>



I then created an apex class:

*/
public class attachPDFToOpportunity2 {
    
    private final Opportunity a; //Opportunity object
    
    //constructor
    public attachPDFToOpportunity2(ApexPages.StandardController standardPageController) {
        a = (Opportunity)standardPageController.getRecord(); //instantiate the Opportunity object for the current record
    }
    
    //method called from the Visualforce's action attribute
    public PageReference attachPDF() {
        
        //generate and attach the PDF document
        PageReference pdfPage = Page.pdfOpp; //create a page reference to our pdfOpp Visualforce page
        Blob pdfBlob; //create a blob for the PDF content
        if (!Test.isRunningTest()) { //if we are not in testing context
            pdfBlob = pdfPage.getContent(); //generate the pdf blob
        } else { //otherwise, we are in testing context and getContent() 
            pdfBlob = Blob.valueOf('Some Text');
        }
        Attachment attach = new Attachment(parentId = a.Id, Name = 'pdfAttachmentDemo.pdf', body = pdfBlob); //create the attachment object
        insert attach; //insert the attachment
        
        //redirect the user
        PageReference pageWhereWeWantToGo = new ApexPages.StandardController(a).view(); //we want to redirect the User back to the Opportunity detail page
        pageWhereWeWantToGo.setRedirect(true); //indicate that the redirect should be performed on the client side
        return pageWhereWeWantToGo; //send the User on their way
    }
}

I next created the second VF page called attachPDFtoOpportunity:

<apex:page action="{!attachPDF}" extensions="attachPDFToOpportunity2" standardController="Opportunity">

    <apex:pageMessages ></apex:pageMessages><!-- included for display of errors should they occur -->
    <apex:detail inlineEdit="true" relatedList="true"></apex:detail> <!-- included so Opportunity detail information is visible when errors occur -->
</apex:page>

Lastly, I created a custom button. When I click on my Generate PDF button, it does generate a pdf and saves it to my Opportunity record, but it only includes headers and field names. No fields are actually populated.

Thank you!!!
Megg
I have been following all the steps for this challenge but when I run the apex tests in Salesforce classic it shows "1/2 Test methods passes". Moreover, I couldn't find any BeAwesome' test with the 'sb_security' Namespace Prefix in lightning. So tried in classic but eventually failed.
Can anyone help me in this? Been trying since 2 days.. Thanks!!
I have objects(Topics and Teams) which are Master-detail to Case. Teams have a lookup(User) field. Scenario: When a Case status changed from escalation to closed and if there are certain users in the teams then Topic needs to have at least one record before closing the case
My related list of an object has a picklist field. I want few values from that field to be removed. How can I do this. 
Thanks in advance for your help.
Hi,
I have question regarding wrapper class usage in Lightning.
I have a wrapper class which contains list,integer and string. My client side controller returns wrapper class values. Now how can I separate list values from the given result.
Kindly help me with this question.

Thanks and Regards
Surya
 
I have wrote a test class for an Apex class,but the code coverage is 42%.

Kindly help me where I'm wrong in the code.

Apex Class:
public class InsertContactsToAccount {
    
    
   @AuraEnabled
    public static void saveContacts(List<Contact> listContact, Id recordId)
    {
        list<contact> conlist = new list<contact>();
        Insert listContact;
        for(Contact a:listContact){
            a.AccountId = recordId;
            conlist.add(a);
        }
        update conlist;
    } 
}

Test Class:
 
@isTest
public class InsertContactsToAccountTest {
    static testMethod void saveContactsTest(){
        
        Account a = new Account();
        a.Name ='Test';
        insert a;
        
        Contact c = new Contact();
        c.LastName = 'Test';
        insert c;
        
        c = [select id from Contact where id =:c.id];
        c.AccountId = a.Id;
        update c;
        
        List<Contact> con = [select id from Contact where id =:c.id];
        InsertContactsToAccount.saveContacts(con,a.id);
        
    }

}

Thanks in Advance 

Regards
Surya
I have created Lightning componet and added the component as quick action on Account object, by using this action I'm able to create contacts but these contacts are not related to the account record. I have also used the interface "force:hasRecordId", but still i could not create contacts related to that particular record.
Kindly help me how to create multiple contact records for a particular account record using lightning components.

Thanks
Surya
Hi All,

I am new to lightning. I implemented a custom lookup component in lightning and i embed it into another component. Now my requirement is need to validate that lookup field. If the lookup field empty an error message should display reference code:   

<div class="slds-size_8-of-8" >
    <label class="slds-float_left"><span style="color:red;" align="left">*</span>Account Name: </label>
               <c:customLookup objectAPIName="contact" IconName="standard:contact" selectedRecord="{!v.selectedLookUpRecord}" label=""/>
</div>