• BPOOR
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 18
    Replies
I am trying to uninstall a managed package and the package uninstall failed with the reason saying a custom field cannot be deleted. When I click on the "Where this is used" button on the custom field, it is showing few private reports that I do not have access to. I am a System Administrator though.

How do I proceed in this scenario? I don't know which user created the report.
  • March 31, 2021
  • Like
  • 0
I am trying to export attachments from Salesforce using Apex Data Loader. I am using the below query in Apex Data Loader.
 
Select Id, Name, ParentId, ContentType, BodyLength, Description from Attachment where Parent.Type = 'Account' limit 10

The above query provides only a csv with the above contents.
How do I export the actual attachments? I have done importing attachments into Salesforce by using zip file, but not sure how to export the attachments.

Can someone help?

Also, I don't want to use data export or other tools.
  • February 19, 2021
  • Like
  • 0
I need to remove the trailing spaces from a String. However, when I try that in Execute Anonymous window with the below test apex code, I am getting the below error message.
 
String testString = 'ABCD124  ';
    System.debug('Trimmed string = ' + rtrim(testString,' '));

    Method does not exist or incorrect signature: void rtrim(string, string)


I need to retain the leading spaces, if there are any. So, I can't use the trim() method.

I also tried without the second parameter, and it did not work either.

Can someone help?
  • January 07, 2021
  • Like
  • 0
I am working on a class that makes a callout to a third party API. The third party API needs to be authenticated with a OpenID Connect Auth token. So, in my class, I am making a callout to the OpenID Connect Auth service to get a bearer token and then I am making a callout to the third party API with the bearer token from OpenID Connect API. The third party API is providing some additional information about the fields on the Account object and I am updating the values on the Account object. There are multiple scenarios in this case.
  1. The values on the Account object is different from what is retrieved from the third party API. In this case, the values on the Account object are updated.
  2. The values on the Account object is same as what is retrieved from the third party API. In this case, the account is not updated.
  3. The third party API returns a blank response. So, the response body contains []. In this case, I am skipping the account.

