• Deepali Kulshrestha
  • ALL STAR
  • 5814 Points
  • Member since 2016
  • Salesforce Developer
  • Cloud Analogy


  • Chatter
    Feed
  • 177
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 1471
    Replies
I have 2 custom objects:- They have no relations in between Request and Response..Both objects are having common fields Name,Add, Phone no :- When I update Address field in Request object it should update in response object as well?
I am working on the trailhead link : Control Access to Fields
Learning Objectives
https://trailhead.salesforce.com/content/learn/modules/data_security/data_security_fields

I cloned the profile "Standard User", but I am not understanding how salesforce as mentioned to give Field Permissions: Rating field of account object.

So this is stopping me from completing my trailhead.

Thanks
Tina
I need to update parent record from child record. So, I have  four objects- Case, WorkOrder, ServiceAppointmen, ServiceReport. I need to write a trigger when ServiceReport record is created then field (Test__c)  of Case object should be checked. Case is parent object of  Workorder, Workorder is parent Object of ServiceAppointment, ServiceAppointment is Parent object of Service report. I have written a trigger and able to upate the field of ServiceAppointment when service report is created but I need to update the field of case .So, I am unable to fetch the Case record's detail from my triggger and do the updation.

trigger :-
trigger sendEmail on ServiceReport (After insert) {
            list<Id> SerApp = new list<id>();
    for(ServiceReport sr : trigger.new){
        SerApp.add(sr.Parentid); 
    }
             list<ServiceAppointment> sa = [SELECT id,Report_Generated__c from ServiceAppointment WHERE id in: SerApp];
      for(ServiceAppointment a : sa){
                a.Report_Generated__c = true;
              }
         update sa;


}

 
A. A controller extension method that saves a list of account records.
B. Custom javascript that processes a list of account records.
C. A controller extension method that uses SOQL to query for a list of account records
D. A list of account records returned from a controller extension method
Hi all,
Need help. I am still a novice with Development, hence would need someone to please help me with the below query.

Background: We are having a custom object as 'Survey', which is having around 10-12 fields (combination of Text and picklist field).

Use of the Object: The fields in this object 'Survey' are getting populated dynamically - through AMP Script from Marketing Cloud. As these surveys are sent to customers through Marketing Cloud emails, and whatever input the customer add on the Survey Cloud Page, it automatically gets recorded under same name fields in Sales Cloud object.

Requirement: We want to send an 'Email Notification' to the Manager, each time a survey gets recorded in the Sales Cloud Object 'Survey' object.
Also, the Notification Email should display the 'Customer Name' 'Email' &  'Answers to all the questions of the Survey'.

I am not too sure how to achieve this using Apex and Trigger ?
Can someone please help me with this and explain the steps in basic language.

Thanks in advance !
Hi,

Can you please let me know how to collect data from developer console execution log.


Thanks,
Nitesh Singi
Hello All,

I am trying to call other component using aura:method, but getting some errors. I appreciate if you can help.
Apex Controller


public class TestingIntegrationErrorHandling {
    @AuraEnabled
    public static object sampleCallout(){
        system.debug('entered apex');
       
        return object;
    }
}

The controller is working perfect
 
Parent Component:

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="CDI_TestingIntegrationErrorHandling" >
	<aura:attribute name="messageLog" type="Object__C" />
    <c:CDI_TestComponentParent aura:id="child"/>
    <lightning:button label="CallErrorHandlingComp" onclick="{! c.callChildMethod }" />
</aura:component>

Controller:
callChildMethod : function(component, event, helper) {
       console.log('calling child method');
       
        var action = component.get("c.sampleCallout"); 
        action.setCallback(this, function(result){
            var messageLog = result.getReturnValue();
            console.log('---messageLog-- ' + messageLog);
            component.set("v.messageLog", messageLog);
            
        });
        var childCmp = component.find("MessagePanel");
        var retnMsg = childCmp.executeMyMethod(messageLog);
        consolo.log('executing child');
        
        $A.enqueueAction(action);      
        
	}
 
Child component:
<aura:component access="global">	
    <aura:method name="executeMyMethod" action="{!c.executeMyMethod}">
         <aura:attribute name="messageLog" type="MessageLog__c" />
    </aura:method>	
