• Vishwajeet kumar
  • 841 Points
  • Member since 2015
  • Principal Software Engineer
  • Targetrecruit LLC

  • Chatter
  • 28
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
  • 306
Hi All,
I have to display warning message in my standard page layout of a custom object. I'm using window onload function. Warning message is displayed but with flickers. Please guide me how to avoid this.

<apex:page standardController="Detail__c" extensions="WarningPage">
window.onload = function()
    if({!Detail__c.Status__c  = 'Details needed'})

<apex:form >
    <apex:pageBlock >
    <apex:actionFunction action="{!displayWarning}" name="dispWarn"/>
        <apex:pageMessages ></apex:pageMessages>
  • May 13, 2021
  • Like
  • 0
Hey All. Hoping to get some help on a Controller issue I can't resolve. I'm pulling a parameter from a URL  and using that in a SOQL query that will feed my redirect Parameter. Im getting a "Method does not exist or incorrect signature: void put(String, Account) from the type Map" error. 

Here is my code. Thank you very much in advance.

public class MyController {
    private final Account account;
    public MyController() {
        account = [SELECT FirstName,LastName,Measurement_Summary_ID__C  FROM Account 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('recid')];
     public PageReference validateAndRedirect(){

      //Write your logic here and redirect
      PageReference pageRef = new PageReference('/apex/Patient_Health_Dashboard');
      return pageRef;

Hi guys. I have a custom case object that prompts users upon creating a new case to select options from a picklist. Depending on which option is picked, the dependent sub-category picklist is then shown. Followed by a third sub-category. I need to be able to retrieve the different options and their succeeding choices in an excel sheet, with the dependent data all on the same row. I use the Python requests library to create a session with the Salesforce server and extract information from the page css. I also have the API names of the three picklists. Could anyone point me in the right direction to pull the picklist and push to csv file.  
Hello All,
Currently I am attaching a PDF that is dynamically generated and atatching it to an email.  All done via controller.
The email itself has become more complicated and the users want to be able to update the email as needed so I need to utilize a SF email template instead of my email controller.  Is this possible?  Use SF email tempalte and dynamically attach a file?  This file is not attched to the record.  I am currently rendering it as a pdf and attaching it before I send.  
Thank you,

Hello, I want to know if there's another way to allow user to input text that can be formatted using bold, underlined, italicize and bullets, without using Rich Text Area field, or maybe still use Rich Text Area field but make them smaller and hide the control bar? As you can see in the image, the Rich Text Area field looks too big compared to the other ones.

User-added image


Hi all

I am trying to work out a way to pull HTML code that gets saved in a long text record and use it to render a classic email template when that record is triggered to be used. If I paste the code in directly into the classic email template it works great but when called on as a field it doesn't work and displays as the raw HTML text. Does anyone have a way in which I could call on the HTML code saved in the field and use it to generate the email?
Hello, I need to do a RPAD on the following statement, but it does not seem to work in a the Select or Where Clause. 

Can a RightPad be use in the following way?

v_year = '2024';
       for (Candidate_Recs__c firstAssign : recsToProcess) {
             for (Contact seqAssign : [ Select MIN(lastName.RightPad(40, ' ') +
                    firstName.RightPad(40, ' ') +
                    middleName.RightPad(40, ' ') )
                    , MIN(contact.pre_code)
                      lastName.RightPad(40, ' ') +
                      firstName.RightPad(40, ' ') +
                      middleName.RightPad(40, ' ') +
                      firstAssign.lastName.RightPad(40, ' ') +
                      firstAssign.firstName.RightPad(40, ' ') +
                      firstAssign.MiddleNameRightPad(40, ' ') +
                  AND Contact.status IN ('AX', 'TQ', 'RO')
                  AND Contact.class_started = :v_class_yr
                  AND Contact.pre_code IS NOT NULL
                  AND Contact.employee_nbr IS NOT NULL]) {
                  //Do Something

Thanks for any help in advance.
This visualforce page is referenced in Sites inside my Salesforce Org. The site domain is iframed inside the company website.

On form submit, there should only be paragraph text saying "Thank you for Submitting the form, A team member will contact you soon." as a completed action and not redirect to any other page.

This is the code I have, but it redirects to the new page within an iframe, which looks ugly and confusing.  A simple Thanks you message on submit without navigating to a new page is what i am after. 

Can someone please guide. ? 
<apex: page ... >
         <apex:commandButton onclick="validation();return false;" value="submit" reRender="frm" />


 Public PageReference savelead(){
         if (this.validateRecaptcha() == false) {
             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Please re-enter the RECAPTCHA'));
            return null;
            lead.LeadSource = 'Web';
            lead.LastName = lastname;
            lead.Company = company;
            insert lead;
            PageReference reRend = new PageReference('https://www.companysite.com/node/111/done?sid=8888&token=8888888880d9c68282306d7af9f8888');
            return reRend;

Hello Everyone,

I have a requirment to insert  a feed with attachment link when any email is received in salesforce from EmailMessage [ Like if any customer is sending an email with attachment link so Feed should be inserted and attachment will link in feed ] like below image.
       User-added image

I have a requirment this by using a field -RelatedRecordId from FeedItem Object.

Please help me to get the answer....


If a changeset is successful in validation and deployment from a developer sandbox to a full sandbox, then successfully tested, should the changeset then be validated and deployed from the full sandbox to production or can the changeset be validated and deployed from the developer sandbox directly to the production environment.

Does the path matter as long as it has been tested in the full sandbox first before sending over to production?

Hello, I have a task to create "previous" and "next" buttons on detail page layout. I know that in my apex controller I will need to be able to write a SOQL query to fetch the record where the createddate was directly before the current record's createddate, and the record where the createddate was directly after the current record's createddate. I'm not sure if this is a basic question or not, but how can such a query be done? Thank you.
Hello - I need to deploy a class to a sandbox and need to run local tests. How can I run local tests using Microsoft Visual Studio? 

User-added image

This is my second post trying to figure this out. I have a method of the return type string with one integer Parameter. It is my first Apex class so I want to make it invocable so that if something goes wrong with it I can just deactivate the flow. 

However I can't wrap my head around the invocable method annotation, specifically turning everything in my method into some kind of list. Can anyone explain how I might do this?
//@InvocableMethod(label='Write Number' description='Writes the Number' category='Opportunity')
public static String writeNumber(Integer Amt) {
                Integer Amount=Amt;
                Integer Len;
                String spelledAmount;
                Map<Integer, String> numberName=new Map<Integer, String> { }; 
            String amountString=String.valueOf(Amount);
          List<Integer> arrayNumber=new List<Integer>();  
            String[] chars=amountString.split('');
            for(String c:chars) {

           Switch on Len { }

//Body of method

return spelledAmount;



I am getting this error for JSON.desrialize.

res = (List<cls_data>)JSON.deserialize(JSON.serialize(data),List<cls_data>.class);

Does anyone know about this issue. How to handle this error? Please help!

Please someone look into thes urgently - without solution to this issue I cannot deploy the package to production.

I am developing an unlocked package. When executing the command: 
force:package:version:create -p Package -d force-app -k key -w 10 -v DevHub
I get a great many errors thrown at me: some 320 errors listed for a total of 450 lines as counted by the execution of the unit test classes.
Note that:
  • All parts of the code have been tested on my developer org, I can deploy all components from my VS Code project with no problem at all.
  • All of the errors fall into one of a few categories
ComponentName: Variable does not exist: qli
ComponentName: Invalid type: QuoteLineItem
ComponentName: Method does not exist or incorrect signature: void getEntityAlias(QuoteLineItem) from the type ComponentName
ComponentName: DML requires SObject or SObject list type: List<QuoteLineItem>
  • when I add the --skipvalidation flag to the command the package builds with no errors. I can the install it on my scratch org and - according to the unit test execution - works as expected.



The solution is for a Non-Profit Coding Bootcamp that would like to be notified in Salesforce, or preferrably make field updates when students or alumni change their job title.

I am currently working to find documentation to get the LinkedIn: FullProfile object from their API. It seems LinkedIn only allows for the API calls to me made from a custom app that meets their approval standards (makes sense, but I just want to make API calls). The company's use will not be to build custom software. My plan is to just build some Apex Triggers for making the API calls. I will either have to find a creative workaround, or get the department on board with me building an App. Building a custom software or Lightning App solution is a possible route, so I am looking for creative ideas as well!

I am looking for someone that has experience with getting an App approved by LinkedIn to make the r_fullprofile request, and any general information about how to navigate their approval process.

I am looking for someone that has experience being an Administrator in a Group. I can see potential for a creative workaround using job title change notifications for the members of a group.

Thank you for your help in advance!

Hey,  I am having an issue with a visualforce page.  I can't see to get the list to load.  I have checked my permissions & don't have any issues with my code.  I have also tried different variations of the list name (Rent_Schedules__r,Rent_Schedule__r,Rent_Schedules__c,Rent_Schedule__c).  I believe the correcet sintax is Rent_Schedules__r.  Do you have any idea of what could be the issue?

Error Message: 'Rent_Schedule__r' is not a valid child relationship name for entity Opportunity
<apex:page standardController="Opportunity">
    <apex:relatedList list="Rent_Schedules__r" pageSize="50" rendered="{!$ObjectType.Rent_Schedules__c.accessible}"/>
User-added imageUser-added image
  • February 11, 2021
  • Like
  • 0
I have browsed forums for this issue and sadly it isn't helping much due to my basic knowledge of Apex.

I keep getting: List has no rows for assignment to SObject
public class SendEmailButtonController {
    private ApexPages.StandardController standardController;
    public SendEmailButtonController(ApexPages.StandardController acon){
        this.standardController = standardController;
    public static void sendEmail(){
        List<String> toAddresses = new List<String>();
        Class_Register__c cont = [SELECT Id, Contact__r.Email, Contact__r.Id, Class__r.Name, Class__r.Event_Sub_Type__c FROM Class_Register__c];

        Class__c contClass     = [SELECT Id, Name, Contact__c, Contact__r.Id, Event_Sub_Type__c FROM Class__c];

        EmailTemplate[] et     = [SELECT Id, DeveloperName, FolderId, Body, IsActive FROM EmailTemplate WHERE FolderId = '00D3L0000008l4sUAA' LIMIT 1];

        Contact contacts       = [SELECT Id, FirstName, LastName, Name FROM Contact WHERE Id=: contClass.Id];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String subType = contClass.Event_Sub_Type__c;
        switch on subType {
            when 'Webinar - Tools & Techniques' {
            when else {
                System.debug('no value match');
        mail.toAddresses = new String[]{cont.Contact__r.Email};
            Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});        

Hi ,
I have three fields in my VF page and user has to choose value from two of them manually.
Once both the values are choosed,  its SUM will be showed dynamically on the screen, it's ok . 
The problem is the sum result is a String that i don't want.
Selected values : 1 and 2  ー> result : 12
Expected result : 3

How to convert selected values to number type before sum total?
Please Help.

<apex:page standardController="EvaluationInformation__c" extensions="EISControllerV">
<!--Picklist (values : 1,2)-->
	<apex:inputField id="Emp_1_1" value="{!evaluation.PE1}" styleClass="plStyle"/>
	<apex:actionSupport event="onchange" rerender="sumwrapper"></apex:actionSupport>
	<apex:inputField id="Emp_1_2" value="{!evaluation.PE2}" styleClass="plStyle"/>
	<apex:actionSupport event="onchange" rerender="sumwrapper"></apex:actionSupport>

<!-- SUM will be showed here-->
<apex:outputPanel id="sumwrapper">
	<apex:outputText value="{!evaluation.PE1 + evaluation.PE2}" id="dpdresult" />      


I have inbound email code, I am collecting emails from Bank Account. I need to fetch the Id from the long text field. I have sample record here. Can anyone please share sample code with me to fetch the Fed Reference #. ?

In accordance with your instructions, we have DEBITED your account: **********XXX
for $1.00. If you have any questions, please contact your banker.

Fed Reference #: ABXDEFGHIJKLMN12345

Sender Bank Information:
ABA #: 111111111111
Bank Name: Sample Bank

Thank you in adance.
I'm trying to do a simple API call, I picked query but it says the SFO is not supported. I also tried SELECT name from Account. Is this a permissions issue with my connected app? I've included the policies I have setup below.

documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm

GET: {{_endpoint}}/services/data/v{{version}}/query/?q=SELECT+Email+from+Contact+LIMIT+2

version is 51.0

this is the response I get:

        "message": "\nSELECT Email from Contact LIMIT 2\n                  ^\nERROR at Row:1:Column:19\nsObject type 'Contact' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.",
        "errorCode": "INVALID_TYPE"

connected app
Application Permissions: 
     Provide access to your data via the Web
     Access and manage your data
I am working on the exercice in Navigate and Edit Source Code - I ccreated the Apex Class and was trying to execute using  -  Debug | Open Execute Anonymous Window. as per the instructions - I put in my email address and clicked execute but I do not get any email response showing my execute worked - What did I do wrong? I attached screen shots of my code . Thank youscreen shot of my codescreen shot of my codescreen shot of my code

Hello Saleforce community!

I have encountered really weird problem and can not move forward.

I am making internal callout to /services/data/v51.0/composite/tree/ContentDistribution to create ContentDistribution objects. This is workaround becasue I need these records before making callout,which causes uncommited work pending error.

This code does not work when used inside Apex and I am obtaining erorr message "This session is not valid for use with the REST API":

String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        Http h = new Http();
        Httprequest req = new Httprequest();
        //req.setHeader('Authorization', 'OAuth' + UserInfo.getSessionId());       
		req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId()); 

req.setBody(JSON.serialize(new Map<String,List<DistClass>>{'records' => linksToInsert}));
req.setEndpoint(baseUrl + '/services/data/v51.0/composite/tree/ContentDistribution');

HttpResponse response = h.send(req);
However exact same code works just fine when:
-called from anonymous window
- when I print sessionId
System.debug(UserInfo.getOrganizationId().substring(0, 15) + ' ' +  UserInfo.getSessionId().substring(15));
and hardcode it like:
req.setHeader('Authorization', 'Bearer ' + '00D3A0000000001!ARkAQApQe_Omitted_yGifr.u7.';
I was not able to resolve that issue for 2 days. What is wrong here?

Hello, I am trying to backup my salesforce org data using APIs. I only want to backup my data objects. How can I identify what is a data object vs metadata object using API calls? What API/APIs can I use for this and what field/fields can help me make the identification that an object is a data object vs metadata object. 
Hello Everyone,

I'm having an issue when using Twilio Flex with SSO embeded as an iframe in Salesforce. Everytime I log in to Salesforce or refresh the page, this window pops up. It should log in to Flex, but in stead, it throws that error.
Please, could someone help me solve this?

Thank you so much!!!


User-added image
kindly have a look of button number 1 which calls button number2 and i need to pass id from button 1 to button 2.

Button 1:
var id= '{!Account.Id}';
var ids = sforce.apex.execute('CreateContract','CreateRecord',{recId :id});
function openConga(){
window.open('{!URLFOR($Action.Contract.CreatesContracts, Contract.Id)}','_blank');

button 2  (name=createscontracts):

while calling the button number 2, it shows the id null in conga url for (contract.Id). 
could you please assist me, how can i pass id from first javascript button to another one and can get the value for contract.id in conga url.

I shall be grateful to you for your kind assistance.
Thanks and regards
I want to remove the salesforce validation rule on check of checkbox in VF page. It is workig for first time but if we try to submit the page without filling any of the required field, the field validation is showing up again.

User-added image

User-added image

This is the script
<script type="text/javascript">
                if($(".anonymousFN")[0].parentElement != null){
                    $(".anonymousFN")[0].parentElement.children[0].className = '';
                    $(".anonymousLN")[0].parentElement.children[0].className = '';
                    //$(".anonymousFN")[0].value = 0;
                 //  $("[id$=LastName]").prop("required",false);
               // $("[id$=FirstName]").required = false;
                // $("[id$=FirstName]").prop("required",true);
                  // $("[id$=LastName]").prop("required",true);
                if($(".anonymousFN")[0].parentElement != null){
                    $(".anonymousFN")[0].parentElement.children[0].className = 'requiredBlock';
                    $(".anonymousLN")[0].parentElement.children[0].className = 'requiredBlock';

here is the defination
<apex:pageblockSectionItem  >
                     <apex:outputLabel value="{!$Label.GMI_Anonymous_Contact}" ></apex:outputLabel>
                     <apex:inputCheckbox value="{!cas.AnonymousContact__c}" id="enabledisablecheckbox"  onClick="disableEnableField()" /> 
                   </apex:pageblockSectionItem >

Can someone please help!!
This page has an error. You might just need to refresh it. First, would you giveUser-added image us some details? (We're reporting this as error ID: -1284455686)
The main issue is that we're currently unable to create a version of a package of an sfdx project we're building. Judging from the error's we've received, it's almost as if the temp files of our project are not updating properly via the CLI. However, without much visibility, we're unable to know for sure.

The most recent error when we run force:package:version:create is:
Multiple errors occurred:\n(1) TestSobjectTriggers: Variable does not exist: RecordTypeId\n(2) TestSobjectTriggers: Variable does not exist: FirstName\n(3) TestSobjectTriggers: Variable does not exist: LastName\n(4) TestSobjectTriggers: Variable does not exist: RecordTypeId\n(5) TestSobjectTriggers: Variable does not exist: FirstName\n(6) TestSobjectTriggers: Variable does not exist: LastName\n(7) TestSobjectTriggers: Variable does not exist: FirstName
However the unit tests in the TestSobjectTriggers class run fine.

Previously, it was complaining that the package was not defined in the sfdx-project.json, which was fixed by making it so temporary files would remain in the .sfdx directory. What I found there was that the file in the temp directory didn't match what was in the project directory.
we need to lower the allowable API version of Apex in the org to a value of 33 (or lower, up to 27). Please help. Thanks!
I am trying to create an Age Formula field that takes in the custome date field Birthdate the only issue is Birthdate is Encrypted. Is there any way to do this?
Hi All,
I have to display warning message in my standard page layout of a custom object. I'm using window onload function. Warning message is displayed but with flickers. Please guide me how to avoid this.

<apex:page standardController="Detail__c" extensions="WarningPage">
window.onload = function()
    if({!Detail__c.Status__c  = 'Details needed'})

<apex:form >
    <apex:pageBlock >
    <apex:actionFunction action="{!displayWarning}" name="dispWarn"/>
        <apex:pageMessages ></apex:pageMessages>
  • May 13, 2021
  • Like
  • 0
Hi, I've been a Salesforce developer for a few years now and one of the tasks that I've had to carry out many times is performing an update on a set of thousands of records via data loader. For example, we want to update a field on all 10,000 opportunities in the org.

Now, in order to do that update safely, I will always backup the opportunities into a CSV before I run the data load. I'll also look through all the triggers, process builders, workflow rules to make sure that updating the field won't trigger cascading changes throughout the system.
But even if you do all of that, you still can't be 100% sure that there were no unexpected changes in the system as a result of the data load... unexpected field updates etc.

I just want to start a discussion to see if I can learn what other people do as best practices when performing mass dataloads. What steps do you take to give yourself peace of mind? Let me know. Thank you
So Salesforce support told me to pound sand and come see you guys so hopefully you can help.  I have a screen flow which is tossing this error and there is absolutely nothing I can translate into an issue.  The fault is happening at a screen element.  But not when the screen element loads, only after you select "Next".  Then the attached pops up.  The first messgae is:

This page has an error. You might just need to refresh it. First, would you give us some details? (We're reporting this as error ID: -362443059)

Under "Technical Stuff" it shows:
[Event fired]

Then when you click "OK" you get this:

Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details. Error ID: 1330714629-174344 (-151389934)

There are 2 toggles which control visibility on other fields.  Those are both inactive when the error hits (but I did try activating them with the same results).  They appear to be duplicated on the screen and the error appears directly above them.

User-added image

Running in Debug Mode from within the Flow, I get the same error, but the debug log does not proceed beyond setting the initial values for the screen element.

User-added image

Any help in a direction to look would be greatly appreciated.  Very frustrated.  I worked on this flow for a long time and it is and has been working.  This error has only shown up on 2 transactions and I can't for the life of me find the issue.
I have a managed pacakge with custom funcionality and I want to allow the Admin to control which users have access to it.
When I tryed to display the list of users and allow picking from it I encountered the limit of 170K for the visual force page.
I would like to know is there a strandrd way to display the list of avaible users in the org and allow the Admin to pick from it?
  • May 07, 2021
  • Like
  • 0
Hello Everyone, 

I am trying to create a scratch org and getting a storage limit exceeded error. I even tried to create it on new developer org but same result. 

Would really appreciate if anyone can help on this.

Thanks in advance!

Hi everyone,

Actually we have one task,we need to Upload Document data which where in salesforce we need to get that data in other application using API"s.If any one know how to send that data please respond.

Thanks inadvance,
my edit commandLink i s not working , when click no response  check the below code  help me to find error:
controller class:
public class contactSaveandEditClass {
    public List<wrapperclass> contactList{get; set;}
    public integer RowIndex{get; set;}
    public wrapperclass objwrapper;
    public  contactSaveandEditClass(){
        list<contact> contacts=[select id,FirstName,LastName,Phone,Title from contact];
        contactList=new list<wrapperclass>();
    for(integer i=0;i<contacts.size(); i++){
        objwrapper=new wrapperclass(); 
        public PageReference  EditMethod(){
            return null;
         public pageReference SaveMethod(){
            return null;
         public class wrapperclass{
        public contact con{get; set;}
        public boolean doEdit{get; set;}
        public integer RowNo{get; set;}

VF class:
<apex:page controller="contactSaveandEditClass">
    <apex:sectionHeader title="Contacts"/>
    <apex:form >
        <apex:pageblock id="acc" title="Contact List">
            <apex:pageBlockSection >
                <apex:pageblocktable value="{!contactList}" var="a">
                    <apex:column headerValue="Action">
                         <apex:commandlink action="{!EditMethod}" value="Edit" reRender="acc"  rendered="{!NOT(a.doEdit)}">
                             <apex:param Name="rowNumber"  Value="{!a.RowNo}"  assignTo="{!RowIndex}"/>
                     <apex:commandlink action="{!SaveMethod}" value="Save" reRender="acc"  rendered="{!(a.doEdit)}">
                             <apex:param Name="rowNumber"  Value="{!a.RowNo}"  assignTo="{!RowIndex}"/>
                    <apex:column headerValue="FirstName" >
                        <apex:outputField value="{!a.con.FirstName}" rendered="{!NOT(a.doEdit)}" />
                        <apex:inputField value="{!a.con.FirstName}" rendered="{!(a.doEdit)}"/>
                     <apex:column headerValue="LastName" >
                    <apex:outputField value="{!a.con.LastName}" rendered="{!NOT(a.doEdit)}" />
                     <apex:inputField value="{!a.con.LastName}" rendered="{!(a.doEdit)}"/>
                    <apex:column headerValue="Phone">
                     <apex:outputField value="{!a.con.Phone}"  rendered="{!NOT(a.doEdit)}"/>
                     <apex:inputField value="{!a.con.Phone}" rendered="{!(a.doEdit)}"/>
                    <apex:column headerValue="Title" > 
                     <apex:outputField value="{!a.con.Title}" rendered="{!NOT(a.doEdit)}"/>
                     <apex:inputField value="{!a.con.Title}"  rendered="{!(a.doEdit)}"/>
Thank You