The apex class is working fine. However, I need some help in building a test class for this. I am sure I need to use MultiStaticResourceCalloutMock stub class to build the test class, but I have some questions around it. My questions are below.
  1. Do I need to write three test methods, one for each scenario? 
  2. In each of the test methods, I assume I need to use MultiStaticResourceCalloutMock with two end points, one for OpenID Connect Auth and one for third party API, correct?
  3. I also need three static resources, one for successful response, one for blank response (the static resource file will contain [] only, and one with the response where the values are exactly same as what is on the Account, correct?


Can someone help?
 
  • December 07, 2020
  • Like
  • 0
I am working on an apex class which is making a webservice callout to an external system and with the response that I get, I am updating couple of fields on the Account object. Unfortunately, this webservice is not batched or bulkified, so I need to call this service once per account and process it one at a time. The webservice response is sometimes too big (around 1MB when saved to a file). Most of the responses are processed fine and very few of them failing with the error message "Regex too complicated".
The statement that is causing the response processing to fail is below.
 
strResponse = strResponse.replaceAll('"system"','"smsystem"');

As you can see, I am not using a pattern matcher or any kind of Regular expression. I am not sure why I am getting this error message with just a replaceAll() method.
Can someone help me in avoiding this error message?
 
  • October 08, 2020
  • Like
  • 0
Hi,

Can some one tell me how to set a default record type for a custom profile? It should be very easy, however, I am not able to do that in our production org. I opened up the profile and went into Object Settings and I found that Opportunity object is not listed there. I went under the Customize ==> Opportunities ==> Record Types and Customize ==> Opportunities ==> Sales Process and I could not find a way to set a default record type for a profile.

Can someone help?
 
  • October 07, 2020
  • Like
  • 0
We have a lightning page where a section is getting updated via a third party webservice. In order to show the updated values, we have a lightning component to refresh the page once the values are updated. However, this page is currently throwing the below error.
Uncaught Error in A$.getCallback() [Cannot read property 'reloadRecord' of undefined]

The code is given below.
PageRefresh.cmp:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="dataRecord" type="Object"/>
<aura:attribute name="recordSaveError" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<force:recordData aura:id="recordLoader" recordId="{!v.recordId}" layoutType="FULL" targetFields="{!v.dataRecord}" targetError="{!v.recordSaveError}" recordUpdated="{!c.handleRecordUpdated}" />
<aura:if isTrue="{!not(empty(v.recordSaveError))}">
<div class="recordError">
        {!v.recordSaveError}</div>
</aura:if>
</aura:component>

PageRefreshController.js:
({
doInit: function(component,event,helper){
    component.find("recordLoader").reloadRecord(true);
    //set time-out
    helper.setTimer(component);
},

    handleRecordUpdated: function(component, event, helper) {
    var eventParams = event.getParams();
    if(eventParams.changeType === "CHANGED")
    {
        component.find("recordLoader").reloadRecord();
        // get the fields that are changed for this record
        var changedFields = eventParams.changedFields;
        // record is deleted and removed from the cache
    } else if(eventParams.changeType === "ERROR") {
    }
},
})

PageRefreshHelper.js:
({
setTimer:  function(component){
var that = this;
window.setTimeout(
        $A.getCallback(function() {
        component.find("recordLoader").reloadRecord();
        that.setTimer(component);
    }),1000 //time after which the component reloads to check for any change in the record data
);
}
})

The same code works fine in Dev sandbox, but not in QA sandbox. Can someone help?
  • August 06, 2020
  • Like
  • 0
I am on a task where I need to call an external webservice that takes the username and password in the request body, not as part of Authorization header. I did setup the username and password using Named Credentials, but I am having trouble accessing the actual username and password from the named credentials as merge fields.
Below is my setup
Identity Type : Named Principal
Authentication Protocol : Password Authentication
Username : {Service Account Username}
Password : {Service Account Password}

Generate Authorization Header : Unchecked
Allow merge fields in HTTP Header : Unchecked
Allow merge fields in HTTP Body : Checked

I tried various options, but nothing seems to work. When I access the named credential via code using the merge fields {!$Credential.Username} and {!$Credential.Password} and assigning them to string variables, the debug log is only printing {!$Credential.Username} and {!$Credential.Password} only and not the actual username and password.

Apparently, the HTTP send is throwing a ScriptThrownException when I make a callout to the external webservice with the above credentials.

Also, if I have multiple named credentials in my salesforce org, how do I access the correct one using merge fields?

Can someone help?
  • July 09, 2020
  • Like
  • 0
I am trying to deploy an utility class by adding a small method. The method implementation is below.
public static boolean isId(String strValue) {                                  
        return strValue InstanceOf Id;                                                  
    }
When I try the option "Deploy to Source Org", I am getting the following error message.
 
19:53:04.627 Starting Deploy (Beta)
When retrieving results with Metadata or FullName fields, the query qualificatio​ns must specify no more than one row for retrieval. Result size: 2

Has anyone experienced this? In my package.xml, I only have few apex classes and nothing else.

Can someone help?


 
  • May 21, 2020
  • Like
  • 0
We are using a third party company to scan our salesforce code for SOQL Injection and Vulnerability issues with open page redirects. The below code is flagged as a vulnerability.
public Pagereference customCancel() {
Pagereference objPageref = new Pagereference('/apex/FulcrumInlineEdit?id='+OptyId);
objPageref.setRedirect(true);
return objPageref;
The page is not using any URL hacking mechanisms like saveUrl, retUrl or cancelUrl. Based on the information given in the trailhead Prevent Open Redirects in your code (https://trailhead.salesforce.com/en/content/learn/modules/secdev_application_logic_vulnerabilities/secdev_app_logic_preventing_open_redirect), I am not sure how to modify the above code to make it secure. Can someone help?
 
  • May 08, 2020
  • Like
  • 0
I am working on an assignment where I need to fix a SOQL Injection issue in one of the SOQL in a batch apex. The query is below.
 
SELECT Id, Name from Contact where (TrustName__c != null OR Status__c != null OR Title != null OR City__c !- null or Street__c != null or State__c != null) AND Id in (SELECT Contact__c from PP__c)

However, I am not sure how this SOQL was flagged as a vulnerable query since it is not querying a specific field with a LIKE or something like that.

Can someone clarify? If this is a vulnerable query, how do I re-write the query?
  • April 28, 2020
  • Like
  • 0
Need some help on an issue that I am currently facing in a trigger.

In the OpportunityTrigger, I am trying to assign the Account Owner as the owner of the opportunity if the opportunity has specific list of record types. My sample code is below.
 
List<String> strRecordTypes = new List<String>() {'Rtype 1', 'Rtype 2', 'Rtype 3'};
        List<Id> lstAccountIds = new List<Id>();
        Map<Id, Id> mapAccountOwnerIds =  new map<Id, Id>();
        for (Opportunity oppty : trigger.new) {
            if(oppty.AccountId != null) {
                lstAccountIds.add(oppty.AccountId);
            }
        }
        for (Account acc : [Select a.Id, a.OwnerId FROM Account a Where Id in :lstAccountIds AND a.Owner.IsActive = true]) {
            mapAccountOwnerIds.put(acc.Id, acc.OwnerId);
        }
        for (Opportunity oppty : trigger.new)  {
            String strAcctOwnerId = '';
            if (oppty.AccountId != null && MapSupportedRecType.size() > 0 && strRecordTypeNames.contains(oppty.RecordType__c)) {            
                **strAcctOwnerId = mapAccountOwnerIds.get(oppty.AccountId);**
                if(strAcctOwnerId != null && strAcctOwnerId !='') {
                    oppty.OwnerId = strAcctOwnerId;
                }
            }
        }



RecordType__c is a custom field on the Opportunity object that contains the name of the Record type.
However, when I test this code, I am getting the below error at line where strAccountOwnerId is getting assigned from the map.
 
> USER_DEBUG []|ERROR|==========> Trigger New Invocation is [2] which exceeds the limit of [2].  The logic will not run.

Can someone help?
  • April 16, 2020
  • Like
  • 0
I am working on test class that inserts an Opportunity with the opportunity products using the correct price book/price book entry. The OpportunityLineItem has a ProductSelected__c picklist field. We recently implemented the Global value sets and this picklist is now using the active values from the Global value set. How do I do the following?

1) Create an opportunity (not a problem)

2) Create opportunity line items (not a problem)

3) How do I setup a new test value into the Global Value set and add the same into the ProductSelected__c picklist?

