• The new Learner
  • NEWBIE
  • 150 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 65
    Questions
  • 96
    Replies
Hi Experts,
 
Need to create a button two new buttons Record Create and Record Edit, by clicking on  Record Create button it has to open Record create a form with record type. similarly, by click on the Record Edit button, it has to open the Edit record form with record type. Can anyone help me out?
Hi  Experts,
 
I have requirement as follows , need to create a dropdown of accounts and on selecting specific account get a related list of contact with a specific field of that account with pagination
Hi Experts,

I need to create a button called Edit record, it will open the current record in edit view and the user can change details and save. can anyone help me, I have written below however it's not working for me.
 
Template:

<template>
    <template if:true={showRecScreen}>
        <lightning-record-edit-form
    object-api-name={objectApiName}
    record-id={recordId}>
        <lightning-input-field
            field-name={nameField}>
        </lightning-input-field>
        <div class="slds-var-m-top_medium">
            <lightning-button
                variant="brand"
                type="submit"
                label="Save">
            </lightning-button>
        </div>
</lightning-record-edit-form> 
    </template>
    <lightning-button name="Update" label="Updateedit" onclick={handleUpdate}></lightning-button>
</template>

JS:

import { LightningElement,api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';

import NAME_FIELD from '@salesforce/schema/Account.Name';

export default class Editrecordeditformpage extends LightningElement {
    @api objectApiName = 'Account';
	showRecScreen = false;

    nameField = NAME_FIELD;

 
	
	handleUpdate(){
	this.showRecScreen = true;  
	}

    handleSuccess(event) {
        const evt = new ShowToastEvent({
            title: "Account created",
            message: "Record ID: " + event.detail.id,
            variant: "success"
        });
        this.dispatchEvent(evt);
    }

}

 
Hi Experts,

I have a requirement, if a user clicks on a button it needs to open the record create form and a user can create a related object record on save. can anyone help me on this?
Hi Experts, 
 
I need allow to edit the field called assitance__c on accountcontactrelationship record  by the Users in Assigned Territories (related list of an account) and system admin, account manager. can anyone help me out. how to achieve this.
Hi Experts,
 
I have written a trigger, when the opportunity contain inactive product I need to throw an error, however, its working fine for one product, when it have more than one , when I am trying to delete it's not working its throwing an error by saying  "select correct product"
can anyone help me out? 
 
public static void products(Set<Id> oppIds, List<Opportunity> opplist)
    {
        
        List<OpportunityLineItem> opplineitems = [SELECT OpportunityId FROM OpportunityLineItem WHERE Product2.IsActive = false AND OpportunityId IN: OppIds];
        
        Set<Id> opptyId = New Set<Id>();
        for(OpportunityLineItem opplt:opplineitems)
        {
            
            opptyId.add(opplt.OpportunityId);
        }
        
        for (Opportunity opp :opplist) 
        {
            
            if(opptyId.contains(opp.Id))
            {
                
                opp.addError('select correct product');

            }
        }
            
    }

 
Hi Experts,

I want to post a chatter on the event record on a daily basis when the event status-completed and When the Event Date is passed. Chatter should not update the same record in their next batch . Kindly help me out.
Hi Experts,

Can anyone help me out, how to achieve the below functionality using a trigger.

Need to link all contacts from the related account that are flagged as key contacts to an opportunity on that account when it is created.
Thanks in advance.
Hi Experts,

I have requirment i need to update account field  product_value__c with the  product  field Family__c( all the product values has to add to product value field),when ever the opprotunity stage is closed. to achieve this i have written batch class on opportunity but its not working as expected. Its taking lot of time to update records.
 
global class batchAccountUpdate implements Database.Batchable<sObject> {
    
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        
        String query = 'SELECT id,Accountid,stagename,IsRenewal__c FROM Opportunity ';
        
        return Database.getQueryLocator(query);
        
    }
    

    
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
        
        set<id>accountids= new set<id>();
        set<id>opptyids= new set<id>();
        set<Id> addOn = new set<Id>();
        list<account>accountupdate= new list<account>();
        map<id,account> accmap = new map<id,account>();
        Map<id,OpportunityLineItem > accountid=new map<id,OpportunityLineItem >();  
         Map<id,Product2 > products=new map<id,Product2 >();
        for(Opportunity o : scope)
        {
            if(o.stagename=='closed')
            {
              
                opptyids.add(o.id);
            }  
            
        }
        
        for(Product2 oli : [SELECT id,Business__c,Family__c FROM Product2 where Business__c = 'sales']) 
        {
            
            addOn.add(oli.Id);
            products.put(oli.id,oli);
             
        }
        
        Map<Id,OpportunityLineItem > oppsToget = new Map<Id,OpportunityLineItem >([SELECT id,Product_Lookup__r.Business__c,Product_Lookup__r.Family__c,OpportunityId,Product_Lookup__c,opportunity.accountid,opportunity.StageName FROM OpportunityLineItem where Product_Lookup__c IN:products.keyset() and opportunityid in:opptyids]);
       
        for (OpportunityLineItem oli3: oppsToget.values())
        {
            accountid.put(oli3.opportunity.accountid,oli3);
           
            
        } 
        
        Map<Id,Account> mapAccount = new Map<Id,Account> ([select id,product_value__c from account where id in :accountid.keyset()]);    
        for(account a:mapAccount.values())
        {
            if(accountid.containskey(a.id))
            {
                system.debug('@@accountid.containskey(a.id)'+accountid.containskey(a.id)); 
                for(OpportunityLineItem line: accountid.values())
                {
                    if(line.Product_Lookup__c!= null)
                    {
                     
                           String prodstring='';
                           set<string>unique=new set<String>();  
                           for(String s:line.Product_Lookup__r.Family__c.split(','))
                           {
                           unique.add(s);
                            system.debug('@@unique'+unique);  
                           }
                            if(unique.size()!=0){
                        for(String st : unique ){  
                            prodstring = prodstring +','+ st;
                              system.debug('@@prodstring '+prodstring );
                            }
                         }
                        a.product_value__c = prodstring;
                      
                        accountupdate.add(a);
                      
                        
                       
                    }  
                }
            }
        }
        accmap.putall(accountupdate);

        if(!accmap.isEmpty()){
            Database.SaveResult[] IsShareResult = Database.update(accmap.values(), false);
            
        }
    }   
    
 
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}

 
HI Experts,

