• Rounak Sharma
  • NEWBIE
  • 457 Points
  • Member since 2018
  • Salesforce Developer


  • Chatter
    Feed
  • 13
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 160
    Replies
Hi,

Please help me know the difference between the below two :-

List<Account> accntList = new List<Account>();  ----   I'm creating an Instance.
List<account> accntList; ----   I'm just declaring a list variable.

Thanks and regards
Siri
Hi guy's,

I am new in salesforce. What is sales process can you please help me .
New to visualforce

I keep getting this error when I create visualforce pages. The developer console says the error is in line 0, which leads me to believe my code is fine and it is just the name that is returning the error. How can I fix this?

It does not matter what name i give it, I keep getting this error. Help, please!User-added image
public class FirstClass {
    public static void firstMethod() {
        System.debug('hello world');
  }
}

this sample code shows the error be like

"Method does not exist or incorrect signature: void firstMethod() from the type FirstClass"
Hello,

I have below error:
FATAL_ERROR caused by: System.AsyncException: Future method cannot be called from a future or batch method:

for a workarounf, can i do like below
Trigger before update
  Call a future class
     Call API
     DO a Update action

Trigger After update
    Call a future clas
       Call a API

What will be my best configuration to do

What are generic rules , DML, Future how to set them

thank you for suggestion
  • September 27, 2019
  • Like
  • 0
Hi All.

I am trying to navigate from Component to Community buidler page and tried below code it did not work though I am not getting any error.

The button is not in Lighting app it is in commuity within the lightning component.

 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
 <lightning:navigation aura:id="navService"/>
 <lightning:button label="Navigate" onclick="{!c.handleClick}"/>
</aura:component>
({
    handleClick: function(cmp, event, helper) {
     var navService = cmp.find("navService");
     var pageReference = {
                         "type": "standard__component",
                         "attributes": {
                                         "componentName": "c__WebinarOverride"
                                       }, 
                         "state": {
                             'message':'This is the target page'
                         }
                        };
     navService.navigate(pageReference);
    }
})
 
({
	doInIt : function(component, event, helper) {
		 var id = component.get("v.pageReference").state.message; 
                 var toastEvent=$A.get('e.force:showToast');
                    toastEvent.setParams({
                      title:'Rendering page',
                      message:id,
                      key:'info_alt',
                      type:'info',
                      mode:'pester'
               });
        toastEvent.fire();
	}
})



 
Why the name is not displaying in hyperlink format.
Any erro rin the code? 

<apex:page sidebar="false" controller="accountsControler">
<apex:sectionheader title="List" subtitle="Contacts List">
<apex:form >
<apex:pageBlock title="List Of Contacts" >
<apex:pageBlockTable value="{!conlst}" var="con">
<apex:column value="{!con.name}"/>
<apex:column value="{!con.phone}"/>
<apex:outputLink value="/{!con.id}" target="_blank">
{!con.name}
</apex:outputLink>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>>
</apex:sectionheader>
</apex:page>
Hello,

If the field level setting is ready only. for all profieels except system administrator.

and a trigger exisits on that field to fill it before insert.

Will the trigger execute ?
thank you for suggestion
  • September 23, 2019
  • Like
  • 0
Object RAQ_Header__c is parent of RAQ_Question__c object. RAQ_Question related list contains list of questions that has been retrieved by a custom metadata using Trigger after insertion of RAQ_Header__c. Here I am trying to fetch the different set of question to display into different section. Can you please suggest a way to optimise the code to reduce SOQL Used -

