• Internal Partner
  • NEWBIE
  • 75 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 63
    Questions
  • 46
    Replies
I have read every possible thread where some have or had the problem that some fields are not being displayed for reports even if the System Admin has Edit permissions on the field or the field is on the layout of the object.

I have built a report with Account as the primary object and following relationships:
User-added image

Account and Object B have a Master-Detail relationship. Object B and C as well. B and C are custom objects.
I would like to add a custom field which is in the object C, say, Name. Name__c is a text field, a custom field.
When building the report type I don't have any chance to add Name__c to the report type. It appears on the right side under C fields as greyed out. No chance to add it. I don't know why.

The field is visible to the Admin, also added on the page layout of the C object. The field is also not blocked via permission set.

But when I build a report type having B and C, the Name__c field appears for selection.

Can someone explain to me what is going on here?
Hi all,

I built a report with report type Opportunities and would like to add a filter saying Close Date <= 31.12.CURRENT YEAR. For this year it would be <= 31.12.2019.

I found in the Salesforce Documentation the following statement:

For example, instead of filtering on Close Date greater than Jan 1, 2017, filter using a relative date: Close Date equals this year.

Attached the link to the documentation:

https://help.salesforce.com/articleView?id=filter_dates_relative.htm&type=5

If I use Close Date <= THIS YEAR I am wondering if this is the correct solution, as THIS YEAR means "Starts at 12:00:00 AM on January 1 of the current year and continues through the end of December 31 of the current year". I just want to tell Salesforce, I want all records with Closed Date <= LAST DAY OF THE CURRENT YEAR without using any formulas.

If using formulas what would be a practical approach here?.
Hi all,

after creating an opportunity I proceeded adding products to the opportunity. The popup windows are standard in Salesforce and look like this:

User-added image
User-added image

In the window "Edit selected products", is there a way to manage the fields/columns to be displayed in this layout and the order of them in the layout?
Hi all,
 
we have external objects and a record as test record. When I try to search for any of the values on the used fields, there are no results.
I don't have any experience with global search on external objects. I only have read that for having results you will need a third party tool.
I have configured the Search layout --> Search results on the external objects, enabled search for the objects but no results.
What is your experience? is it possible to find records on external objects using the standard global search?. If yes, how, what should we do in order to get the results in Salesforce the way you can do for internal ones.
Hi all,

I was wondering if there is a possibility not to hard code the location of images in email templates. We are linking images with a Sandbox location, what happens if the image is deleted or moved to another environment?.
For example, we have the following code in the email template and the email template is in the Salesforce instance CS109:
 
<img align="center" alt="Image" border="0" class="center autowidth" src="https://c.cs110.content.force.com/servlet/servlet.ImageServer?id=0150Q000000C8yp&oid=00D0Q0000009cAu&lastMod=1557822678000" style="outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; clear: both; border: 0; height: auto; float: none; width: 100%; max-width: 300px; display: block;" title="Image" width="300"/>
I would appreciate any advice about best practices in such a case.
 
Hi all,

I am trying to pass the Aura Components Basics trail --> Connect Components with Events.
Following code has been implemented but at the end I can not pass this trail step because I am getting the message
 
"Challenge not yet complete in My Trailhead Playground 6
The campingList component appears to be using UI Components instead of Base Lightning Components in the form. You should be using only Base Lightning Component

Following is the code:

campingList.cmp
 
<aura:component controller="CampingListController">
	
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <aura:handler name="addItem" event="c:addItemEvent"
   	action="{!c.handleAddItem }"/>
    

    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <ol>
    <li>Bug Spray</li>
    <li>Bear Repellant</li>
    <li>Goat Food</li>
    </ol>
    
       <!-- NEW ITEM FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">

        <c:campingListForm />

    </div>
    <!-- / NEW ITEM FORM -->    
   

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Items</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="items">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>

</aura:component>

campingListController
({
    // Load items from Salesforce
	doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getItems");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.items", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    
    handleAddItem: function(component, event, helper) {
    //   var newItem = event.getParam("item");
    //helper.addItem(component, newItem);
    var action = component.get("c.saveItem");
    		action.setParams({"item": newItem});
    		action.setCallback(this, function(response){
        		var state = response.getState();
        		if (component.isValid() && state === "SUCCESS") {
            		// all good, nothing to do.
            var items = component.get("v.items");
            items.push(response.getReturnValue());
            component.set("v.items", items);
        		}
    		});
    		$A.enqueueAction(action);
        		}
    
              
})