Can anyone help me out, how can i send an email to public group users under a queue based on language. Thanks in advance
HI Experts,

I want to send an email to queue members when ever the lead is created. when new lead is created its assigining to queue. now i want to send an email for queue users can anyone help me. thanks in advance
HI Experts,

I have written a visual force component and an apex class, problem over here is that, i can able to cover upto 73%, and not able to cover soql queries , lines which i bolded those are the lines which i am not able to cover. can anyone help me  please below is my code.
 
public with sharing class CampaignApprovalReject {
    
    
  public String camIds {get;set;}
    public Campaign camp{get;set;}
    Public ProcessInstanceStep pStep{get;set;}
    Public String sfdcBaseURL{get;set;}
    
    
    public CampaignApprovalReject (){
        
    }
    public ProcessInstanceStep getApprovalSteps() {
       
        if (camIds != null) 
        {
           
            pStep = [Select SystemModstamp,StepStatus, ProcessInstanceId, OriginalActorId,OriginalActor.Name,
                     Comments, ActorId From ProcessInstanceStep where ProcessInstance.TargetObjectId=:camIds order by SystemModstamp desc limit 1];  
            system.debug('@@@pStep'+pStep); 
        }
        return pStep ;
    }
    
    Public campaign getcampaigns(){
        if (camIds != null) 
        {
            camp= [Select id,name,Type,Description__c,ParentName__c from campaign where id=:camIds limit 1];
            
        }
        
        return camp;
    }
 
    
    public List<ProcessInstanceHistory> getrecallApprovalSteps() 
    {
        if (camIds != null) 
        {
            camp= [Select Id, (Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) from campaign where Id = :camIds ];
            return camp.ProcessSteps;
        }
        return new List<ProcessInstanceHistory>();
    }
    
    Public String getURL(){
        if (camIds != null) {
            sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+camp.id;
        }
        return sfdcBaseURL;
    }
    
}

Below is my test class.
 
