• BPOOR
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 19
    Replies
Is there anyway to find out if a custom field is updated by a regular user or by a process like flow? I have two custom fields "Order Date" and "Activation Date" on a custom object. The requirement is to auto populate the "Order Date" whenever the "Activation Date" is changed. However, if the "Order Date" field is manually updated by a regular user, the flow should not override it.

Is there anyway to find out if the "Order Date" field is updated by a regular user or by the flow without having another helper field?
  • October 12, 2023
  • Like
  • 0
Our business team wants us to display the opportunity revenue in both USD and EUR. Is it possible to do that? For ex, if the Opportunity Revenue is USD 1000, they want it to display as shown below.
 
Opportunity Revenue: USD 1,000/00 (EUR 917.95)

Can someone help?
  • July 05, 2023
  • Like
  • 0
I have two lists with two different different fields to update the asset object in Salesforce. Below is the sample data.
 
List1:
====

AssetId                      Field1
a2i1                           abc
a2i2                           acb
a2i3                           cad
a2i4                           gfd


List2:
====

AssetId                      Field2
a2i0                           mnp
a2i2                           nop
a2i3                           mnh
a2i7                           pqr
a2i8                           iyo


Expected Output List:
==================

AssetId                      Field1             Field2
a2i0                                                  mnp
a2i1                           abc
a2i2                           acb                 nop
a2i3                           cad                 mnh
a2i4                           gfd
a2i7                                                   pqr
a2i8                                                   iyo

When I merge them into one list, I get an exception during the update as the list has duplicate ids in it (a2i2, a2i3). I would like to merge both lists into one, but having both fields in the list as shown above.

Since the lists contain Ids, I can convert them into two maps and loop thru the first map using KeySet() and check if the Id is present in the second map. If it is available, I can populate field2. But I need to repeat the same with map2.

Is there a better approach for this?
 
  • August 20, 2022
  • Like
  • 0
I have developed a lightning dashboard with multiple reports with and without charts. The dashboard is working fine and the customer is happy. However, customer wants to schedule the dashboard refresh and share the results to certain people via email.

I have done some research and it looks like sharing the dashboard results as a pdf is not yet supported by Salesforce.

Can someone help and let me know if there is a way to get this done?
  • February 14, 2022
  • Like
  • 0
I have an apex class making a callout to an external REST API and gets a response as shown below.
[
{
    "externalGUID": "0d872ca4-45fc-45f9-97f7-0c4f8068ea79",
    "carrierName": "ABC",
    "effectiveDate": "2020-02-19T00:00:00",
    "endDate": "2020-12-31T00:00:00",
    "renewalDate": null,
}
]
I have an apex class making a callout to an external REST API and gets a response as shown below.
[ { "externalGUID": "0d872ca4-45fc-45f9-97f7-0c4f8068ea79", "carrierName": "ABC", "effectiveDate": "2020-02-19T00:00:00", "endDate": "2020-12-31T00:00:00", "renewalDate": null, } ]
The effectiveDate and endDate (datetime fields) are passed as CST times from the external system. However, when I use the apex code to populate the details on the Salesforce Asset object, the effectiveDate and endDate are off by 2 days. If I use it as GMT time, these dates are off by 1 day.
Below is the apex code that I am using to populate the info on Asset object.
 
template.effectiveDate = (oprResponse.effectiveDate==null)?null:(date.newInstance(oprResponse.effectiveDate.yearGmt(),oprResponse.effectiveDate.monthGmt(),oprResponse.effectiveDate.dayGmt()));
        template.endDate = (oprResponse.endDate==null)?null:(date.newInstance(oprResponse.endDate.yearGmt(),oprResponse.endDate.monthGmt(),oprResponse.endDate.dayGmt()));
        template.renewalDate = (oprResponse.renewalDate==null)?null:(date.newInstance(oprResponse.renewalDate.yearGmt(),oprResponse.renewalDate.monthGmt(),oprResponse.renewalDate.dayGmt()));

The template.effectiveDate is populated on the InstallDate in Asset object at a later part of the code.
How do I make sure to integrate the effectiveDate and other dates as CST dates in Salesforce? Can someone help?
 
  • December 14, 2021
  • Like
  • 0
I am working on an assignment where I need to process some subscribed events in Salesforce when a third party system publishes an event. The third party system publishes an event when there is a change in a database record. We have a middleware application that reads the messages from the third party's event bus and makes a rest API callout to insert a record into a platform event object with the event/database record details.

In Salesforce, I have developed an apex trigger on the Platform event object that executes a service class that is implementing Queueable. The queueable class reads the event details and makes a callout to the third party API to get further details about the record that was changed and performs an upsert into the Asset object in Salesforce. So far, it is going good. However, while testing, I found certain scenarios that need to be addressed and I am not sure of an efficient way of doing those. Below are the scenarios that need to be addressed.

1) I see that the third party API is returning a 204 - No Content at times. In that case, I need to queue that event again so that it needs to be re-processed. How do I do this?
Bu2) siness wants me to perform an upsert only there are real data changes on the Asset object. The third party system is pushing several dummy updates and I want to ignore them. My idea is to create an AssetTemplate class and build two maps of definition Map<externalId, AssetTemplate> where one map will be populated from the response of third party API and the second map will be populated from the Asset object. Then I will loop through the APIResponseMap, find the corresponding map element from the AssetMap, compare the AssetTemplate objects in them and if they are different, then build a new Map with the externalId as Key and AssetTemplate as the value. Finally, I will loop through the final map and perform an upsert on the Asset object in Salesforce. Is there a better way of doing this?

Can someone help?
  • November 02, 2021
  • Like
  • 0
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
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 have two lists with two different different fields to update the asset object in Salesforce. Below is the sample data.
 
List1:
====

AssetId                      Field1
a2i1                           abc
a2i2                           acb
a2i3                           cad
a2i4                           gfd


List2:
====

AssetId                      Field2
a2i0                           mnp
a2i2                           nop
a2i3                           mnh
a2i7                           pqr
a2i8                           iyo


Expected Output List:
==================

AssetId                      Field1             Field2
a2i0                                                  mnp
a2i1                           abc
a2i2                           acb                 nop
a2i3                           cad                 mnh
a2i4                           gfd
a2i7                                                   pqr
a2i8                                                   iyo

When I merge them into one list, I get an exception during the update as the list has duplicate ids in it (a2i2, a2i3). I would like to merge both lists into one, but having both fields in the list as shown above.

Since the lists contain Ids, I can convert them into two maps and loop thru the first map using KeySet() and check if the Id is present in the second map. If it is available, I can populate field2. But I need to repeat the same with map2.

Is there a better approach for this?
 
  • August 20, 2022
  • Like
  • 0
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