campingList Helper
({
   addItem: function(component, item) {
    this.saveItem(component, item, function(response){
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            // all good, nothing to do.
         /*   var items = component.get("v.items");
            items.push(response.getReturnValue());
            component.set("v.items", items);*/
        }
    });
},
})

campingListForm component
<aura:component >
	
        <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }"/>
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
        <!-- CREATE NEW ITEM FORM -->
    <form class="slds-form--stacked">

      <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputText aura:id="itemname" label="Name"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Name}"
                  required="true"/>

          </div>
     </div>

     <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputNumber aura:id="quantity" label="Quantity"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Quantity__c}"
                  required="true"/>

          </div>
      </div>

      <div class="slds-form-element">
          <div class="slds-form-element__control">
              <ui:inputCurrency aura:id="price" label="Price"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Price__c}"
                  />
          </div>
      </div>

      <div class="slds-form-element">
          <ui:inputCheckbox aura:id="packed" label="Packed?"
              class="slds-checkbox"
              labelClass="slds-form-element__label"
              value="{!v.newItem.Packed__c}"/>
      </div>

      <div class="slds-form-element">
          <ui:button label="Create Camping Item"
              class="slds-button slds-button--brand"
              press="{!c.submitForm}"/>
      </div>

    </form>
    <!-- / CREATE NEW ITEM FORM -->
</aura:component>

campingListForm Controller​​​​​​​
({
    
    submitForm: function(component, event, helper) {    
    if(helper.validateItemForm(component)){
        // Create the new item
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }
        
        }

})
campingListForm Helper​​​​​​​
({
 addItem: function(component, newItem) {
    var addItem = component.getItem("addItem");
    addItem.setParams({ "item": item });
    addItem.fire();
            component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false } />);
},
    

		validateItemForm: function(component) {
		
              // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
		// Price must not be blank
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
            return (validItem);

	}
})

addItemEvent.evt​​​​​​​
<aura:event type="COMPONENT">
    <aura:attribute name="item" type="Camping_Item__c"/>
</aura:event>

What I am doing wrong? I would appreciate any advice.​​​​​​​



​​​​​​​
Hi all,

I would like first to retrieve all possible metadata from a Developer Edition org and then deploy this content to another Developer Edition org. Unfortunately you can not build change sets in a Developer Edition environment, so I am trying to retrieve the metadata with ANT.
 
As there is no possibility for using change sets I have been trying to use the "ant retrieveUnpackaged" after I added the "retrieveUnpackaged" part to the build.xml file according to this link: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool_retrieve_unpackaged.htm
 
When trying to run the command line "ant retrieveUnpackaged" under the correct location, I am getting the error " Should provide a valid retrieve manifest 'unpackaged'." pointing to the line "unpackaged="unpackaged/package.xml"/>". Even when trying many things I could not find out what is wrong or how can I amend this, so the command creates a package.
 
Any help or guidance will be appreciated.
Hi all,

I scheduled a batch job last year to run every 1. January at 12:05 am in every year. The batch job sends an email to a Support CRM team.
On the 1. January this year the job didn't run.

I checked the Apex code and everything is ok. Today I scheduled the batch at certain times by testing it and it worked, it sent an email to the Supoort CRM team. Now I am wondering if the following lines to invoke the batch job are correct:
 
MY_BATCH_JOB sendEmailJob = new MY_BATCH_JOB();
        String sch = '00 05 00 1 1 ? *';
        system.schedule('BATCH Yearly Email Reminder', sch, sendEmailJob);
Is especially the line '00 05 00 1 1 ? *' correct or incorrect?
 
Hi all,
we would like to be able to also search for a certain picklist value in a lookup and get results of the object records in Lightning.
According to Lightning you can configure the search results with usable fields as documented here:

https://help.salesforce.com/articleView?id=search_fields_lex.htm&type=5

I could configure the search results for Account using Phone as the secondary field and when I make my search on the Account using a phone number I get the corresponding result. But when I take a picklist field as secondary and then try my search using a picklist value, this doesn't work.