@isTest
public class Campaign_Test {
    @isTest static void myTest() 
    {
        
        Campaign a = new Campaign ();
        a.Name='Example';
        a.Description__c='test';
        a.Status='Planned';
        a.StartDate=system.today();
        a.CurrencyIsoCode='USD';
        a.Parent__c=true;
        a.type='Nurture';
        insert a;
        Campaign a2=[Select id,name,Type,CAP_WT_Campaign_Short_Description__c from campaign where name='Example' LIMIT 1];
        System.assert(a2!=null);        
        Approval.ProcessSubmitRequest req1 =  new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval.');
        req1.setObjectId(a.id);
        req1.setProcessDefinitionNameOrId('Example_Process');
        req1.setSkipEntryCriteria(true);
        CampaignApprovalReject cmp = new CampaignApprovalReject();
        ProcessInstanceStep  process = cmp.getApprovalSteps();
        Campaign itemObj = cmp.getcampaigns();
        list<ProcessInstanceHistory> PI=cmp.getrecallApprovalSteps();
        string itemob=cmp.getURL();
        cmp.camIds='Example';
        System.assertEquals('Example', a.Name);
        
    }
}

 
HI Experts,

I have requirment where i need to create VF email template, using custom labels for each section to allow for users receiving the template to see it in their own language.  Can anyone help me how to create it.
HI Experts,

I have requirment where i need to login attempts of a community user ,its more than 5 login attempts , i need to populate an error message. can anyone help me please.
I have to populate the image based on the below conditions.

1. when the record type is "sales" or "service" and Date__c is greater than (Today() -160) then it should be green.
2. when the record type is "sales" or "service" and Date__c is less than (Today() -160) then it should be red.
3. when the record type is "sales" or "service" or "marketing" and status is not equal "renewed" and date__c <today then it should be red.
4. when image__c field is is not blank then it should it should be grey.

can anyone help me please.
Hi Experts,

I want to display a logo from second page page onwards, in an visulforce page can anyone help me how to do that.(from second page onwards that image has to be there in every page )
HI Experts,

Can anyone help me out, how to create below table format using html or apex table.
User-added image
Hi Experts,

I am rendering a pdf and populating data for every single record i want to break and again i need to show in seprate table next record. can anyone let me know please how to do that.
Hi Experts,

I have requirment i need  download account related contact object records as pdf, i can able to make it as pdf, but , i want download once i click on that button,i am using this page as button source. can anyone help me.
 
<apex:page readOnly="true"     
           standardController="Account"    
           applyHtmlTag="false"     
           sidebar="false"     
           showHeader="false"     
           cache="true"     
           renderAs="advanced_pdf">    
        
    <head>    
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />    
        <style type="text/css">    
            
            @page {    
              
                size: A4 landscape;    
                border: 2px solid black;    
                padding-left: 8px;    
                padding-right: 8px;      
                  
            }    
                
            th {    
              
                text-align: center;    
                font-weight: bold;    
                  
            }    
                
                
            td {    
              
                text-align: center;    
                font-size: 14px;    
                  
            }    
                
        </style>    
          
    </head>    
      
    <center>    
      
        <h3>Testing Advanced PDF = {!Account.Name}</h3>    
          
    </center><br/><br/>    
      
    <table border="1" width="99%">    
      
        <tr>    
          
            <th>First Name</th>    
            <th>Last Name</th>    
              
        </tr>    
        <apex:repeat value="{!Account.Contacts}" var="con">    
          
            <tr>    
              
                <td>{!con.FirstName}</td>    
                <td>{!con.LastName}</td>    
                  
            </tr>    
              
        </apex:repeat>    
          
    </table>    
    
</apex:page>

 
Hi Experts,

Can anyone let me know how to cast sobject to a specific object vice versa please. below i am getting the records, now i want to cast that object to specifi object.
SObjectType objectType = records.getSObjectType();
Hi Experts,

Can anyone help me how to write test class for the below method.

