• Pallavi Shende
  • NEWBIE
  • 30 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
Hello,
Greetings.

I am new to the LWC and I am trying to show elements to the new line. However I am unable to.
Can you please help? elements marked in red should on new line.User-added image
Hello,

Does anyone know what is "b2bmaIntegration" installed package in saleforce?
Hi Team,

We want to explore the Salesforce Engage, However it is not available for sandbox. Hence do you know if we can get Salesforce engage free trail to explore?

Thank you in advance.
Hi Expert,

I am new to the programming world. I have a custom controller which insert a contact created on VF page. Now I am not able to write test class for this. I could only cover 56% code.
 
public class TestPopup {
    
    public list<Account> acc{get;set;} 
    public Account acc1 {get;set;} 
    public Contact contact {get;set;}
    public List<Contact> conlist;
    public Boolean displayPopup {get;set;}
    public String accid {get;set;}
       

    public TestPopup(){
        acc = [select ID, Name, AccountNumber,Type from Account];
	    acc1 = new Account();
        conlist = new List<Contact>();
        contact = new Contact();
        	
    }
   
    public list<Account> getacc(){
        return acc;
    }
    
    public void showPopup()
    { 
    	displayPopup = true;
        acc1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :accid];
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }

    public PageReference save(){
        contact.AccountId= acc1.Id;
        insert contact;
        ID contactId = contact.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}
 
@isTest
public class TestCustomController {
     static testMethod void testMethod1() 
     {
         Account testAccount = new Account();
         testAccount.Name='Test Account';
         insert testAccount;
         
         Contact cont = new Contact();
         cont.LastName = 'Test';
         cont.FirstName = 'Contact';
         cont.AccountId = testAccount.Id;
          // insert cont;
         
         Account testAccount1 = new Account();
         testAccount1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :testAccount.Id];
       
         
         
         Test.StartTest(); 
         PageReference pageRef = Page.All_Account; // Add your VF page Name here
         pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
         Test.setCurrentPage(pageRef);
         
         TestPopup testAccPlan = new TestPopup();  
         testAccPlan.getacc();
        // testAccPlan.showPopup(); 
         testAccPlan.closePopup();
         
         Test.StopTest();
         
     } 
}

 
Hi Experts,
I need a account name against which I create contact on visualforce page. Visualforce page is list view. When I
<apex:page controller="TestPopup">
<apex:form >
<apex:pageBlock title="All Accounts List">
<!--Account list-->
<apex:pageblockTable value="{!acc}" var="account1">
<apex:column value="{! account1.Name}"/> 
<apex:column value="{! account1.AccountNumber}"/> 
<apex:column > 
<apex:commandButton value="Create Contact" action="{!showPopup}" rerender="popup"/>
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:outputPanel id="popup">
<apex:outputPanel id="popupblock" layout="block" styleClass="customPopup" rendered="{!displayPopup}">
<apex:commandButton value="Close" title="Close the popup" action="{!closePopup}" styleClass="closeButton" rerender="popup"> </apex:commandbutton>
<apex:pageBlockSection title="Contact Form">
<apex:pageBlockSectionItem >
<apex:outputLabel >Contact Name</apex:outputLabel>
<apex:inputText value="{!Contactname}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="Save Contact" action="{!save}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
<style type="text/css">
.customPopup {
    background-color: white;
    border-style: solid;
    border-width: 2px;
    left: 20%;
    padding: 10px;
    position: absolute;
    z-index: 9999;
    /* These are the 3 css properties you will need to tweak so the pop 
                            up displays in the center of the screen. First set the width. Then set 
                            margin-left to negative half of what the width is. You can also add 
                            the height property for a fixed size pop up.*/
    width: 500px;
    top: 20%;
}

.disabledTextBox {
    background-color: white;
    border: 1px solid;
    color: black;
    cursor: default;
    width: 90px;
    display: table;
    padding: 2px 1px;
    text-align:right;
}   