</aura:component>

Controller:
executeMyMethod : function (component, event, helper) {
        var params = event.getParam('arguments');
        if (params) {
            var param1 = params.MessageLog__c;
			console.log('param1  ' + param1);
            component.set('v.messageLog',params.MessageLog__c);
            
        }
    }

Thank you for your help
Hello,

I have created a button and added to the related paga layout, but this button is not visible.
How can i see it ?

thank you for suggestion 
  • November 13, 2019
  • Like
  • 0
Hi All,
I have written following inbound email service for lead object.
global class LeadServices implements Messaging.InboundEmailHandler
{
    global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email, Messaging.InboundEnvelope env)
    {
        Messaging.InboundEmailResult result = new  Messaging.InboundEmailResult();
        string emailbody = email.plaintextbody;
        string emailsubject = email.subject;
        string subToCompare = emailsubject.Substring(emailsubject.indexof('ref :') + 5).trim();
        try
        {
            lead l = [SELECT
                Id, 
                Name, 
                Email
            FROM
                lead
            WHERE
                id  = : subToCompare];
            // Add a new Task to the lead record we just found above.
            Task newTask = new  Task();
            newTask.Description = emailbody;
            newTask.Priority = 'Normal';
            newTask.Status = 'Inbound Email';
            newTask.Subject = emailsubject;
            newTask.IsReminderSet = true;
            newTask.ReminderDateTime = System.now();
            newTask.WhoId = l.Id;
           
            Insert newTask;
        }
        catch(QueryException e)
        {
            System.debug('Issue: ' + e);
        }
        result.success = true;
        return result;
    }
}
I am have having 55% code coverage now.
Can someone please hepl me with test class for this?

Thanks in Advance

Regards,
Ramana
Hello, 
I'm trying to create a trigger to update a field based on the value of another field. The field I'm trying to update is a picklist and the values I'm trying to update it to are active picklist values. There are various HS_Original_Source__c values that if they are populated, I want the standard leadsource field to have it's equivilant value. Ex. HS_Original_Source__c is ORGANIC SEARCH and would map to leadsource of Organic Search.
 
trigger LeadSourceTrigger on Opportunity (before update, before insert) {
 List<Opportunity> oppList = new List<Opportunity>();
    
    //Go through the updated records coming into the database and update their custom fields 
    //according to the updated lead source 
    for(Opportunity opp : Trigger.new)
    {
        if(opp.LeadSource == '' && opp.HS_Original_Source__c != '' && opp.HS_Original_Source__c != 'OFFLINE')
        {
          if(opp.HS_Original_Source__c == 'ORGANIC SEARCH')
          {
               opp.LeadSource = 'Organic Search';
               System.debug('organic search');
           }
           /*
              if(opp.HS_Original_Source__c == 'next value')
          {
               opp.LeadSource = 'next value';
               System.debug('next value');
           }
           
           
            */
          
          //Put each updated record in the list created
          oppList.add(opp);  
        }
        
 }
 }

Any help would be much appreciated.
I have a visual force page that uses the apex:repeat to loop through the Opportunity line items. B

ut the order is not as it displayed in the Opportunity. I

can check the SortOrder value of the line item, but this value is updated only when the user clicks the "Sort" button.

Questions:
  1. Is there a way to get items as they are displayed in the opp?
  2. If not, can I trigger the SortOrder value to be updated without the sort button?
var ProductsArr = new Array();

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="lineitem"> var product_row = {name:"{!lineitem.product2.name}", quantity:{!lineitem.quantity}, ID:{!lineitem.product2.Hasavshevet_product_ID__c},price:{!lineitem.UnitPrice}};

console.log("{!lineitem.SortOrder}"); ProductsArr.push(product_row);
</apex:repeat>

Example

Hi,
I am trying to create an account and when the account is created a contact will be created and the checkbox should be true..

i have created an account but the checkbox remainis false and when i am again trying to create a new contact i am getting this error... UpdateContact: execution of AfterInsert caused by: System.SObjectException: Invalid field Account Id for AggregateResult Class.AccountContact.updateCheckBox: line 22, column 1 Trigger.UpdateContact: line 3, column 1