Public with sharing class myRAQExtension {
  
    private final RAQ_Header__c raq;
    list<RAQ_Question__c> Quests;
    list<RAQ_Question__c> Quests2;
    list<RAQ_Question__c> Quests3;
    list<RAQ_Question__c> Quests4;
    list<RAQ_Question__c> Quests5;list<RAQ_Question__c> Quests6;
    list<RAQ_Question__c> Quests7;list<RAQ_Question__c> Quests8;
    list<RAQ_Question__c> Quests9;list<RAQ_Question__c> Quests10;list<RAQ_Question__c> Quests11;
    list<RAQ_Question__c> Ques= new list<RAQ_Question__c>();
    public myRAQExtension(ApexPages.StandardController stdController) {
        this.raq = (RAQ_Header__c)stdController.getRecord(); 
        Quests=[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c < 4 and Header__c=:raq.id];
        Quests2 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 4 and SR__c <= 5 and Header__c=:raq.id];
        Quests3 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 6 and SR__c <= 11 and Header__c=:raq.id];
        Quests4 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 12 and SR__c <= 14 and Header__c=:raq.id];
        Quests5 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 15 and SR__c <= 16 and Header__c=:raq.id];
        Quests6 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 17 and SR__c <= 18 and Header__c=:raq.id];
        Quests7 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 19 and SR__c <= 20 and Header__c=:raq.id];
        Quests8 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 21 and SR__c <= 22 and Header__c=:raq.id];
        Quests9 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 23 and SR__c <= 24 and Header__c=:raq.id];
        Quests10 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 25 and SR__c <= 30 and Header__c=:raq.id];
        Quests11 =[select Question__c,SR__c,Select_Answer__c,Comment__c from RAQ_Question__c where SR__c >= 31 and SR__c <= 36 and Header__c=:raq.id];
        Ques.addAll(Quests);
        Ques.addAll(Quests2);
        Ques.addAll(Quests3);
        Ques.addAll(Quests4);Ques.addAll(Quests5);Ques.addAll(Quests6);Ques.addAll(Quests7);Ques.addAll(Quests8);Ques.addAll(Quests9);Ques.addAll(Quests10);
        Ques.addAll(Quests11);
       
    }
    public list<RAQ_Question__c> getQuests() {       
        return Quests;
    }
    public list<RAQ_Question__c> getQuests2() {       
        return Quests2;
    }
     public list<RAQ_Question__c> getQuests3() {       
        return Quests3;
    }
    public list<RAQ_Question__c> getQuests4() {       
        return Quests4;
    }
       public list<RAQ_Question__c> getQuests5() {       
        return Quests5;
       }
    public list<RAQ_Question__c> getQuests6() {       
        return Quests6;
       }
    public list<RAQ_Question__c> getQuests7() {       
        return Quests7;
       }
    public list<RAQ_Question__c> getQuests8() {       
        return Quests8;
       }
    public list<RAQ_Question__c> getQuests9() {       
        return Quests9;
       }
    public list<RAQ_Question__c> getQuests10() {       
        return Quests10;
       }
        public list<RAQ_Question__c> getQuests11() {       
        return Quests11;
       }
  
   
public pagereference save(){  
 try{
 update Ques;
 update raq;
     ApexPages.addMessage(new ApexPages.message(
        ApexPages.SEVERITY.Confirm,
        'Record successfully saved'
    ));             
}
catch (Exception ex) { 
        ex.getMessage();
}     
return null;
}
}
Hello,

I want to implemeent below usecase

After update
 - I want to check that if the Picklist_Custom__c value = XYZ
IF true i want to call a Apex_classNAme.ApexFucntion()

How can i write the code for same.

thank you 
  • September 19, 2019
  • Like
  • 0
Hi all,

please find the below code for reference my case was i dont want to get the user from user table.i need to get the users from the parameter variable called as alluser.anyone please tell me the soql query for how to write a query for parameter variable class.

Public Static List<String> GetUserListForTaskAssignmentNew(List<String> allUser){
        List<String> UserId = new List<String>();
        List<User> assignUserList=new List<User>();
        String User = null;
        List<AggregateResult> TaskCount = [SELECT ownerId, count(Type) from Task where createdDate<=Today and GroupId In (select id from alluser where id=:ownerId) group By ownerID];
        {
            if(allUser.size() > 0)
            {
                 
            }
        }
        return UserId;
    }
}