So, does anybody know if there is a workaround for this? how can a lookup be searchable using a picklist value?
Hi dear developers,

I am pretty confused about the use of custom settings in APEX test classes.

One of our developers, who unfortunately is not there anymore, wrote the following test data in a test method:
 
static testMethod void testMethodExample() {
        insert new CS_Example__c(Batch_Limit__c = 1, EmailAddress__c='test@example.com', Name = 'Test_CS');
the test class works, but we don't understand why he created in addition to the test data within the test class, a new Custom Setting record with the name 'Test_CS". That means, he created two records on the Custom Setting CS_Example__c:

1. Name: CS_Config
    Batch_Limit__c = 200,
   Email_Address__c = test2@example.com
 
2.  Name: Test_CS
    Batch_Limit__c = 200,
   Email_Address__c = test@example.com

And he had been using the name of the second Custom Setting record only for the test class. He had been using the first Custom Setting record for the APEX (non-test) batch job class.

Or, the second record is not needed and can be deleted?.


 
Hi all,

I am spending hours trying to find out which is the field or the issue cause behind the error I am getting when trying to update a custom field in the object Opportunity Product:
 
Error saving record: FIELD_FILTER_VALIDATION_EXCEPTION: Value does not exist or does not match filter criteria
We don't have any lookup with filter criteria on the object. On the Objects Opportunity and Product2 there are not lookup fields with filter criteria.
When trying to debug this with the debug logs, I don't get any details leading me to this error.

Does anybody know if there is a possibility to debug this with code or any possibility to find out what is going on here?
 
Hi all,

I am struggling with coding a test class for a class accessing custom metadata class.
The class tries to insert a record for a custom metadata type, but no idea if my code is going to somewhere. I could not find any concrete solution for my problem. Some say you need a wrapper class, some say JSON.

I would appreciate any guidance, help as I am not a developer myself, but unfortunately all developers are busy at the moment.

This is my class:
 
global class EmailReminder implements Schedulable {  
    
   global void execute(SchedulableContext SC) {
      sendEmail();
   }
    
    
    global void sendEmail(){

        Messaging.reserveSingleEmailCapacity(2);
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        
        // Strings to hold the email addresses to which you are sending the email.
        
        Email_Reminder_Setting__mdt query = [SELECT Subject__c, OWA_Label__c, Body__c ,ToEmailAddress__c FROM Email_Reminder_Setting__mdt LIMIT 1];
        
        String[] toEmailAddress = new String[] {query.ToEmailAddress__c};
        String Subject = query.Subject__c;
        String Body= query.Body__c;
        String Owa_Label= query.OWA_Label__c;
       
        
        // Assign the addresses for the To and CC lists to the mail object.
        
        mail.setToAddresses(toEmailAddress);
        
        // Use Organization Wide Address  
        for(OrgWideEmailAddress owa : [select id, Address, Displayname from OrgWideEmailAddress]) {
            if(owa.DisplayName.contains(Owa_Label)) {
                 mail.setOrgWideEmailAddressId(owa.id); 
            }
              
        } 
           
        // Specify the subject line for your email address.
        mail.setSubject(Subject);
        
        // Set to True if you want to BCC yourself on the email.
        mail.setBccSender(false);
        
        // Optionally append the salesforce.com email signature to the email.
        // The email address of the user executing the Apex Code will be used.
        mail.setUseSignature(false);
        
        // Specify the text content of the email.
        //mail.setPlainTextBody('Please configure this');
        
        mail.setHtmlBody(Body);
        
        // Send the email you have created.
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

This is my test class so far:
 
@isTest
public class EmailReminder_Test {
   
  
      @testVisible static List<Email_Reminder__mdt> customMetadata { 
      get {
        if ( customMetadata == null )
            customMetadata = [ SELECT ToEmailAddress__c, OWA_Label__c, Subject__c, Body__c FROM Email_Reminder__mdt ]; 
            return customMetadata;
      } 
      set; }
      
      Test.startTest();
      EmailReminder sendEmailJob = new EmailReminder();
      String sch = '00 30 20 5 2 ? *';
      system.schedule('sendEmailJob', sch, sendEmailJob);
      Test.stopTest();
    
    
    
}

I am getting the error:

Error: Compile Error: Expecting ')' but was: 'sendEmailJob' at line 16 column 23​​​​​​​

What am I doing wrong?. 

 
Hi all,

as some of you might know, custom fields for custom settings, with type Textarea, are limited to only 255 characters. I had read there is a workaround and this you can create a second field with the same length and create a record concatenating both, ok.
Our problem is, how can we change our code so the second field is taken in account and when sending the email, the value in the second field also will be displayed:

This is the code:
global class implements Schedulable {  
    
   global void execute(SchedulableContext SC) {
      sendEmail();
   }
    
    
    global void sendEmail(){

        Messaging.reserveSingleEmailCapacity(2);
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        
        // Strings to hold the email addresses to which you are sending the email.
        Email_Reminder__c er = Email_Reminder__c.getInstance('Reminder');
        String [] toEmailAddress = new String [] {er.ToEmailAddress__c};
        String Subject= er.Subject__c;
        String Body= er.Body__c ;
        String Body2= er.Body2__c; // I added the custom field Body2 in the Custom Setting
        String Owa_Label= er.OWA_Label__c;
       
        
     
        
        mail.setToAddresses(toEmailAddress);
        
        // Use Organization Wide Address  
        for(OrgWideEmailAddress owa : [select id, Address, Displayname from OrgWideEmailAddress]) {
            if(owa.DisplayName.contains(Owa_Label)) {
                 mail.setOrgWideEmailAddressId(owa.id); 
            }
              
        } 
           
        // Specify the subject line for your email address.
        mail.setSubject(Subject);
        
        // Set to True if you want to BCC yourself on the email.
        mail.setBccSender(false);
        
        // Optionally append the salesforce.com email signature to the email.
        // The email address of the user executing the Apex Code will be used.
        mail.setUseSignature(false);
        
        // Specify the text content of the email.
        //mail.setPlainTextBody('Please configure this');
        
        mail.setHtmlBody(Body);
        
        // Send the email you have created.
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

Custom Setting with fields:

Body__c --> Textarea (255)
Body2__c --> Textarea(255)
OWA Label --> Text(100)
Subject__c --> Text(250)
ToEmailAddress__c --> Email

Value in Body__c:
 
This is a first test. This should work with two fields. The idea is first to display the value in Body__c and Body2__c as the content were the content in only one field.
Value in Body2__c:
 
This is an example of content in Body2__c. Questions is how can I concatenate Body__c and Body2__c?

If I get an Email, I would like to get the following content in this form:

This is a first test. This should work with two fields. The idea is first to display the value in Body__c and Body2__c as the content were the content in only one field.
This is an example of content in Body2__c. Questions is how can I concatenate Body__c and Body2__c?


How can I change my code so I get this result in the email. We are not yet using an email template.

Second question is, if we use an email template instead, how can we change the code above?



 
Hi all,

I am struggling trying to fix a test class for an APEX class (WSDL) which has the following form:
 
global class Example {
   webService static String getUserName(String name) {
       return UserInfo.getUserEmail();
   }
}

My test class is this:
 
@isTest
private class Example_Test {
    @isTest static void Example() {              
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new getUserName());  
    }
}

I am getting this error:
 
System.TypeException: Mock object doesn't implement the supplied interface
Class.System.Test.setMock: line 57, column 1
Class.Example_Test.Example: line 5, column 1
Any advice would be appreciated :)
 
We have a CA-signed certificate expiring in the next 30 days. I have seen numerous articles related to self-signed certificates but nothing clear related to CA-signed. Can anyone kindly provide clear step by step instructions on how to renew a CA-signed certificate that is due to expire. Note that our IT team have already renewed the wildcard certificate at their end but how is the renewal done in Salesforce after clicking on the expiring certificate label link?
Thank you
Hi
I'm trying to add CA certificates into my organization, but always have the same result: " Error: The certificate that you are uploading doesn't match the generated certificate signing request. "

I get the certificate from outside webserver, and download it from Mozilla browser. When I view that certificate, I can see CN, O, L, ST, C, but can't see Organizational Unit (OU)
I follow this steps:
  - Setup - Security Controls - Certificate and Key Management - Create CA Signed certificate
  - put into the fields the info that I can see in downloaded certificate

After that, I try to upload downloaded signed certificate into salesforce, but y get error with signin request.

Can anyone help me?

Thanks