public class AccountContact{
    public static void onBefore(List<Account> acctList){
        List<Contact> conList = new List<Contact>();
        for(Account acc: acctList){
            Contact con = new Contact(AccountId = acc.ID);
            con.FirstName = 'Info';
            con.LastName = 'Default';
            con.Email = 'info@websitedomain.tld';
            acc.OnlyDefaultContact__c = TRUE;
            conList.add(con);
        }
        insert conList;
    }
    public static void updateCheckBox(List<Contact> contList){
        Set<id> accountIds = new Set<id>();
        for(Contact con: contList){
            accountIds.add(con.Accountid);
        }
        List<Account> updateAccount = new List<Account>();
        for(AggregateResult ar: [Select count(id), AccountId from Contact where AccountId IN
                                 : accountids group by AccountId having count(id)>1]){
			updateAccount.add(new Account(id = (id)ar.get('Account Id'),OnlyDefaultContact__c
                                = FALSE));
        }
    }
}

//trigger

trigger InsertContact on Account (after insert) {
    if(Trigger.isBefore && Trigger.isInsert){
    	AccountContact.onBefore(Trigger.new);
    }
}


trigger UpdateContact on Contact (after insert) {
	if(Trigger.isInsert && Trigger.isAfter){
		AccountContact.updateCheckBox(Trigger.new);
    }
}
I have an Apex Class and Apex Test Class that were written by a devloper.  I am not a developer.  I'm having trouble validating a change to the Apex Class in production but not in the sandbox.  Is there a non-developer guide to how Apex Test Classes work?  I thought the test class created a dummy record to run the Apex Class against.  I commented out the lines in the Test Class that deleted the dummy record, but I can't find it after running the test.  Am I misunderstanding how the Test Class works?
Thanks
This Trigger will send an email alert when an account has 8 cases created within 7 days.  Depending on the status of `cl.Parent_Project_if_applicable__r.Implementation_status__c`
The destination of that email will go one of two places.

In the Else block, I am assigning the value `clientEmail` which is only one email address not a List.  I am receiving the error:  

`Line: 66, Column: 9
Illegal assignment from String to List<String>`

HOw do I assign the value to the `mail.toAddresses`?
 
String messageToSend;
   				List<String> ListOfMessages = new List<String>();
   		     	Set<Id> AcctIds = new Set<Id>();
				List<String> clientEmail;
				List<String> emailAdds = getAddresses();

List<AggregateResult> AggregateResultList = [SELECT AccountId, Account.Name name, COUNT(Id) co
                                             FROM Case
                                             WHERE CreatedDate = LAST_N_DAYS:8
                                             GROUP BY AccountId, Account.Name
                                             HAVING COUNT(Id)  = 7];
    		 
            Map<Id, String> accountIdEmailmessageMap = new Map<Id, String>();
            
				for(AggregateResult aggr: AggregateResultList){
                String messageToSend = 'Account name: ' + aggr.get('name') +
                    ' has ' + (Integer)aggr.get('co') +
                    ' cases opened in the last 8 days.';
                Id accId = (Id)aggr.get('AccountId');
                accountIdEmailmessageMap.put(accId,messageToSend);
                AcctIds.add(accId); 
            }
            
			
List<Case> caseList = [SELECT Id, AccountId, Account.Name,Parent_Project_if_applicable__r.Implementation_status__c,
                       Parent_Project_if_applicable__r.PM_Implementation_Status__c, 
                       Parent_Project_if_applicable__r.RCM_Implementation_Status__c,
                       Parent_Project_if_applicable__r.Client_Advisor_Email__c
                       FROM Case
                       WHERE AccountId IN :AcctIds];

  