.closeButton {
    float: right;
}
</style>
</apex:page>
 
public class TestPopup{
    Account account=new Account();
    public list<Account> acc{get;set;} 
    ApexPages.StandardSetController setCon{get;set;}
    public TestPopup(){
           acc = [select ID, Name, AccountNumber,Type from Account];
        	
    }
    Id id = ApexPages.currentPage().getParameters().get('id');
    public id aaccountid;

    public list<Account> getacc(){
        return acc;
    }
    
    public Boolean displayPopup {get;set;}
    
    public void showPopup()
    { 
    displayPopup = true;
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }
    
    public Id posId {get;set;}

    public string Contactname {get;set;}

    public PageReference save(){
        Contact con= new Contact();
        con.LastName = Contactname;
        con.AccountId= id;
        insert con;
        ID contactId =con.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}

click create contact a popup opens with input field Contact Name. When click on save, it is navigate to the contact I created. I am getting the contact saved but not the account name to it. User-added imageUser-added image
Hi Expert, I am getting "System.SObjectException: Field
@isTest
public class OppNamesTest {
    static testmethod void testclass(){
        
    //insert product
    Product2 prod = new Product2(Name = 'Laptop X200',Family = 'Hardware');
    insert prod;
    
  	 Id pricebookId = Test.getStandardPricebookId();
        
     //create a new Opportunity
	Opportunity opp1 = new  Opportunity();
    opp1.Name = 'Test trigger';
    opp1.CloseDate = Date.today();
    opp1.StageName = 'Sourcing Demand';
    insert opp1;
        
    //create a new Opportunity2
	Opportunity opp2 = new  Opportunity();
    opp2.Name = 'Test trigger1';
    opp2.CloseDate = Date.today();
    opp2.StageName = 'Sourcing Demand';
    insert opp2;
        
    //insert pricebook
    PricebookEntry pbe = new PricebookEntry();
    pbe.Pricebook2Id=pricebookId;
    pbe.Product2Id = prod.Id;
    pbe.isActive=True;
   	pbe.UnitPrice = 0.70;
  	pbe.UseStandardPrice=false;
	 insert pbe;
        

        
        //create OLI
       	OpportunityLineItem opli = new OpportunityLineItem();
    	opli.UnitPrice = 57;
    	opli.Quantity = 1;
    	opli.OpportunityId=opp1.Id;
       // opli.PricebookEntryId= pbe.Id;
    	opli.Product2Id = prod.Id;
       	insert opli;
        
        //create OLI
       	OpportunityLineItem opli1 = new OpportunityLineItem();
    	opli1.UnitPrice = 40;
    	opli1.Quantity = 1;
    	opli1.OpportunityId=opp2.Id;
        opli.PriceBookEntryId=pbe.Id;
    	opli1.Product2Id = prod.Id;
       	insert opli1;	
        
        map<ID,string> MapofNames = new map<ID,string>();
        Product2 prd = new Product2();
        
        MapofNames.put(opli.OpportunityID,opli.Product2Id);
        MapofNames.put(opli1.OpportunityID,opli1.Product2Id);
        
        string namesofOpp1 = [select name from opportunity where Id IN: MapofNames.keySet()].name;
        prd = [select Id,Opportunity_Names__c from Product2 where Id in: MapofNames.values()];
        string allnames=(string) prd.get('Opportunity_Names__c');
        
        prd.Opportunity_Names__c = allnames+';'+namesofOpp1;// concanated the names previous and current
        update prd;
        
        System.assertEquals('Test trigger;Test trigger1', prd.Opportunity_Names__c);
    }
}

is not writeable: "OpportunityLineItem.PricebookEntryId" this error in test class.
Hi Expert,

I am new to the programming world. I have a custom controller which insert a contact created on VF page. Now I am not able to write test class for this. I could only cover 56% code.
 
public class TestPopup {
    