Thank You in advance.
If i change my Criteria for a time-base workflow all records that are still in the queue will still undergo the end change unless they are "edited" to do a "re-evaluation check" of the workflow?

have a time based workflow with a LOT of records that needs criteria changed. wondering if i need to do another step to clean the queue out of records that no longer meet the workflow criteria.

thanks
I have used the below trigger to auto synce quoteline item products on select of syncing chekc box on quote but it is not getting synced. can anyone correct the code

trigger QuoteLineItemTrigger on Quotes__c (after update, after insert) {
    Set<Id> quoteIdsForOpportunitySync = new Set<Id>();
    Set<id> QuoteIds = new Set<id>();
    List<QuoteLineitem__c> quoteLineItemsForOpportunitySync = new List<QuoteLineitem__c>();
    List<OpportunityLineItem> opportunityLineItemsForOpportunitySync = new List<OpportunityLineItem>();
    Map<Id, Id> quoteIdToOpportunityIdMap = new Map<Id, Id>();
    Map<Id, QuoteLineitem__c> qliIdentifierToQuoteLineItemMap = new Map<Id, QuoteLineitem__c>();
    List<OpportunityLineItem> opportunityLineItemsToUpdate = new List<OpportunityLineItem>();
    List<Quotes__c> quotesToStopSyncing = new List<Quotes__c>();
    
    for(Quotes__c q : Trigger.new) {
        if(q.IsSyncing__c == true) {
            // we can use a set here to prevent duplication of quote ids
            quoteIdsForOpportunitySync.add(q.Id);
            // we're mapping the quote id to the opportunity id here
            // for use when we're iterating through the quote line items
            quoteIdToOpportunityIdMap.put(q.Id, q.OpportunityId__c);
            system.debug('OpportunityId__c '+q.ID);
        }
    }
    
    quoteLineItemsForOpportunitySync = [SELECT Id, QuotesId__c, Product2Id__c FROM QuoteLineitem__c WHERE QuotesId__c IN :quoteIdsForOpportunitySync];
    
    for(QuoteLineitem__c qli : quoteLineItemsForOpportunitySync) {
        Id opportunityId = quoteIdToOpportunityIdMap.get(qli.QuotesId__c);
        if(opportunityId != null) {
            // we could use a nested map but this solution will work using a constructed identifier
            // it also keeps the code slightly cleaner
            // using Product2Id__c isn't ideal in this situation and if the QuoteLineitem__c could store the
            // originating OpportunityLineItem Id it would simplify the solution considerably.
            String qliIdentifier = String.valueOf(opportunityId) + '-' + String.valueOf(qli.Product2Id__c);
            qliIdentifierToQuoteLineItemMap.put(qliIdentifier, qli);
        }
    }
    
    // find all the OpportunityLineItem that belong to any of related opportunites
    opportunityLineItemsForOpportunitySync = [SELECT Id,Name,OpportunityId, Product2Id FROM OpportunityLineItem WHERE OpportunityId IN :quoteIdToOpportunityIdMap.values()];
    
    for(OpportunityLineItem oli : opportunityLineItemsForOpportunitySync) {
        // now we reconstruct the identifier to match back to the map
        String oliIdentifier = String.valueOf(oli.OpportunityId) + '-' + String.valueOf(oli.Product2Id);
        QuoteLineitem__c relatedQli = qliIdentifierToQuoteLineItemMap.get(oliIdentifier);
        // only do the following steps if a matching QuoteLineitem__c is found
        if(relatedQli != null) {
            // as you haven't defined what to sync i've put an example description update
            // you can alter this to update any OpportunityLineItem field,
            // just make sure you add it to the query above
            oli.Description = relatedQli.QuotesId__c;
            opportunityLineItemsToUpdate.add(oli);
            
            // re-creating the quote here so we only update quotes that the sync has been sucessful
            Quotes__c q = new Quotes__c(
                Id = relatedQli.QuotesId__c,
                IsSyncing__c = false
            );
            
            quotesToStopSyncing.add(q);
        }
        System.debug('relatedQli.QuotesId__c ' + relatedQli.QuotesId__c ); 
    }
    
    // best practice is to wrap any updates in try - catch methods
    update opportunityLineItemsToUpdate;
    // we could also take advantage of the before trigger to prevent a further dml statement
    // however, this approach is closest to op's original so should be easier to understand
    update quotesToStopSyncing;
}
Below are snips for your reference