for(Case cl:caseList){ 
   
    
    String clientEmail = cl.Parent_Project_if_applicable__r.Client_Advisor_Email__c;
   
    if(cl.Parent_Project_if_applicable__r.Implementation_status__c == 'Live - Closed Project'){    
        //Private method *** getAddresses() *** retrieves email address from Customer_Success_Managers Public Group
			String messageBody = accountIdEmailmessageMap.get(cl.AccountId);
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
		mail.setToAddresses(emailAdds);
		mail.setSenderDisplayName('IT Support'); 
        mail.Subject = 'Multiple cases created alert message';
        mail.setPlainTextBody(messageBody);
        
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

        
        System.debug('Imp ' + cl.Parent_Project_if_applicable__r.Implementation_status__c +
                     ' PM ' + cl.Parent_Project_if_applicable__r.PM_Implementation_Status__c + 
                      ' RCM ' + cl.Parent_Project_If_Applicable__r.RCM_Implementation_Status__c +
                       ' Email ' + cl.Parent_Project_If_Applicable__r.Client_Advisor_Email__c);
          
    }
    else{  
             
      Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
	   // mail.SenderDisplayName('Salesforce Support');
        mail.toAddresses = clientEmail;
        mail.Subject = 'Subject Test Message';
        mail.setPlainTextBody(messageToSend);
        
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 
        
       // System.debug('in the loop: ' + messageToSend);
         
    }

    //	message.Subject = 'Subject Test Message';
    //    message.PlainTextBody = 'Account name: ' + cl.get('name') + ' has ' + (Integer)cl.get('co') + ' cases opened in the last 8 days.';
    //    Messaging.SingleEmailMessage[] messages =   new List<Messaging.SingleEmailMessage> {message};
    //    Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
}


private List<String> getAddresses(){
    List<User> UserList =
        [SELECT id, name, email
         FROM User 
         WHERE id 
         IN (SELECT userorgroupid 
             FROM groupmember
             WHERE group.name = 'Customer Success Managers')];
    
    List<String> emailString = new List<String>();
    
    for(User u: UserList){
        emailstring.add(u.email);
    }   
    return (emailString);
    //System.debug(emailString);
}

 
How can I remove the phone icon from page layouts? 

Here is the icon: phone icon

Thank you!
Dear Team ,

Greetings !!!

Please clarify me how   <aura:attribute name="mycolumns" type="List"/>

Type=List will works in Attribute how it is different from array.
global class UnlockRecordBatchJob implements Database.batchable<sObject> {
    //Start of this batch job
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT Id FROM Case LIMIT 50000000 '; //50 Million records
        return Database.getQueryLocator(query);
    }
    //Exeution of batch job
    global void execute(Database.BatchableContext BC, List<Case> scope) { //Scope max = 2000
        //List<Case> caseList = [SELECT Id From CaseLimit 2]; case already in scope varible
        //Check locked records
        List<Case> caseLockList = new List<Case>();
        for(Case c : scope)
        {
            if(Approval.isLocked(c.id)){
                caseLockList.add(c);
            }
        }
        
        if(!caseLockList.isEmpty()){
            //Unlock records
            List<Approval.UnlockResult> ulrList = Approval.unlock(caseLockList, false);
            
            // Iterate through each returned result
            for(Approval.UnlockResult  ulr : ulrList) {
                if (ulr.isSuccess()) {
                    //Operation was successful, so get the ID of the record that was processed
                    System.debug('Successfully locked account with ID: ' + ulr.getId());
                }
                else {
                    //Operation failed, so get all errors                
                    for(Database.Error err : ulr.getErrors()) {
                        System.debug('The following error has occurred.');                    
                        System.debug(err.getStatusCode() + ': ' + err.getMessage());
                        System.debug('Case fields that affected this error: ' + err.getFields());
                    }
                }
            }
        }
    }
    //finish job
    global void finish(Database.BatchableContext BC) {
    }
}

I am stuck at 22% the Execute is not being covered
 
Dear Team ,

Greetings !!!

In Controller.js by default function has component, event, helper references. How are these getting passed.

Thanks & Regards
Sachin Bhalerao
Hi All,
I want to get grand total of formula field.My report is meant to give the movement of work in progress value from month to month. For the same I have created two formula fields and every thing is working fine. Now what I want is to get grand total of one of the formula field. It is a matrix report. Please help me with this.

Thanks in advance.User-added image
 
Hi,
I created a process builder recently. As it was no longer in use I deleted it from my org. Now, while making any changes in the records I am still receiving the mail with error message regarding process builder failure. 
Error element myRule_1_A1 (FlowRecordUpdate).
The flow tried to update these records: 0034100000TxUl2AAF. This error occurred: ALL_OR_NONE_OPERATION_ROLLED_BACK: Record rolled back because not all records were valid and the request was using AllOrNone header.