4) Apply the same ProductSelected__c value on the test Opportunity Line Item?

5) Also, we are not using the Standard Pricebook. Is there a way to get our custom pricebook in the test class code without using the SeeAllData = true option?

 
  • January 02, 2020
  • Like
  • 1
In our Salesforce org, under "Activity Settings", the feature "Allow Users to Relate Multiple Contacts to Tasks and Events" is enabled. However, this seems to work only standard page layout when I click on "Log an Activity". We have a custom button to create an activity for a specific record type. On the name field (WhoId) on the page layout for the activity, it is presenting only a lookup popup where I can select only one contact or lead, However, on the standard page layout on actiivty, it is displaying a popup where I can select multiple contacts or leads (up to 50). Is there anyway I can show the same popup on the custom visual force page where I can associate the activity to multiple contacts or leads? Below are the screenshots of the custom page layout page popup and the standard page layout popup.

Lookup Popup on custom page:
========================
Lookup Popup on Custom Visualforce page.

Lookup Popup on standard page:
=========================
Lookup Popup on Standard page.

Can someone help?
 
  • September 09, 2019
  • Like
  • 0
In our Salesforce org, under "Activity Settings", the feature "Allow Users to Relate Multiple Contacts to Tasks and Events" is enabled. However, this seems to work only standard page layout when I click on "Log an Activity". We have a custom visual force page for a specific record type of the activity. On the name field (WhoId) on the visual force page, it is presenting only a lookup popup where I can select only one contact or lead, However, on the standard page layout on actiivty, it is displaying a popup where I can select multiple contacts or leads (up to 50). Is there anyway I can show the same popup on the custom visual force page where I can associate the activity to multiple contacts or leads? Below are the screenshots of the custom visualforce page popup and the standard page layout popup.

Lookup Popup on Visual force page:
=============================
 