User-added image
User-added imageUser-added image
I'm trying to align two buttons side-by-side more closely User-added imagebut having something fierce of a problem. I've used grids, gutter grids, div widths, etc...

Here is the current look (see attachment) and code. Right now I'm trying to align them through layoutItems


<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global"> 
    <lightning:layout horizontalAlign="right">
        <lightning:layoutItem size="10">
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-xxsmall">
            <c:InsertRecord/>
        </lightning:layoutItem >
        <lightning:layoutItem flexibility="auto" padding="around-xxsmall" >
            <c:FlowInsideModal />
        </lightning:layoutItem>
    </lightning:layout>   
</aura:component>






 
Hi All, Can you please help me to convert below logic into helper class. I am getting exception as attempt to deference null object.  Thanks.
 
trigger contactAmountSum on Contact (after insert, after delete, after undelete, after update) {
    set<Id> accIdSet = new set<Id>();
    
    if(trigger.isinsert || trigger.isUpdate || trigger.Isundelete){
        for(Contact conObj: Trigger.new){
			if(Trigger.isInsert || Trigger.isUndelete || (conObj.Amounts__c != Trigger.oldMap.get(conObj.Id).Amounts__c || conObj.AccountId != Trigger.oldMap.get(conObj.Id).AccountId))
				accIdSet.add(conObj.AccountId);            
        }
    }    
    if(trigger.isUpdate || trigger.isDelete) {
        for(Contact conObj: Trigger.old){
            if(Trigger.isDelete || (conObj.Amounts__c != Trigger.newMap.get(conObj.Id).Amounts__c || conObj.AccountId != Trigger.newMap.get(conObj.Id).AccountId))
				accIdSet.add(conObj.AccountId);
        }
    }       
    List<Account> accList = [select id, Amounts__c, (Select Id, Amounts__c from contacts) from Account Where ID IN: accIdSet];    
    for(Account acc : accList){
        
        acc.Amounts__c = 0;
        for(Contact conObj : acc.contacts) {
			acc.Amounts__c += conObj.Amounts__c;
        }
    }
    update accList;
}

Below is the helper class:
 
public class contactAmountSumHelperClass
{
    public static void updateContactCountonAccount(Map<Id, Contact> newContactMap, Map<Id, Contact> oldContactMap)
    {
        Set<Id> accIdSet = new set<Id>();
                
        for(Contact con: newContactMap.values())
        {
            if(con.AccountId != null){
                if(con.Amounts__c != oldContactMap.get(con.Id).Amounts__c ||
                    con.AccountId != oldContactMap.get(con.Id).AccountId){
                    accIdSet.add(con.AccountId);
                }
            }
        }
        
        List<Account> accList = [select id, Amounts__c,Description, (Select Id, Amounts__c from contacts ) from Account 
                                 Where ID IN: accIdSet ];    
        for(Account acc : accList)
        {        
            acc.Amounts__c = 0;
            for(Contact conObj : acc.contacts)
            {  
                acc.Amounts__c += conObj.Amounts__c; 
            }
        }
        update accList; 
    }
}

 
Hello,
Can we create a custom app through apex code? I see that we can create custom objects and fields through apex code. Similarly, can we create a custom app through salesforce? Just an app called Demo and add custom tabs to it through apex code.
Hello,