It would be helpful of you if you can solve my problem.
Regards,
Deepali
Hi,
I am trying to create dashboard using Sales Analytics app. It seems that lot has been changed in Winter'18 release. While creating new app I am getting following ERROR: 33 User Dataflow Instructions executed, 41 failed.Please let me know how to resolve it. Thanks 
Hi All, 
I am new to Pardot. My requirement is to send email alert to user and an additional email whenever a Prospect is created in Pardot. I want to send the same email which is generated by default to assigned user only. I tried creating engagement studio and one-to-one email but was not able to find the solution. Please help me solve my issue
Hi All,
While setting up developer console for my Enterprise edition I don't know why it is not showing up in lightning inspite of the fact that lightning is enabled for the org.​ Can anyone help me with it?​
User-added image

Regards,
Deepali
Is there any way of displaying a picklist within an aura datatable?

I've read that only certain data types can be used within a datatable, but there must be a way of displaying a picklist or something similar where the user can select a value from a list of values?

Anybody managed to do this?
 
  • November 28, 2019
  • Like
  • 0
Hi 

I am getting the data from response.Now i have to filter the data based on the picklist selection.

Note: i am not using any object.

Thanks
Hi All,
I am working on Apex Specalist - Super Badge. I installed the required Pkg. to my org. Currently working on Automate record creation. As per Requirement need to fetch TYPE = REPAIR Or MAINTENANCE REQUEST. When query the table not finding any record having type define as Repair or Maintenance. Not sure why. Can any one guide me on same.
Rgd's
Dear Team ,

Plz let me know How to set Minlength and Max length in lightning input textarea?

Thanks & Regards
Sachin Bhalerao
 
I have 2 custom objects:- They have no relations in between Request and Response..Both objects are having common fields Name,Add, Phone no :- When I update Address field in Request object it should update in response object as well?
Can anyone help me in aligning the buttons to right

<apex:page standardController="Quotes__c" extensions="ProductSearchPopupController" showHeader="false" sidebar="false" lightningStylesheets="true">
   
    <apex:form id="form" >
        <apex:pageMessages ></apex:pageMessages>
        <apex:messages />
        <div style="width 100%">
            <apex:pageBlock title="Add Products" id="block" rendered="{!block}"> 
                <centre>
                    <div align="center"  >
                    <apex:pageBlockSection columns="1" id="section" > 
                        Enter the product to be added and select Go<br/>
                        
                        <apex:inputText value="{!query}" id="query"/> 
                    </apex:pageBlockSection> 
                  </div>
                </centre>
                <right>
                <apex:commandButton value="Go" action="{!runQuery}" style="border-style:solid;
                     color:white; class:centre;background-color:rgba(13, 112, 165, 1);style=float:right;"/>
                <apex:commandButton value="Cancel" action="{!cancel}" style="border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;" />
                      </right>
            </apex:pageBlock>
                
            <apex:pageBlock id="block1" rendered="{!block1}" >
                <apex:pageBlockSection columns="1">
                    <apex:pageBlockTable value="{!wrapProductList}" var="accWrap">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                        </apex:column>
                        <apex:column headerValue="Name">
                            <apex:outputLink value="#">{!accWrap.acc.Name}</apex:outputLink>       
                        </apex:column>
                        <apex:column headerValue="Product Code">
                            <apex:outputText value="{!accWrap.acc.ProductCode__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Product Description">
                            <apex:outputText value="{!accWrap.acc.Product2Id__r.Product_Description__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Unit Price">
                            <apex:outputText value="{!accWrap.acc.UnitPrice__c}"  />  
                        </apex:column>
                        <apex:column headerValue="Standard Price">
                            <apex:outputText value="{!accWrap.acc.UseStandardPrice__c}"  />  
                        </apex:column>
                    </apex:pageBlockTable>  
                    <apex:commandButton value="Next"   action="{!processSelected}" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);align-items: right;justify-content:right;"/>  
                </apex:pageBlockSection>
            </apex:pageBlock>
        </div>
        <div>
            <apex:pageBlock id="block2" rendered="{!block2}" >
                <apex:pageblockSection title="All Products" collapsible="false" columns="3">
                    <apex:pageBlockTable value="{!selectedProduct}" var="c" id="table2" title="Selected Products">
                        <apex:column value="{!c.Name}" headerValue="Product Name"/>
                        <apex:column headerValue="Sales Price">
                            <apex:inputText value="{!c.UnitPrice__c}" id="UnitPrice" /> 
                        </apex:column>
                        <apex:column headerValue="Discount">
                            <apex:inputText value="{!discount}" id="discount" /> 
                        </apex:column>
                        <apex:column headerValue="Quantity">
                            <apex:inputText value="{!quantity}" id="quantity" /> 
                        </apex:column>
                    </apex:pageBlockTable>  
                </apex:pageblockSection>
                <apex:commandButton action="{!GoBack}" value="Back" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton action="{!saveproduct}" value="Save" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" oncomplete="doRedirect()" style="border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;"/>           
            </apex:pageBlock>
            </div>
           
        
    </apex:form>