public override void onCommit(){
        
        OM_ManageService manageRemittanceSVC = (OM_ManageRService)this.svc;
        String accJSON = OM_WorkService.getJSONAttribute(manageRemittanceSVC.jsonString, 'AccountInfo');
        Map<String, List<SObject>> accObjects =  OM_WorkService.getSObjects(accJSON);
        Account acc = (Account)accObjects.get('Account')[0];
        
        if(acc!= null){
            upsert acc;
            super.onCommit();
            
            }
            
        Below is the OM_WorkService.getJSONAttribut    
             
             public static String getJSONAttribute(String jsonStr, String attr){
        Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(jsonStr);
        if(m.containsKey(attr))
            return (String)m.get(attr);
        
        return null;
    }
 
Hi  Experts,
 
I have requirement as follows , need to create a dropdown of accounts and on selecting specific account get a related list of contact with a specific field of that account with pagination
Hi Experts,

I have a requirement, if a user clicks on a button it needs to open the record create form and a user can create a related object record on save. can anyone help me on this?
Hi Experts,
 
I have written a trigger, when the opportunity contain inactive product I need to throw an error, however, its working fine for one product, when it have more than one , when I am trying to delete it's not working its throwing an error by saying  "select correct product"
can anyone help me out? 
 
public static void products(Set<Id> oppIds, List<Opportunity> opplist)
    {
        
        List<OpportunityLineItem> opplineitems = [SELECT OpportunityId FROM OpportunityLineItem WHERE Product2.IsActive = false AND OpportunityId IN: OppIds];
        
        Set<Id> opptyId = New Set<Id>();
        for(OpportunityLineItem opplt:opplineitems)
        {
            
            opptyId.add(opplt.OpportunityId);
        }
        
        for (Opportunity opp :opplist) 
        {
            
            if(opptyId.contains(opp.Id))
            {
                
                opp.addError('select correct product');

            }
        }
            
    }

 
Hi Experts,

I want to post a chatter on the event record on a daily basis when the event status-completed and When the Event Date is passed. Chatter should not update the same record in their next batch . Kindly help me out.
Hi Experts,

Can anyone help me out, how to achieve the below functionality using a trigger.

Need to link all contacts from the related account that are flagged as key contacts to an opportunity on that account when it is created.
Thanks in advance.
Hi Experts,

I have requirment i need to update account field  product_value__c with the  product  field Family__c( all the product values has to add to product value field),when ever the opprotunity stage is closed. to achieve this i have written batch class on opportunity but its not working as expected. Its taking lot of time to update records.
 
global class batchAccountUpdate implements Database.Batchable<sObject> {
    
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        
        String query = 'SELECT id,Accountid,stagename,IsRenewal__c FROM Opportunity ';
        
        return Database.getQueryLocator(query);
        
    }
    

    
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
        
        set<id>accountids= new set<id>();
        set<id>opptyids= new set<id>();
        set<Id> addOn = new set<Id>();
        list<account>accountupdate= new list<account>();
        map<id,account> accmap = new map<id,account>();
        Map<id,OpportunityLineItem > accountid=new map<id,OpportunityLineItem >();  
         Map<id,Product2 > products=new map<id,Product2 >();
        for(Opportunity o : scope)
        {
            if(o.stagename=='closed')
            {
              
                opptyids.add(o.id);
            }  
            
        }
        
        for(Product2 oli : [SELECT id,Business__c,Family__c FROM Product2 where Business__c = 'sales']) 
        {
            
            addOn.add(oli.Id);
            products.put(oli.id,oli);
             
        }
        
        Map<Id,OpportunityLineItem > oppsToget = new Map<Id,OpportunityLineItem >([SELECT id,Product_Lookup__r.Business__c,Product_Lookup__r.Family__c,OpportunityId,Product_Lookup__c,opportunity.accountid,opportunity.StageName FROM OpportunityLineItem where Product_Lookup__c IN:products.keyset() and opportunityid in:opptyids]);
       
        for (OpportunityLineItem oli3: oppsToget.values())
        {
            accountid.put(oli3.opportunity.accountid,oli3);
           
            
        } 
        
        Map<Id,Account> mapAccount = new Map<Id,Account> ([select id,product_value__c from account where id in :accountid.keyset()]);    
        for(account a:mapAccount.values())
        {
            if(accountid.containskey(a.id))
            {
                system.debug('@@accountid.containskey(a.id)'+accountid.containskey(a.id)); 
                for(OpportunityLineItem line: accountid.values())
                {
                    if(line.Product_Lookup__c!= null)
                    {
                     
                           String prodstring='';
                           set<string>unique=new set<String>();  
                           for(String s:line.Product_Lookup__r.Family__c.split(','))
                           {
                           unique.add(s);
                            system.debug('@@unique'+unique);  
                           }
                            if(unique.size()!=0){
                        for(String st : unique ){  
                            prodstring = prodstring +','+ st;
                              system.debug('@@prodstring '+prodstring );
                            }
                         }
                        a.product_value__c = prodstring;
                      
                        accountupdate.add(a);
                      
                        
                       
                    }  
                }
            }
        }
        accmap.putall(accountupdate);

        if(!accmap.isEmpty()){
            Database.SaveResult[] IsShareResult = Database.update(accmap.values(), false);
            
        }
    }   
    
 
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}

 
HI Experts,