Lookup Popup on Custom Visualforce Page.

Lookup popup on standard page:
=========================
Lookup Popup on Standard Page.
Can someone help?

 
  • September 06, 2019
  • Like
  • 0
In the Lightning list views, the first column is a number column which is NOT in the fields list to customize and I want to hide/remove this number column. Is it possible to remove this column? See the screenshot below.

Number column in Lightning List view
  • April 10, 2019
  • Like
  • 0
I am working on as assignment where I need to insert a record in a custom object (FileAttachment__c) when a file is uploaded under a Contact. When the file is uploaded, the custom object record needs to be populated with the following values.
FileAttachmentId ==> Id of the ContentDocument
FileAttachmentName ==> Name of the ContentDocument
Contact__c = Contact on which the file was uploaded.

I created a before trigger on the ContentVersion object to achieve this. However, I am having problems when querying the ContentDocumentLink object based on the ContentDocumentId on the ContentVersion. My sample code where I am querying ContentDocumentLink is below.
 
List<FileAttachment__c> lstFAT = new List<FileAttachment__c>();
    Set<Id> contentDocumentIdSet = new Set<Id>();
    Map<Id,Id> mapContentDocumentIdToContactId = new Map<Id,Id>();
    for (ContentVersion cv : lstCV) {
        contentDocumentIdSet.add(cv.ContentDocumentId);
    }
    //List<Id> contentDocumentIdList = new List<Id>(contentDocumentIdSet);
    List<ContentDocumentLink> lstCDL = new List<ContentDocumentLink>();
    lstCDL = [SELECT Id, ContentDocumentId, LinkedEntityId from ContentDocumentLink WHERE ContentDocumentId in :contentDocumentIdSet];
    if (lstCDL != null && !lstCDL.isEmpty()) {
        for (ContentDocumentLink cdl : lstCDL) {
            if (cdl != null && cdl.LinkedEntityId.getSObjectType().getDescribe().getName() == 'Contact') {
                mapContentDocumentIdToContactId.put(cdl.ContentDocumentId, cdl.LinkedEntityId);
            }
        }
    }
However, when I test the code, I am getting the error message "ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator.:".
Then I changed the code to replace ContentDocumentIDSet with ContentDocumentIDList (Based on previous searches from StackExchange, and Populated the List from the Set) and tried to test it. However, I got the same error.
Then I changed the code to build a String with the list of Ids from the ContentDocumentIDSet and used in the WHERE clause of ContentDocumentLink query. However, this time I am getting the error message "IN operator must be used with an iterable expression ".
Can someone help? In the worst case scenario, I am thinking of handling this in the ContactTrigger. However, the ContactTrigger in our Org is already big and I prefer to avoid adding these changes in the ContactTrigger.

 
  • February 22, 2019
  • Like
  • 0
I am working on an assignment in which I added couple of custom fields on the Content version object. The custom fields are showing up on the page layout. I want to enable the users on a specific profile to be able to edit the custom fields from the page layout. However, the Edit button is not appearing on the page layout. I am only seeing the "Deliver Content" and "Download" button for the users under this profile. For this profile, I have enabled the following settings.

1) Manage Salesforce CRM Content
2) Manage Content Permissions
3) Manage Content Properties.

However, I am still not able to see the EDIT button which allows the users to update the custom fields. Can someone help?

See the screenshot below for the buttons showing up on the Content page layout.

Page layout for the users under specific profile.

Below is what I am seeing under the System Administrator page.

Page Layout of System Administrator where Edit button is showing up.

Any thoughts or suggestions?

Thanks in advance,
pnb.
  • February 15, 2019
  • Like
  • 0
I am using an SOQL in a webservice that is querying the Contact object based on the BirthDate field. The webservice request has the date in the format of 'yyyy-MM-dd',i.e.,1962-01-29 as an example.
I am not able to use this value to query the Contact Object. I tried converting this String Date into Date object. However, it always has 00:00:00 at the end. I tried the below options.
String strDate = '1962-01-29'; 
Date birthDate = Date.valueOf(strDate) ==> This results in 1962-01-29 00:00:00 String strDate = '1962-01-29'; 