</apex:page>
Hi All , 

I am facing the below error while trying to complete the Trial head challenge 

Challenge : Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field

Error : Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.

Thanks 
K.VenkataSubramanyam
I have written a code to add products on quote line item. I am getting error 'Error: Compile Error: Missing '}' at 'else' at line 35 column 13    '
Can anyone help me with the correction of the error. I want an error message to be displyed if I enter any name of the product which does not exist


public class ProductSearchPopupController {
   
    public String query {get; set;}
    public List<PricebookEntry__c> products {get; set;}
    public List<wrapProduct> wrapProductList {get; set;}
    public List<PricebookEntry__c> selectedProduct{get;set;}
    public List<QuoteLineitem__c> quoteLineList{get;set;}
    public List<wrapProduct> selectedWrapperList{get;set;}
    public Boolean normalList{get;set;}
    public Boolean selectedList{get;set;}
    public Boolean block{get;set;}
    public Boolean block1{get;set;}
    public Boolean block2{get;set;}
    public String SalesPrice {get; set;}
    public integer Discount {get; set;}
    public String Quantity {get; set;}
    public String ServiceDate {get; set;}
    Id recordId;
   
    public ProductSearchPopupController(ApexPages.StandardController controller){
        recordId = controller.getId();
        system.debug('recordId '+recordId);
        wrapProductList = new List<wrapProduct>();
        selectedWrapperList = new List<wrapProduct>();
        normalList = true;
        selectedList = false;
        block = true;
        block1 = false;
        block2 = false;
    }
    public PageReference runQuery(){
        if(query == null || query == ''){
            system.debug('query '+query);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'Please enter the product to be searched'));
            else
            if(query != null || query == 'as'){
            system.debug('query '+query);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'Invalid entry'));
           }
           else
            return null;
        
       
    

        List<List<PricebookEntry__c>> searchResults=[FIND :query IN ALL FIELDS RETURNING PricebookEntry__c (id, Name, ProductCode__c, Product2Id__r.Product_Description__c,UnitPrice__c, UseStandardPrice__c)];
        if(searchResults[0]!=null){
            for(PricebookEntry__c a: searchResults[0]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapProductList.add(new wrapProduct(a));
                block = true;
                block1 = true;
                block2 = false;
            }
        }
        return null;
    }
    public PageReference ProceedWithSelectedToNextPage(){
        selectedWrapperList = new List<wrapProduct>();
        normalList = false;
        selectedList = true;
        for(wrapProduct selectedWrapObj: wrapProductList){
            system.debug('selectedWrapObj.selected  ---------'+selectedWrapObj.selected);
            if(selectedWrapObj.selected == true)
                selectedWrapperList.add(selectedWrapObj);
        }
        system.debug('selectedWrapperList size ---------'+selectedWrapperList.size());
        PageReference pageRef = new PageReference('/apex/AccountOpportunityTwoPage');
        pageRef.setRedirect(false);
        return pageRef;
    }
    public void processSelected() {
        selectedProduct = new List<PricebookEntry__c>();
        for(wrapProduct wrapProductObj : wrapProductList) {
            if(wrapProductObj.selected == true) {
                selectedProduct.add(wrapProductObj.acc);
                block = false;
                block1 = false;
                block2 = true;
               
            }
        }
    }
   
    public void GoBack() {
        block = true;
        block1 = true;
        block2 = false;
    }
   
    public class wrapProduct{
        public PricebookEntry__c acc {get;set;}
        public Boolean selected {get;set;}
        public wrapProduct(PricebookEntry__c p) {
            this.acc = p;
            this.selected = false;
        }
       
    }
   
    public pagereference saveproduct(){
        List<QuoteLineitem__c> quoteLineList = new  List<QuoteLineitem__c>();
        if(!selectedProduct.isEmpty()){
            for(PricebookEntry__c sp:selectedProduct){
                system.debug('sp '+sp);
                QuoteLineitem__c qli = new QuoteLineitem__c();
                qli.QuotesId__c = recordId;
                qli.ListPrice__c = sp.UnitPrice__c;
                qli.UnitPrice__c = sp.UnitPrice__c;
                qli.Product2Id__c = sp.Product2Id__c;    
                if(Discount!=0 || Discount!=null){
                    qli.Discount__c = Discount;
                }
                quoteLineList.add(qli);
            }
           
            if(quoteLineList.size()>0){
                insert quoteLineList;
                PageReference pageRef = new PageReference('https://proseraa.lightning.force.com/lightning/r/Quotes__c/'+recordId+'/view');
                pageRef.setRedirect(true);
                return pageRef;
            }
        }
        return null;
    }
   
}
I have some triggers and classes that we no longer use that was pushed to production by the previous admin.  These codes have no coverage or don't meet the coverage requirement.