Can anyone help me out, how can i send an email to public group users under a queue based on language. Thanks in advance
HI Experts,

I want to send an email to queue members when ever the lead is created. when new lead is created its assigining to queue. now i want to send an email for queue users can anyone help me. thanks in advance
HI Experts,

I have written a visual force component and an apex class, problem over here is that, i can able to cover upto 73%, and not able to cover soql queries , lines which i bolded those are the lines which i am not able to cover. can anyone help me  please below is my code.
 
public with sharing class CampaignApprovalReject {
    
    
  public String camIds {get;set;}
    public Campaign camp{get;set;}
    Public ProcessInstanceStep pStep{get;set;}
    Public String sfdcBaseURL{get;set;}
    
    
    public CampaignApprovalReject (){
        
    }
    public ProcessInstanceStep getApprovalSteps() {
       
        if (camIds != null) 
        {
           
            pStep = [Select SystemModstamp,StepStatus, ProcessInstanceId, OriginalActorId,OriginalActor.Name,
                     Comments, ActorId From ProcessInstanceStep where ProcessInstance.TargetObjectId=:camIds order by SystemModstamp desc limit 1];  
            system.debug('@@@pStep'+pStep); 
        }
        return pStep ;
    }
    
    Public campaign getcampaigns(){
        if (camIds != null) 
        {
            camp= [Select id,name,Type,Description__c,ParentName__c from campaign where id=:camIds limit 1];
            
        }
        
        return camp;
    }
 
    
    public List<ProcessInstanceHistory> getrecallApprovalSteps() 
    {
        if (camIds != null) 
        {
            camp= [Select Id, (Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) from campaign where Id = :camIds ];
            return camp.ProcessSteps;
        }
        return new List<ProcessInstanceHistory>();
    }
    
    Public String getURL(){
        if (camIds != null) {
            sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm()+'/'+camp.id;
        }
        return sfdcBaseURL;
    }
    
}

Below is my test class.
 
@isTest
public class Campaign_Test {
    @isTest static void myTest() 
    {
        
        Campaign a = new Campaign ();
        a.Name='Example';
        a.Description__c='test';
        a.Status='Planned';
        a.StartDate=system.today();
        a.CurrencyIsoCode='USD';
        a.Parent__c=true;
        a.type='Nurture';
        insert a;
        Campaign a2=[Select id,name,Type,CAP_WT_Campaign_Short_Description__c from campaign where name='Example' LIMIT 1];
        System.assert(a2!=null);        
        Approval.ProcessSubmitRequest req1 =  new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval.');
        req1.setObjectId(a.id);
        req1.setProcessDefinitionNameOrId('Example_Process');
        req1.setSkipEntryCriteria(true);
        CampaignApprovalReject cmp = new CampaignApprovalReject();
        ProcessInstanceStep  process = cmp.getApprovalSteps();
        Campaign itemObj = cmp.getcampaigns();
        list<ProcessInstanceHistory> PI=cmp.getrecallApprovalSteps();
        string itemob=cmp.getURL();
        cmp.camIds='Example';
        System.assertEquals('Example', a.Name);
        
    }
}

 
I have to populate the image based on the below conditions.

1. when the record type is "sales" or "service" and Date__c is greater than (Today() -160) then it should be green.
2. when the record type is "sales" or "service" and Date__c is less than (Today() -160) then it should be red.
3. when the record type is "sales" or "service" or "marketing" and status is not equal "renewed" and date__c <today then it should be red.
4. when image__c field is is not blank then it should it should be grey.

can anyone help me please.
Hi Experts,

I want to display a logo from second page page onwards, in an visulforce page can anyone help me how to do that.(from second page onwards that image has to be there in every page )
Hi Experts,

I am rendering a pdf and populating data for every single record i want to break and again i need to show in seprate table next record. can anyone let me know please how to do that.