    public list<Account> acc{get;set;} 
    public Account acc1 {get;set;} 
    public Contact contact {get;set;}
    public List<Contact> conlist;
    public Boolean displayPopup {get;set;}
    public String accid {get;set;}
       

    public TestPopup(){
        acc = [select ID, Name, AccountNumber,Type from Account];
	    acc1 = new Account();
        conlist = new List<Contact>();
        contact = new Contact();
        	
    }
   
    public list<Account> getacc(){
        return acc;
    }
    
    public void showPopup()
    { 
    	displayPopup = true;
        acc1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :accid];
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }

    public PageReference save(){
        contact.AccountId= acc1.Id;
        insert contact;
        ID contactId = contact.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}
 
@isTest
public class TestCustomController {
     static testMethod void testMethod1() 
     {
         Account testAccount = new Account();
         testAccount.Name='Test Account';
         insert testAccount;
         
         Contact cont = new Contact();
         cont.LastName = 'Test';
         cont.FirstName = 'Contact';
         cont.AccountId = testAccount.Id;
          // insert cont;
         
         Account testAccount1 = new Account();
         testAccount1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :testAccount.Id];
       
         
         
         Test.StartTest(); 
         PageReference pageRef = Page.All_Account; // Add your VF page Name here
         pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
         Test.setCurrentPage(pageRef);
         
         TestPopup testAccPlan = new TestPopup();  
         testAccPlan.getacc();
        // testAccPlan.showPopup(); 
         testAccPlan.closePopup();
         
         Test.StopTest();
         
     } 
}

 
Hi Expert,

I am new to the programming world. I have a custom controller which insert a contact created on VF page. Now I am not able to write test class for this. I could only cover 56% code.
 
public class TestPopup {
    
    public list<Account> acc{get;set;} 
    public Account acc1 {get;set;} 
    public Contact contact {get;set;}
    public List<Contact> conlist;
    public Boolean displayPopup {get;set;}
    public String accid {get;set;}
       

    public TestPopup(){
        acc = [select ID, Name, AccountNumber,Type from Account];
	    acc1 = new Account();
        conlist = new List<Contact>();
        contact = new Contact();
        	
    }
   
    public list<Account> getacc(){
        return acc;
    }
    
    public void showPopup()
    { 
    	displayPopup = true;
        acc1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :accid];
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }

    public PageReference save(){
        contact.AccountId= acc1.Id;
        insert contact;
        ID contactId = contact.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}
 
@isTest
public class TestCustomController {
     static testMethod void testMethod1() 
     {
         Account testAccount = new Account();
         testAccount.Name='Test Account';
         insert testAccount;
         
         Contact cont = new Contact();
         cont.LastName = 'Test';
         cont.FirstName = 'Contact';
         cont.AccountId = testAccount.Id;
          // insert cont;
         
         Account testAccount1 = new Account();
         testAccount1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :testAccount.Id];
       
         
         
         Test.StartTest(); 
         PageReference pageRef = Page.All_Account; // Add your VF page Name here
         pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
         Test.setCurrentPage(pageRef);
         
         TestPopup testAccPlan = new TestPopup();  
         testAccPlan.getacc();
        // testAccPlan.showPopup(); 
         testAccPlan.closePopup();
         
         Test.StopTest();
         
     } 
}

 
Hello,

I am trying to uninstall a managed package. I've solved all of the other errors related to uninstalling the package. However, the one that I can't figure out is where it says the following:

Component Type: Package
Name: ServiceMax
Problem: This extension depends on the package you are trying to uninstall. CreateWOfromLocation

CreateWOfromLocation is an Apex Class that I had but had to remove in order to uninstall ServiceMax (I was getting error messages that I couldn't uninstall because of that Apex Class).

I can't go into the package because it tells me that my Production organization is not the one that installed the package. None of the sandboxes I have can access it too.

I'm not sure what I'm doing wrong.

Thanks,

Brian