How would I remove these?  I've already tried Eclipse and Workbench but all came back with errors because of failed tests.
Hi All,
I am facing Below error for my piece of code. Any suggestion / help is highly Appreciable.

Error:
Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Update failed. First exception on row 0 with id 5007F00000tAkWFQA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MaintenanceRequest: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Class.MaintenanceRequestHelper.cycleCalc2: line 23, column 1 Class.MaintenanceRequestHelper.updateWorkOrders: line 14, column 1 Trigger.MaintenanceRequest: line 7, column 1: []

Trigger:
trigger MaintenanceRequest on Case (after update, after insert) {
    Public List<Case> closedCase = new List<Case>();
    List<Case> caseA = [select ID, vehicle__c, equipment__c, date_due__c from Case Where Id IN :Trigger.new AND status ='Closed' and Type IN ('Repair', 'Routine Maintenance')];
    for(Case a : caseA) {
        closedCase.add(a);
    }
     MaintenanceRequestHelper.updateWorkOrders(closedCase); 
}

MaintenanceRequestHelper:

public class MaintenanceRequestHelper {
    Public Static List<Case> oldCase = new List<Case>();
    public static void updateWorkOrders(List<Case> closedCase){
        oldCase = closedCase;
        List<Case> newCase = new List<Case>();
            for (Case newCase2 : oldCase) {
                 newCase.add(new Case(type = 'Routine Maintenance',
                                status = 'New',
                                origin = 'Web',
                                Subject = null,
                                Date_Reported__c = date.today(),
                                Vehicle__c = newCase2.Vehicle__c,
                                Equipment__c = newCase2.Equipment__c,
                                Date_Due__c = cycleCalc2()));  
        }
        insert newCase;
    }

    private static Date cycleCalc2() {        
        oldCase = [select ID from Case Where status = 'Closed' and Type IN ('Repair', 'Routine Maintenance')];
        AggregateResult[] minCycleDay2 = [Select min(Equipment__r.Maintenance_Cycle__c) FROM Work_Part__c  WHERE Equipment__r.Maintenance_Cycle__c != null AND         Maintenance_Request__c IN: oldCase];
        Integer minCycleNum = ((Decimal)minCycleDay2[0].get('expr0')).intValue();
        Date returnDate = date.Today() + minCycleNum;
        return returnDate;
        }
    }

Please help.
Rgd's
Hi everyone,

Can anyone please guide my how to write a map<string> and list<string> together.please find below code and help me on this issue.

Map<String, Map<String, List<String>>> countryMap = new Map<String, Map<String, List<String>>> {'Germany' => 'German',  'Spain' => 'Spanish' ,  'France' => 'French' ,  'UnitedStates' => 'English' , 'UnitedStates' => 'Spanish' ,  'Canada' => 'English' , 'Canada' => 'French'};
            for(String c : newCountries){
                for(String l : newLanguages){
                    if(countrymap.containskey(c) && !Countrymap.get(c).contains(l)){
                        error = true;
                        account.adderror( 'country ' + c + ' does not support language ' + l);
                        return;
                    }
                }
            }