I am trying to allow full priviledges for three users on my development org, so that they have the ability to access and edit every aspect of the environment the same as I (the admin/account owner) can. I was able to do this for one other user, but when I try to add these permissions to the profiles of the other three, the option does not appear in the drop-down menu. These three profiles have a Standard Platform User License, which I believe is what is preventing me from granting administration privileges. How do I fix this so that I can assign full privileges to all users?
Hi everyone,

I want to Round Robin the opportunity if it's not contacted by 3 days. If a representative get 5 cycles of Round Robin, the Director will get notification.

How can I start with this project? I'm thinking using Process Builder, but it wouldn't work for the second part.

Please give me some advice on this. Thank you!
Hi,

I am trying to get response using workbench via creted custom api url mapping,but how to use this into workbench. 


@RestResource(urlMapping='/LeadActivity/*')
global with sharing class myActivityTask {
        @HttpGet
    global static list<lead> doGetLead(){
        
        list<task> activityLog=new list<task> ();
        List<id> leadsId = new List<id>();
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String TaskId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
        list<Task> taskList=[SELECT CallObject,CallType,CompletedDateTime,CreatedById,CreatedDate FROM Task];
        for(task str:taskList){
            leadsId.add(str.WhoId);
        }
        list<Lead> result = [SELECT Id, Name, Phone, Website FROM Lead WHERE Id = :leadsId];
        return result;
    }
}
I am trying to show an edit pop up when someone clicks on the icon shown with aura iteration. Below is my code -

<aura:iteration items="{!v.campaign.Campaign_Members__r}" var="cm">
<tr>
   <td class="slds-text-align_center">
   <div id="{!cm.Id}" class="{!'btn-editStatus cmId-'+cm.Id}" onclick="{!c.handleEdit}">
          <lightning:icon size="x-small" iconName="utility:edit"/>  
   </div>
   </td>
</tr>
</aura:iteration>

How should I get the Id of the record (cm.Id) in the handleEdit function in the lightning controller?

Hi, 
I must tracking visiti from visualforce page into a custom object (VF_TRacking__c).
This is the first part op VF Page:
<apex:page standardController="Age__c" showHeader="false" standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" action="{!trackVisits}">

So the action save the information into an other custom object, differnt the StandardController (Age__c).
How can resolve this issue?

Thanks a lot,
Iacopo

<apex:commandButton value="Save & New" action="{!recordSaveandNew}"></apex:commandButton>

public PageReference recordSaveandNew()
            {   
                convertLeadRecord();
                //this code will redirect to home page but i need to redirect new lead page
                PageReference pg =new PageReference(Url.getSalesforceBaseUrl().toExternalForm());
                return pg;
            }
Hi All,
I have My Custom Visualforce Page With Pagination.each page i am displaying 5 Records .so  When I select Few Records Before Goining To Delete. I want Show popup Window  and size of Records in Popup Window.
When click Ok In PopWindow then Only Delete Records otherwise not to delete.
 

I have a write a below code for achieve the above in trailhead, but it shows below error : Illegal assignment from List<Contact> to List<contact>

Code: 

public class ContactSearch {
public static list<contact> searchForContacts(string lastname,string MailingPostalCode)
    { 
        list<contact> ContactList=[select id,name,lastname,mailingpostalcode from contact where lastname=:lastname and mailingpostalcode=:MailingPostalcode];
        return contactlist;
    }
}

Hi,

Please help me know the difference between the below two :-

List<Account> accntList = new List<Account>();  ----   I'm creating an Instance.
List<account> accntList; ----   I'm just declaring a list variable.

Thanks and regards
Siri
Team,
I have been trying to login to salesforce and trailhead with my personal account but I forgot my password and tried resetting it. Below is the error I am getting. I had to use my official saslesfforce login to raise a ticket the team as my salesforce account too is not working.

My username is "vinitha.subramanya@gmail.com". Can you please reset/unlock my account? I need to complete a few trailheads asap.

Regards,
Vinitha
User-added image