Date dob = Date.valueOf(strDate) 
Datetime dt = Datetime.newInstance(dob.Year(),dob.Month(),dob.day()); 
Date birthDate = dt.date() ==> This also results in 1962-01-29 00:00:00

How do I construct a Date object (without time) from the string date '1962-01-29'?
I did search for solutions in various forums and most of them are suggesting the above two solutions only, which does not work. I am not sure whether this behavior was changed in some Salesforce's releases.

I even tried the Date.parse() method. Whatever I do, I always get the Date with 00:00:00 at the end and this is messing up the SOQL query. When the SOQL is executed, I am getting a message saying [Exception: Line 1:343 No Viable Alternative at character '' ]. The SOQL is built as shown below.
 
USER_DEBUG [112]|DEBUG|Query:: SELECT id,LastName,FirstName,BirthDate,MiddleName__c,MailingAddress,OtherAddress,EmploymentStatus__c,Suffix__c,MaritalStatus__c,Gender__c,MailingState__c,HomePhone,MobilePhone,Email FROM Contact WHERE LastName LIKE 'Smith%' AND BirthDate = 1962-01-29 00:00:00  ORDER BY lastName,firstName,BirthDate LIMIT 50

If I run this query in workbench, I get the same error message.

Can someone help?
  • January 05, 2019
  • Like
  • 0
I am in need of setting up an integration user which needs to have access to Contact object (restricted to couple of fields only) and nothing else. When I try to create a profile, I have to select an existing profile to clone. However, all the existing profiles have some additional level of access that I need. Is there a very basic minimal security profile that I can use to clone? If not, what is the best way of approaching this?
  • October 23, 2018
  • Like
  • 0
I am working on test class that inserts an Opportunity with the opportunity products using the correct price book/price book entry. The OpportunityLineItem has a ProductSelected__c picklist field. We recently implemented the Global value sets and this picklist is now using the active values from the Global value set. How do I do the following?

1) Create an opportunity (not a problem)

2) Create opportunity line items (not a problem)

3) How do I setup a new test value into the Global Value set and add the same into the ProductSelected__c picklist?

4) Apply the same ProductSelected__c value on the test Opportunity Line Item?

5) Also, we are not using the Standard Pricebook. Is there a way to get our custom pricebook in the test class code without using the SeeAllData = true option?

 
  • January 02, 2020
  • Like
  • 1
I am trying to uninstall a managed package and the package uninstall failed with the reason saying a custom field cannot be deleted. When I click on the "Where this is used" button on the custom field, it is showing few private reports that I do not have access to. I am a System Administrator though.

How do I proceed in this scenario? I don't know which user created the report.
  • March 31, 2021
  • Like
  • 0
I need to remove the trailing spaces from a String. However, when I try that in Execute Anonymous window with the below test apex code, I am getting the below error message.
 
String testString = 'ABCD124  ';
    System.debug('Trimmed string = ' + rtrim(testString,' '));

    Method does not exist or incorrect signature: void rtrim(string, string)


I need to retain the leading spaces, if there are any. So, I can't use the trim() method.

I also tried without the second parameter, and it did not work either.

Can someone help?
  • January 07, 2021
  • Like
  • 0
Hi,

Can some one tell me how to set a default record type for a custom profile? It should be very easy, however, I am not able to do that in our production org. I opened up the profile and went into Object Settings and I found that Opportunity object is not listed there. I went under the Customize ==> Opportunities ==> Record Types and Customize ==> Opportunities ==> Sales Process and I could not find a way to set a default record type for a profile.

Can someone help?
 
  • October 07, 2020
  • Like
  • 0
We have a lightning page where a section is getting updated via a third party webservice. In order to show the updated values, we have a lightning component to refresh the page once the values are updated. However, this page is currently throwing the below error.
Uncaught Error in A$.getCallback() [Cannot read property 'reloadRecord' of undefined]

The code is given below.
PageRefresh.cmp:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="dataRecord" type="Object"/>
<aura:attribute name="recordSaveError" type="String" default=""/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<force:recordData aura:id="recordLoader" recordId="{!v.recordId}" layoutType="FULL" targetFields="{!v.dataRecord}" targetError="{!v.recordSaveError}" recordUpdated="{!c.handleRecordUpdated}" />
<aura:if isTrue="{!not(empty(v.recordSaveError))}">
<div class="recordError">
        {!v.recordSaveError}</div>