Thanks inadvance,
P.Balu
In Apex, how do a append text to an existing field? 
setScale(2) doesn't work for me. If the amount is 53, i want 53.00, if it is 53.1, i want it to show as 53.10 but currently it shows as only 53 or 53.1, it cuts off the zero.

Please see my code below;

public class BillAndPayWrapper {
        @AuraEnabled public DateTime postDate;
        @AuraEnabled public String   billPeriod;
        @AuraEnabled public Boolean  showSuccess;
        @AuraEnabled public String      invoice;
        @AuraEnabled public Decimal  amount;
        @AuraEnabled public String      amount_formatted;
        @AuraEnabled public String   docType;
        @AuraEnabled public String      pdfDocURL;
       
        BillAndPayWrapper(BillingHistoryServiceSet__x billPay, String companyCode) {
            this.postDate      = billPay.PostingDate__c;
            this.invoice      = billPay.InvoiceNo__c;
            this.amount      = billPay.TotalDueAmt__c.setScale(2);
            this.billPeriod  = billPay.BillPeriod__c;
            this.billPeriod = this.billPeriod.right(2) + '/' + this.billPeriod.left(4);

            if (amount<0) {
                amount=amount*-1;
                this.amount_formatted = '($' + String.valueOf(amount.format()) + ')';
                showSuccess=true;
            }
            else  this.amount_formatted = '$' + String.valueOf(amount.format());

please note: external object amount field data type is number
Can we use apex:include  multiple controller,

Ex: page1
 <apex:page  controller="class1">

 <apex:include pageName="page2"/>
</apex:page>

Page:2

<apex:page  controller="class2">

 <apex:inputext />
</apex:page>

 
Hi all,

I need to display an image from a file to an aura component.

Can someone give me a piece of advice for the img source?

I tried 
<img src="{!'/sfc/servlet.shepherd/version/download/0681w000000iOxfAAE'}" />

However, it does not work.

Thanks,
Angel
Hi All,

I hope you're all well.

I have a custom object - Object 1 and the Opportunity object. I've created a lookup field from the Opportunity to Object 1 and I want to be able to populate the id of a related record into the lookup field, in order to reference some of the values, back on the Opportunity.

The related records on the Object 1 are being created first (as part of an integration), so I want my trigger to fire after the records are created, or modified.

One Opportunity, could have 1+ related records.

In order to differentiate for each Opportunity, those records are related to, we have two custom fields, field 1 on the Opportunity that contains an unquie number and another custom field on the Object 1 that contains the same unquie number the Opp has.

I want my trigger to fire everytime the related records are created and populate the id of one of them into the lookup, so I can reference different values from the Object 1.

This is what I have attempted to build so far, but I am not having much success... so a little bit of help, it's much appreciated. 

I built the trigger on the custom object 1, but I am not sure if  this is correct...
 
ttrigger UpdateLookup on Object_1__c (after insert, after update){
for (Object_1__c obj: trigger.new){
    Obj1Ids.add(obj.id);
}

Map <Opportunity> matchingIdsMap = new Map <Opportunity> ();

for (Opportunity obj: [Select Id, field_1__c from Opportunity, where id in:ObjIds]){
matchingIdsMap.put(Opportunity.id, Opportunity);
}

List <Opportunity>OpportunitiesToUpdate = new List <Opportunity> ();

for (Object_1__c obj: trigger.new){

if (matchingIdsMap.get(obj.id) ! = null)



{

   matchingIdsMap.get(obj.id).Object_1__C = ObjIds;

   OpportunitiesToUpdate.add (matchingIdsMap.get(ObjIds));

}

update OpportunitiesToUpdate;
}

Thanks a lot.
 
Hi everyone,

If any one have idea please guide me and explain me on these issue.

My Question was:

How Can i will  Provide unfiled public reports folder access & permission to create new reports for non-admin users.

So,please provide me and give my step by step for better understand.

Thanks Inadvance.

P.Balaji Karthik