</aura:if>
</aura:component>

PageRefreshController.js:
({
doInit: function(component,event,helper){
    component.find("recordLoader").reloadRecord(true);
    //set time-out
    helper.setTimer(component);
},

    handleRecordUpdated: function(component, event, helper) {
    var eventParams = event.getParams();
    if(eventParams.changeType === "CHANGED")
    {
        component.find("recordLoader").reloadRecord();
        // get the fields that are changed for this record
        var changedFields = eventParams.changedFields;
        // record is deleted and removed from the cache
    } else if(eventParams.changeType === "ERROR") {
    }
},
})

PageRefreshHelper.js:
({
setTimer:  function(component){
var that = this;
window.setTimeout(
        $A.getCallback(function() {
        component.find("recordLoader").reloadRecord();
        that.setTimer(component);
    }),1000 //time after which the component reloads to check for any change in the record data
);
}
})

The same code works fine in Dev sandbox, but not in QA sandbox. Can someone help?
  • August 06, 2020
  • Like
  • 0
We are using a third party company to scan our salesforce code for SOQL Injection and Vulnerability issues with open page redirects. The below code is flagged as a vulnerability.
public Pagereference customCancel() {
Pagereference objPageref = new Pagereference('/apex/FulcrumInlineEdit?id='+OptyId);
objPageref.setRedirect(true);
return objPageref;
The page is not using any URL hacking mechanisms like saveUrl, retUrl or cancelUrl. Based on the information given in the trailhead Prevent Open Redirects in your code (https://trailhead.salesforce.com/en/content/learn/modules/secdev_application_logic_vulnerabilities/secdev_app_logic_preventing_open_redirect), I am not sure how to modify the above code to make it secure. Can someone help?
 
  • May 08, 2020
  • Like
  • 0
I am working on an assignment where I need to fix a SOQL Injection issue in one of the SOQL in a batch apex. The query is below.
 
SELECT Id, Name from Contact where (TrustName__c != null OR Status__c != null OR Title != null OR City__c !- null or Street__c != null or State__c != null) AND Id in (SELECT Contact__c from PP__c)

However, I am not sure how this SOQL was flagged as a vulnerable query since it is not querying a specific field with a LIKE or something like that.

Can someone clarify? If this is a vulnerable query, how do I re-write the query?
  • April 28, 2020
  • Like
  • 0
Need some help on an issue that I am currently facing in a trigger.

In the OpportunityTrigger, I am trying to assign the Account Owner as the owner of the opportunity if the opportunity has specific list of record types. My sample code is below.
 
List<String> strRecordTypes = new List<String>() {'Rtype 1', 'Rtype 2', 'Rtype 3'};
        List<Id> lstAccountIds = new List<Id>();
        Map<Id, Id> mapAccountOwnerIds =  new map<Id, Id>();
        for (Opportunity oppty : trigger.new) {
            if(oppty.AccountId != null) {
                lstAccountIds.add(oppty.AccountId);
            }
        }
        for (Account acc : [Select a.Id, a.OwnerId FROM Account a Where Id in :lstAccountIds AND a.Owner.IsActive = true]) {
            mapAccountOwnerIds.put(acc.Id, acc.OwnerId);
        }
        for (Opportunity oppty : trigger.new)  {
            String strAcctOwnerId = '';
            if (oppty.AccountId != null && MapSupportedRecType.size() > 0 && strRecordTypeNames.contains(oppty.RecordType__c)) {            
                **strAcctOwnerId = mapAccountOwnerIds.get(oppty.AccountId);**
                if(strAcctOwnerId != null && strAcctOwnerId !='') {
                    oppty.OwnerId = strAcctOwnerId;
                }
            }
        }



RecordType__c is a custom field on the Opportunity object that contains the name of the Record type.
However, when I test this code, I am getting the below error at line where strAccountOwnerId is getting assigned from the map.
 
> USER_DEBUG []|ERROR|==========> Trigger New Invocation is [2] which exceeds the limit of [2].  The logic will not run.

Can someone help?
  • April 16, 2020
  • Like
  • 0
In our Salesforce org, under "Activity Settings", the feature "Allow Users to Relate Multiple Contacts to Tasks and Events" is enabled. However, this seems to work only standard page layout when I click on "Log an Activity". We have a custom button to create an activity for a specific record type. On the name field (WhoId) on the page layout for the activity, it is presenting only a lookup popup where I can select only one contact or lead, However, on the standard page layout on actiivty, it is displaying a popup where I can select multiple contacts or leads (up to 50). Is there anyway I can show the same popup on the custom visual force page where I can associate the activity to multiple contacts or leads? Below are the screenshots of the custom page layout page popup and the standard page layout popup.

Lookup Popup on custom page:
========================
Lookup Popup on Custom Visualforce page.

Lookup Popup on standard page:
=========================
Lookup Popup on Standard page.

Can someone help?
 
  • September 09, 2019
  • Like
  • 0
I am working on an assignment in which I added couple of custom fields on the Content version object. The custom fields are showing up on the page layout. I want to enable the users on a specific profile to be able to edit the custom fields from the page layout. However, the Edit button is not appearing on the page layout. I am only seeing the "Deliver Content" and "Download" button for the users under this profile. For this profile, I have enabled the following settings.

1) Manage Salesforce CRM Content
2) Manage Content Permissions
3) Manage Content Properties.

However, I am still not able to see the EDIT button which allows the users to update the custom fields. Can someone help?

See the screenshot below for the buttons showing up on the Content page layout.

Page layout for the users under specific profile.

Below is what I am seeing under the System Administrator page.

Page Layout of System Administrator where Edit button is showing up.

Any thoughts or suggestions?

Thanks in advance,
pnb.
  • February 15, 2019
  • Like
  • 0
I am using an SOQL in a webservice that is querying the Contact object based on the BirthDate field. The webservice request has the date in the format of 'yyyy-MM-dd',i.e.,1962-01-29 as an example.
I am not able to use this value to query the Contact Object. I tried converting this String Date into Date object. However, it always has 00:00:00 at the end. I tried the below options.
String strDate = '1962-01-29'; 
Date birthDate = Date.valueOf(strDate) ==> This results in 1962-01-29 00:00:00 String strDate = '1962-01-29'; 

Date dob = Date.valueOf(strDate) 
Datetime dt = Datetime.newInstance(dob.Year(),dob.Month(),dob.day()); 
Date birthDate = dt.date() ==> This also results in 1962-01-29 00:00:00

How do I construct a Date object (without time) from the string date '1962-01-29'?
I did search for solutions in various forums and most of them are suggesting the above two solutions only, which does not work. I am not sure whether this behavior was changed in some Salesforce's releases.

I even tried the Date.parse() method. Whatever I do, I always get the Date with 00:00:00 at the end and this is messing up the SOQL query. When the SOQL is executed, I am getting a message saying [Exception: Line 1:343 No Viable Alternative at character '' ]. The SOQL is built as shown below.
 
USER_DEBUG [112]|DEBUG|Query:: SELECT id,LastName,FirstName,BirthDate,MiddleName__c,MailingAddress,OtherAddress,EmploymentStatus__c,Suffix__c,MaritalStatus__c,Gender__c,MailingState__c,HomePhone,MobilePhone,Email FROM Contact WHERE LastName LIKE 'Smith%' AND BirthDate = 1962-01-29 00:00:00  ORDER BY lastName,firstName,BirthDate LIMIT 50

If I run this query in workbench, I get the same error message.

Can someone help?
  • January 05, 2019
  • Like
  • 0
Hello friends,

I am trying to get an OAuth access token from Salesforce, but I am getting a "500 - Internal Server Occured." Can someone help?

Below is the curl command I am using.

curl -v -k https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id={client_id}" -d "client_secret={client_secret}" -d "username={sfdc_userid}" -d "password={sfdc_password}"

I tried with specific instane URL () also, but I am getting the same error.
  • March 19, 2018
  • Like
  • 0