• Ajay K Dubedi
  • ALL STAR
  • 9629 Points
  • Member since 2015
  • Ajay Dubedi


  • Chatter
    Feed
  • 305
    Best Answers
  • 0
    Likes Received
  • 7
    Likes Given
  • 1
    Questions
  • 2295
    Replies
List<Contact> lstContact = [select id,firstName,LastName,accountId from contact where accountid in :stAccId ];

Map<String,List<Contact>> mapAccountWiseContact = new Map<String,List<Contact>>();

For(Contact cont : lstContact)
{
	if(mapAccountWiseContact.containsKey(cont.accountId))
	{
		List<Contact> lstCont = mapAccountWiseContact.get(cont.accountId);
		lstCont.add(cont);
	}
	else
	{
		List<Contact> lstCont = new List<Contact>();
		lstCont.add(cont);
		mapAccountWiseContact.put(cont.accountId,lstCont);
	}
}

What does if and else part does.
Hi everyone.
I just wrote this trigger that helps me to update some fields based on records of my custom metadata types.

My friend is telling me that my code would hit SOQL Query limits... so it's bad and i must try to find a new way to write this code.
I just checked on help.salesforce.com 
--> https://help.salesforce.com/articleView?id=custommetadatatypes_limits.htm&type=5

and it says : 
SOQL queries per Apex transaction Unlimited

This is my code:
trigger ProfitOfferInsert on Quote (before update, before insert) 
{
	EX__mdt[] metaList = [SELECT Business_Unit__c, OfferType__c, ProfitCenter__c, Soluzione__c, Tipo__c FROM EX__mdt];

	for(Quote q : Trigger.new) 
	{	
		for(EX__mdt e : metaList)
		{
			if(q.Business_Unit__c == e.Business_Unit__c && q.Tipo__c == e.Tipo__c && q.Soluzione__c == e.Soluzione__c) 
			{
				q.Profit_Center__c = e.ProfitCenter__c;
                q.OfferType__c = e.ProfitCenter__c;
			}
		}
	}
    
}

So, what do you think guys ? Will this code Hit SOQL Query Limits or not?

P.S: Inside my custom metadata type we have only 25 records but maybe in future this number will increase.
Thanks in advance
public static void HireContactForm(List<HireForm__c> HireList){
        List<Contact> contList = new List<Contact>();
        List<Case> CaseList = new List<Case>();
        
        for(HireForm__c hireForm: HireList){
            Contact con = new Contact();
            con.FirstName = hireForm.First_Name__c;
            con.LastName =  hireForm.Last_Name__c;
            con.Phone = hireForm.Phone__c;
            con.Email = hireForm.Email__c;
            contList.add(con);
        }
        insert contList;
        for(Contact cont: contList){
            Case cases = new Case();
            cases.Status = 'New';
            cases.ContactId = cont.Id;
            caseList.add(cases);
        }
        insert caseList;    
        
        
        for(HireForm__c hire: HireList){
            for(Case c: CaseList){
                if(hire.status__c == 'Completed'){
                    c.Status = 'Closed';
                }
                update c;
            }
            
        }
    }
//Trigger
trigger ContactFormTrigger on HireForm__c (before insert, before update, after update) {
    if((Trigger.isInsert || Trigger.isUpdate) && Trigger.isBefore){
        AccountContact.HireContactForm(Trigger.new);
    }
}

 
Hello,

I would like to create a custom button that create automatically an account in an external system.
I know how to create the button, I need you to know how communicate with the external system, maybe I need just to connect with the external database. How can I do it please ?

Thanks
I cannot resolve this error'Date expressions must use Integer or Long (8:45)'
trigger WarrantySummary on Case (before insert) {
   
for (Case myCase : Trigger.new){
// Set up variables to use in the summary field
 Date purchaseDate           = myCase.Product_Purchase_Date__c;
 Datetime createdDate        = myCase.CreatedDate;
 Integer warrantyDays        = myCase.Product_Total_Warranty_Days__c.intValue();
 Decimal warrantyPercentage  = purchaseDate.daysBetween(Date.today()) / warrantyDays;
 Boolean hasExtendedWarranty = myCase.Product_Has_Extended_Warranty__c;

//Populate summary field
 myCase.Warranty_Summary__c = 'Product Purchased on ' + purchaseDate + ' '
  + 'and case created on '  + createdDate + '.\n'
  + 'Warranty is for '      + warrantyDays + ' '
  + 'and is '               + warrantyPercentage +'% through its warranty period.\n'
  + 'Extended warranty: '   + hasExtendedWarranty + '\n'
  + 'Have a nice day!';
    }


}
public class CALCI
{
    public Integer a { get; set; }
    public Integer b { get; set; }
    public Integer r { get; set; }
    public string o { get; set; }
    
     public pageReference subb()
    {
         r = a - b;
        o='substraction';
        return null;
    }
     public pageReference add()
    {
         r = a + b;
        o='addition';
        return null;
    }
     public pageReference mul()
    {
         r = a * b;
        o='multiplication';
        return null;
    }    
}

--------------------------------------------------------------------------------------------------
<apex:page controller="CALCI" >
    <apex:form>
        <apex:pageBlock title="CALCI">
            <apex:pageBlockSection columns="1" title="simple operations" collapsible="false">
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter A</apex:outputLabel>
                    <apex:inputText value="{!a}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter B</apex:outputLabel>
                    <apex:inputText value="{!b}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>you have performed {!o } of {!a} and {!b} and result is {!result}</apex:outputLabel>
                </apex:pageBlockSectionItem>               
            </apex:pageBlockSection>    
        </apex:pageBlock>
    </apex:form> 
</apex:page>
Hi All,
I am creating a batch for the requirement in which if lead has duplicates based on name than a checkbox field named ToBeDeleted__c should set to true on the duplicate of a lead records.
Can anyone guide me with this requirement?
Thanks in advance
public class ContactSearch {

    public Static List<Contact> getSearchForContacts(String lastName,String mailingPostalCode)
    {
        List<Contact> myobj = [SELECT ID,LastName,MailingPostalCode FROM Contact WHERE LastName=:lastName AND MailingPostalCode=:mailingPostalCode];
       System.debug('.....:' +myobj);
        return myobj;
}
}

Sql editor
:SELECT ID, Name, MailingPostalCode FROM Contact WHERE LastName ='Davis'
Anonymous debug:
ContactSearch.getSearchForContacts('Young','66045');

 
Lightning input password component eye icon to show or hide password logic with caps Lock functionality
Hi,
I have a table to display more than 10 columns in lightning. How to make the div or table fixed with resizable columns.
I am using html table and looping using aura:iteration ( i don't want to use lightning: datatable as there are some issues with lightning datatable) as I want to query from salesforce object.

Thx!
Vai
Hi Gurus,

Is it possible to limit a perticular project on all opportunites? For example I have a product called factsheets. I want to limit that to 3. So only 3 times this product can be assigned to a opportunity. 

Note  - I am not talking aboutn limiting the number of products on 1 perticular opp but on al the opps. 

Is this possible via apex or trigger? if yes, can I please have a code. 

Thanks all. 
global class removeDuplicateRecords implements Database.Batchable<SObject> 
{ 
    Global Map<String,Lead> EmailLead = new Map<String,Lead>();
    global Map<String,List<String>> mapEmailName = new Map<String,List<String>>();
    
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'Select Email,Name,Company,Description from Lead where Email != null';
        return Database.getQueryLocator(query); 
    }
    
    global void execute(Database.BatchableContext BC,List<Lead> scope)
    { 
        List<String> LeadInfo = new List<String>();
        List<Lead> duplicatelist = new List<Lead>();
        for(Lead objLead : scope)
        {
            if(!EmailLead.containsKey(objLead.Email))
            {
                EmailLead.put(objLead.Email,objLead);
            }
            else
            {
                duplicatelist.add(objLead);	
            } 
        } 
        System.debug('>>duplicatelist>>>'+duplicatelist);
        System.debug('>>>EmailLead>>'+EmailLead);
        for(Lead objLead1 : duplicatelist)
        {
            LeadInfo.add(objLead1.Name+','+objLead1.Company);
            if(mapEmailName.containsKey(objLead1.Email))
            {
                LeadInfo.clear();
                LeadInfo.add(objLead1.Name+','+objLead1.Company);
                mapEmailName.put(objLead1.Email,LeadInfo);
            }
            else
            {
                mapEmailName.put(objLead1.Email,new List<String>(LeadInfo));
            }
        }
        System.debug('>>mapEmailName>>>'+mapEmailName);
        System.debug('>>EmailLead.values>>>'+EmailLead.values());
        for(Lead updateLead : EmailLead.values())
        {
            System.debug('>>updateLead>>>'+updateLead.Email);
            System.debug('>>EmailLead.values>>>'+EmailLead.values());
            if(mapEmailName.containsKey(updateLead.Email))
            {
                String strLead;
                System.debug('>>mapEmailName.get(updateLead.Email)>>>'+mapEmailName.get(updateLead.Email));
                strLead = String.join(mapEmailName.get(updateLead.Email),';');
                System.debug('>>strLead>>>'+strLead);
                updateLead.Description = strLead;
            }
            updateLead.Description.removeEnd(';');
        }
        if(EmailLead.values().size()>0)
            update EmailLead.values();
        if(duplicatelist.size() > 0)
        {
            delete duplicatelist;
        }
    }
    global void finish(Database.BatchableContext BC)
    {
        
    }
}
Suppose I have 5 Lead
2 with a@gmail.com mail address
3 with b@gmail.com mail address
So I want to delete duplicate of both email addres lead. Result is:
1 with a@gmail.com
2 with b@gmail.com
So the name and company of a@gmail.com is come on that lead description field. and another name and company of b@gmail.com come on thanother lead description field.

Above code is perfectly run but I am not able to separate name and company on the basis of email it mix and match all name and company in all leads
Hi all, 
I am new to lightning component and I have made a dynamic table which will fetch all the data related to an account but now I have to add pagination to it . Can anyone please help me with the pagination part
This is my code.

controller:

public class DynamicTest{
@AuraEnabled
    public static List<String> listAllObject(){
        List<String> objectList = new List<String>();
        For(Schema.sObjectType sobj: schema.getGlobalDescribe().values()){
            if(sobj.getDescribe().isQueryable())
                objectList.add(sobj.getDescribe().getName()+'####'+sobj.getDescribe().getLabel());
        }
        objectList.sort();
        return objectList;
    }
    @AuraEnabled
    public static DynamicBindingWrapper listAllFields(String objectName){
        DynamicBindingWrapper dynamicData = new DynamicBindingWrapper();
        List<fieldDataWrapper> wrapperList =  new List<fieldDataWrapper>();
        // Create Dynamic Query Start ..
        String theQuery = 'SELECT ';
        SObjectType sObjectName = Schema.getGlobalDescribe().get(objectName);
        Map<String,Schema.SObjectField> mfields = sObjectName.getDescribe().fields.getMap();
        For(Schema.SObjectField field : mfields.values()){
            If(field.getDescribe().isAccessible() && !field.getDescribe().getName().EndsWith('Id')
               && field.getDescribe().getName()!='CreatedDate' && field.getDescribe().getName()!='LastModifiedDate'
               && field.getDescribe().getName()!='LastReferencedDate' && field.getDescribe().getName()!='LastReferencedDate'
               && field.getDescribe().getName()!='LastActivityDate' && field.getDescribe().getName()!='LastViewedDate'
               && field.getDescribe().getName()!='IsDeleted'){
               fieldDataWrapper wrapper = new fieldDataWrapper();
               theQuery += field.getDescribe().getName() + ',' ;
                wrapper.label = field.getDescribe().getLabel();
                wrapper.apiName = field.getDescribe().getName();
                wrapperList.add(wrapper);
           } 
        }
        // Trim last comma
        theQuery = theQuery.subString(0, theQuery.length() - 1);
        // Finalize query string
        theQuery += ' FROM '+objectName;
        // Query End ..
        System.debug('#### theQuery = '+theQuery);
        List<sObject> objectData = Database.Query(theQuery);
        if(objectData!=null && objectData.size()>0)
            dynamicData.sObjectData = objectData;
        else
            dynamicData.sObjectData = new List<sObject>{};
        dynamicData.fieldList = wrapperList;
        System.debug('#### dynamicData '+dynamicData);
        return dynamicData;
    }
    /* Class to store the dynamic data 
     * and list of related fields
     */ 
    public class DynamicBindingWrapper{
        @AuraEnabled
        public List<sObject> sObjectData    { get; set; }
        @AuraEnabled
        public List<fieldDataWrapper> fieldList { get; set; }
    }
    /*
     * Class to store the field information
     */ 
    public class fieldDataWrapper{
        @AuraEnabled
        public String label { get; set; }
        @AuraEnabled
        public String apiName { get; set; }
    }

}


component controller.js
({
     doInit : function(component, event, helper) {
        helper.onInit(component, event, helper);
    },
    doHandleChange : function(component, event, helper) {
        helper.onHandleChange(component, event, helper);
    },
    previousPage : function(component, event, helper)

{

var oppList = component.get("v.accountList");

var end = component.get("v.end");

var start = component.get("v.start");

var pageSize = component.get("v.pageSize");
var paginationList = [];

var counter = 0;

for(var i= start-pageSize; i < start ; i++)

{

if(i > -1)

{

paginationList.push(oppList[i]);

counter ++;

}

else {

start++;

}

}

start = start-counter;

end = end-counter;

component.set("v.start",start);

component.set("v.end",end);

component.set('v.paginationList', paginationList);

},
    nextPage : function(component, event, helper)

{

var oppList = component.get("v.accountList");

var end = component.get("v.end");

var start = component.get("v.start");

var pageSize = component.get("v.pageSize");
var paginationList = [];

var counter = 0;

for(var i=end+1; i<end+pageSize+1; i++)

{

if(oppList.length > end)

{

paginationList.push(oppList[i]);

counter ++ ;

}

}

start = start + counter;

end = end + counter;

component.set("v.start",start);

component.set("v.end",end);

component.set('v.paginationList', paginationList);

},
})


component:

<aura:component implements="flexipage:availableForAllPageTypes" controller="DynamicTest">
    <aura:handler name='init' value='{!this}' action='{!c.doInit}' />
    <aura:attribute name='objectList' type='List' />
    <aura:attribute name="isSending" type="boolean" />
    
<aura:attribute name="pageSize" type="Integer" default="10"/>

<aura:attribute name="totalSize" type="Integer"/>

<aura:attribute name="start" type="Integer" />

<aura:attribute name="end" type="Integer"/>

    <div class="slds-m-around_small">
        <div class="slds-page-header">
            <br/>
        </div><br/>
        <div class="slds-grid slds-wrap">
            <div class="slds-size_1-of-2">
                <div class="slds-box_x-small">
                    <!-- show the list of All the Object -->
                    <lightning:select name="selectObject" label="Select an Object" 
                                      onchange="{!c.doHandleChange}" aura:id='selectObject'>
                        <option value="" text="- None -" />
                        <aura:iteration items='{!v.objectList}' var='obj'>
                            <option value="{!obj.key}" text="{!obj.value}" />
                        </aura:iteration>
                    </lightning:select>
                </div>
            </div>
            <br/>
            <ui:scrollerWrapper class="scrollerSize">
                <div class="slds-size_2-of-2">
                    <div id='sfdctable' aura:id='sfdcDiv'>
                        <!-- division that will show the dynamic content -->
                    </div>
                </div>
            </ui:scrollerWrapper>
             
    <div class="slds">

      <div class="slds-form-element">
       <button class="slds-button slds-button--brand" onclick="{!c.previousPage}" disabled="{!v.page &lt;= 1}">
           Previous
        </button>
       <button class="slds-button slds-button--brand" onclick="{!c.nextPage}" disabled="{!v.page >= v.pages}"> Next</button>
     </div>
    </div>
        </div>
    </div>
</aura:component>

Helper :
({
    onInit : function(component, event, helper) {
        /* Call the Apex class method to fetch the List of all object */
        var action = component.get('c.listAllObject');
        action.setCallback(this, function(response){
            var state = response.getState();
            if(state === 'SUCCESS' && component.isValid()){
                /* set the value to the attribute of the component */
                var responseValue = response.getReturnValue();
                var lstOptions = [];
                for(var i=0; i < responseValue.length; i++){
                    lstOptions.push({
                        value : responseValue[i].split('####')[1],
                        key : responseValue[i].split('####')[0]
                    });
                }
                lstOptions.sort();
                component.set('v.objectList', lstOptions);
                
            }else{
                var errors = response.getError();
                $A.log(errors);
                if(errors || errors[0].message){
                    console(errors[0].message);
                }
            }
        });
        $A.enqueueAction(action);
    },
    onHandleChange : function(component, event, helper){
        /* Call this method whenever user will select the Obejct
         * and show the Dynamic Content */
        var selObject = component.find('selectObject').get('v.value');
        var action = component.get('c.listAllFields');
        if(selObject!=null && selObject!='' && selObject!=undefined){
            action.setParams({
                "objectName" : selObject  
            });
            action.setCallback(this, function(response){
                var state = response.getState();
                if( state === 'SUCCESS' && component.isValid()){
                    //component.find("dynamicBody").set("v.body
                    component.find('sfdcDiv').set("v.body",[]);
                    var responseValue = response.getReturnValue();
                    var objectValue   = responseValue.sObjectData;
                    var fieldList     = responseValue.fieldList;
                    
                    /* Create Dynamic Table */
                    var sObjectDataTableHeader = [];
                    // Create table Header
                    for (var i=0; i <  fieldList.length; i++) {
                        sObjectDataTableHeader.push(fieldList[i].label);
                    }
                    console.log(sObjectDataTableHeader);
                    //Get the count of columns.
                    var columnCount = sObjectDataTableHeader.length;
                    //Create a HTML Table element.
                    var table = document.createElement("TABLE");
                    //table.border = "1";
                    //Add the header row.
                    var row = table.insertRow(-1);
                    for (var i = 0; i < columnCount; i++) {
                        var headerCell = document.createElement("TH");
                        headerCell.innerHTML = sObjectDataTableHeader[i];
                        headerCell.className='hearderClass';
                        row.appendChild(headerCell);
                    }
                    var dvTable = document.getElementById("sfdctable");
                    dvTable.innerHTML = "";
                    dvTable.appendChild(table);
                    /* Create Dynamic Table End */
                    
                    if(objectValue.length){
                        for(var j=0; j < objectValue.length; j++){
                            // Dynamic table Row
                            row = table.insertRow(-1);
                            // Dynamic Table Row End 
                            for (var i=0; i <  fieldList.length; i++) {
                                // Dynamic table Row
                                var cell = row.insertCell(-1);
                                cell.innerHTML = objectValue[j][fieldList[i].apiName];
                                component.set('v.isSending' , false);
                                
                            }
                        }
                    }else{
                        
                    }
                }else{
                    var errors = response.getError();
                    $A.log('Error Details '+errors);
                    if( errors || errors[0].message){
                        console.log('Error Details '+errors[0].message);
                    }
                }
            });
            $A.enqueueAction(action);
        }else{
            component.set('v.isSending' , false);
        }
    },
})
Hi,

I have two list of String ids, i need to compare two list of strings and put unique string in a Third List. How to do it.

suppose
List<String> ids1 = new List<String>('003aaa','003bbb','003ccc');
List<String> ids2 = new List<String>('003aaa','003bbb');
List<String> ids3 = new List<String>();

I want unique value in the third list :

ids3 = '003ccc';
I'm new to apex and coding in general and I'm looking for a place to talk out an issue so I can find the way to find the solution. I'm open to being given content to read to help me become better to resolve that problem. I'm also open to answer any question to the best of ability in case I'm not clear in my explaination 

I'm trying to create nested loops that compair IDs to other arrays.

The first loop will grab the first ID from the first object. Then compare a value to another objects array. 

Then pass both IDs and do a comparison again. 

Here's a snippet of the code I'm working on that is suppose to loop through everything.

It comes down to how can I pass the TT varaible from the TempTask array variable into the next loop to be used to compare a value. 

   for(CCMI__Milestone_Task__c TT:TempTask){
        for (CCMI__Milestone_Task__c CT:CCMITask){
            for(Department_To_Task__c DT:DeptTask){
               
          }
        }
      }
Dear Team ,

Trust you are doing fine !!!

Please let me know Apex acts as a model or controller in Lightning Component .  One more thing through this diagram it is showing controller.js will call APEX class but in Lightning component file we are calling Controller in this way

<aura:component controller="AccountController">

plz let me know exactly the scenario 

User-added image

Thanks & Regards
Sachin Bhalerao
I have 2 objects, Child__c and Parent__c. Field Parent__c->LastDate must be updated automatically every time if Child__c->Status becomes 'Finished'
Trigger looks like this
ChildObjTrigger on Child_c(before update){
        Set<Id> rcID = new Set<Id>();
        for (Child_c child : Trigger.new){
            rcID.add(child.Id);
            System.Debug('ID added to list' + child.Id);
        }

        for (Child__c child : [SELECT Id, Name FROM Child__c WHERE Parent__r.Id IN :rcID]){
            if (child.Status__c == 'Finished')
            child.Parent__r.LastDate__c = System.today();

        }
    }

 
there are contacts in my account some of them are used ijn opportunity contact role 
so if iam trying to delete the contact which is used in opportunity contact role it should show error and dont allow to delete it

here is my code there is some error it is not allowing to delete all the contact
so plz help me with that
///Trigger Handler

public with sharing class ContactRoleOnOppo {
    //class with sharing rule of context user
    
    public static void  checkContactRole(list<Contact> con){
        
        //set For  store accountIds of current contacts
        set<id>accId=new set<id>();
        
        //set for store contact ids from current contac list
        set<id>ConId=new set<id>();
        
        //iterate loop for add accountId and contact Id in set
        for(contact co:con){
            accId.add(co.AccountId);
            conId.add(co.Id);
             }
        
        //list of opportunity related account list
        list<Opportunity>opp=[select Id,Name from opportunity where AccountId=:accId];
        
        //set to store ids of opportunity of contact account
        set<id>oppId=new set<id>();
        for(Opportunity op:opp){
            oppId.add(op.ID);
            }
        
        list<OpportunityContactRole> roleList=[select Id from OpportunityContactRole where opportunityId=:oppId];
        //list of all opportunity contact role of current opportunity and contact
        //itrate over opportunity contact role list
        for(contact c:con){
            //check if is there any opportunity contact role in list
          if(roleList != Null){
              //dont allow to delete contact
          c.addError('cant be deleted contact it is related to Opportunity contact role...!');
        }   
        }
       
       // list<Account>ac=[select Id,Name from account where Id=:sId];
        //list<OpportunityContactRole> roleList=[select Id from OpportunityContactRole where contactId=:conId];
        
                                             
        
    }

}
//Trigger

trigger CheckOppoContRole on Contact (before delete) {
////call method from handler and pass old record

    ContactRoleOnOppo.checkContactRole(trigger.old);

}

 
Creating a managed packaged without hardcoding the namespace and need help identifying where and when to apply dynamic namespace?  Basically where does the namespace get added after a package is created.

Examples:
Controller.js
evalRecord['Summary_Type__c']
evalRecord.Summary_Type__c

Would the namespace be added to those lines of code when packaged?

 
We need to create a storage location for a userguide(in any format pdf,excel etc) in salesforce and for that we have to give read only permissions to all users and Editable access to admin and selected users.

We have tried these two ways but couldn't find exact solution:

1- We have tried it using by creating a Folder in documents and giving readable access to all users and to give editable access to admin or some selected users we have created a permission set in which under System Permissions we just ticked the Manage public Documents checkbox.So by this all the users which are assigned in the permission set are able to manage all the folders but we want to manage only a particular folder.

2- We have also tried using content libraries.In that we created a library and added the content file in it.Gave permissions of viewing,editing to particular users but in this we are not able to add Chatter Only users so this solutions got breaked,adding to it some more profiles are asked to generate a case to salesforce support to get Salesforce CRM Content User License by this license only they can view or edit content.

Solutions for this is highly appreciable.And if any one can suggest how to modify any of above two ways to get required solution this will be a great help. I have also posted this question on salesforce community and Stack Exchage.

Thanks
Hi guys, I am new to the Salesforce lightning,, I have worked only on classic, also I don't know the dynamic Apex and JavaScript tempting,, I  am trying to learning the lighting basics of aura components from trailhead, but I am not getting the flow of components,class, controller and helper.....
so can anyone help me to know this,, or you can share the basic lightning code with detail description,, plz....

Thank you
How can we pass multiple parameters from Component to Apex class .For ex I have a custom object ObjectA__c , the component  takes input from user and then I need to process these values in apex class and save to db . There are more than 10 fields which needs which needs to be set in apex. I cant pass these fields as parameters . I am not sure about wrapper class. Please let me know what is the best way to do it .
 
We send Docusign documents from Salesforce Opportunities.  Currently when the main signatory has completed and signed their section of the document, we aren't notified if any other party has signed until all parties have signed.  We need to be notified if any of the parties have signed.  Is there a way to configure this? We'd like to be proactively informed when one of a number of parties have undertaken their individual part.  We have been advised to "setup a custom webhook with the trigger event -> recipient event -> recipient signed/completed". I am fairly new to developing and I do not understand how to configure this with the salesforce url endpoint?  Can anybody assist? 
Hi,

I would like to create a lead and contact object in react-native using mobile sdk. I already logged in by oauth using mobile sdk.
Please send me example about creating lead and contact object in react-native.

Thank you
Hi all!
I wanted to know how advanced currencies impacts already exisiting opportunities. 
I tested it in one sandbox and after the new currency is enabled, all opportunities that have been created up to this point are not affected and still use the previous currency. My understanding was that only closed opportunities should stay with the previous currency and open opportunities use the new one (so basically the 'CloseDate' is taken into account).
I also created a new opportunity after the new currency became active and this one correctly used the new one. 
This makes it look like instead of the CloseDate the CreatedDate is taken into account for previous or new currency.
Can someone enlighten me please? :)
Thanks in advance!
Hi,

Thanks in Advance,
I want to create a date format like this November 29th, 2019 from date/Time field using Apex class.
Hi,

As I am trying:

Hide some fields in detailed page but that should be display in edit page.


 
Hi all,
I am performing wrapper class and pagienation for all standard objects can any one help me with my code .
 apex class:
public class contactPaginationController{
 
 //variable used in page.
 Public Integer size{get;set;}
 Public Integer noOfRecords{get; set;}
 public List<SelectOption> paginationSizeOptions{get;set;}
 public static final Integer QUERY_LIMIT = 10000;
 public static final Integer PAGE_SIZE = 5;
 
 public List <WrapperClass> wrapperRecordList{get;set;}
 Map<Id, WrapperClass> mapHoldingSelectedRecords{get;set;}
 
 //constructor calling init method.
 public contactPaginationController(){
   mapHoldingSelectedRecords = new Map<Id, WrapperClass>();
   init();
 
 }
 
//Init method which queries the records from standard set controller.
 public void init() {
 wrapperRecordList = new List<WrapperClass>();
 for (Contact cont : (List<Contact>)setCon.getRecords()) {
 if(mapHoldingSelectedRecords != null && mapHoldingSelectedRecords.containsKey(cont.id)){
 wrapperRecordList.add(mapHoldingSelectedRecords.get(cont.id));
 
 }
 else{
   wrapperRecordList.add(new WrapperClass(cont, false));
 }
 }
 }
 
 /** Instantiate the StandardSetController from a query locater*/
 public ApexPages.StandardSetController setCon {
 get {
 if(setCon == null) {
   setCon = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id,Name, Email, Phone FROM Contact LIMIT : QUERY_LIMIT ]));
 
   // sets the number of records to show in each page view
   setCon.setPageSize(PAGE_SIZE);
 }
   return setCon;
 }
 set;
 }
 
 /** indicates whether there are more records after the current page set.*/
 public Boolean hasNext {
 get {
   return setCon.getHasNext();
 }
 set;
 }
 
 /** indicates whether there are more records before the current page set.*/
 public Boolean hasPrevious {
 get {
   return setCon.getHasPrevious();
 }
 set;
 }
 
 /** returns the page number of the current page set*/
 public Integer pageNumber {
 get {
   return setCon.getPageNumber();
 }
 set;
 }
 
 /** return total number of pages for page set*/
   Public Integer getTotalPages(){
     Decimal totalSize = setCon.getResultSize();
     Decimal pageSize = setCon.getPageSize();
     Decimal pages = totalSize/pageSize;
     return (Integer)pages.round(System.RoundingMode.CEILING);
 }
 
 /** returns the first page of the page set*/
 public void first() {
   updateSearchItemsMap();
   setCon.first();
   init();
 }
 
 /** returns the last page of the page set*/
 public void last() {
   updateSearchItemsMap();
   setCon.last();
   init();
 }
 
 /** returns the previous page of the page set*/
 public void previous() {
   updateSearchItemsMap();
   setCon.previous();
   init();
 }
 
 /** returns the next page of the page set*/
 public void next() {
   updateSearchItemsMap();
   setCon.next();
   init();
 }
 
 //This is the method which manages to remove the deselected records, and keep the records which are selected in map.
 private void updateSearchItemsMap() {
 for(WrapperClass wrp : wrapperRecordList){
  if(wrp.isSelected){
     mapHoldingSelectedRecords.put(wrp.contactRecord.id, wrp);
  }
  if(wrp.isSelected == false && mapHoldingSelectedRecords.containsKey(wrp.contactRecord.id)){
     mapHoldingSelectedRecords.remove(wrp.contactRecord.id);
  }
 }
 }
 
 //wrapper class being used for checkbox showing.
 public class WrapperClass {
 public Boolean isSelected {get;set;}
 public Contact contactRecord {get;set;}
 public WrapperClass(Contact contactRecord, Boolean isSelected) {
    this.contactRecord = contactRecord;
    this.isSelected = isSelected;
 }
 }
 
}

visualforce page :
<apex:page controller="contactPaginationController" docType="html-5.0" tabStyle="Contact">
   <apex:sectionHeader title="Contact" subtitle="Contact Pagination" />
    <apex:form id="theForm">
      <apex:pageBlock title="All Contacts" rendered="{!wrapperRecordList.size!=0}" id="pbId" >
        <apex:pageBlockTable value="{!wrapperRecordList}" var="cont">
           <apex:column headerValue="Select">
             <apex:inputCheckbox value="{!cont.isSelected}"/>
           </apex:column>
           <apex:column headerValue="Name">
             <apex:outputField value="{!cont.contactRecord.name}"/>
           </apex:column>
           <apex:column headerValue="Email">
             <apex:outputField value="{!cont.contactRecord.Email}"/>
           </apex:column>
           <apex:column headerValue="Phone">
            <apex:outputField value="{!cont.contactRecord.Phone}"/>
           </apex:column>
       </apex:pageBlockTable>
 
 <!-- Action Buttons visible on bottom of page for pagination -->
       <apex:outputPanel style="text-align:center;" layout="block">
         
          <apex:commandButton value="Previous" rerender="pbId" action="{!previous}" disabled="{!NOT(hasPrevious)}" status="paginationStatus"/>&nbsp;Page {!pageNumber} of {!totalPages}&nbsp;
          <apex:commandButton value="Next" rerender="pbId" action="{!next}" disabled="{!NOT(hasNext)}" status="paginationStatus"/>
         
          <apex:actionStatus id="paginationStatus">
             <apex:facet name="start">
                 Please wait...<img src="/img/loading32.gif" style="width: 18px;"/>
             </apex:facet>
          </apex:actionStatus>
       </apex:outputPanel>
 </apex:pageBlock>
 </apex:form>
</apex:page>

Thanks in advance..............

I have a large archive static resource that I can't individually upload (the files within all reference each other), and I can't change all references to URLFOR($Resource.MyLargeZip, '...').

My main JavaScript file references other JavaScript, CSS, fonts, images, and etc.

The apex tag syntax renders an HTML tag like so (found in the docs): 

"<link rel="stylesheet"  type="text/css" href="[generatedId]/basic.css"/>"

which generates an id folder that I would have to append to every reference in my code which isn't feasible to do.

Hi All,
I am working on Apex Specalist - Super Badge. I installed the required Pkg. to my org. Currently working on Automate record creation. As per Requirement need to fetch TYPE = REPAIR Or MAINTENANCE REQUEST. When query the table not finding any record having type define as Repair or Maintenance. Not sure why. Can any one guide me on same.
Rgd's
Dear Team ,

Plz let me know How to set Minlength and Max length in lightning input textarea?

Thanks & Regards
Sachin Bhalerao
 
I have 2 custom objects:- They have no relations in between Request and Response..Both objects are having common fields Name,Add, Phone no :- When I update Address field in Request object it should update in response object as well?
I am trying to create a custom URL button , through which i want to set field value.. is there any way to do it?
 
Can anyone help me in aligning the buttons to right

<apex:page standardController="Quotes__c" extensions="ProductSearchPopupController" showHeader="false" sidebar="false" lightningStylesheets="true">
   
    <apex:form id="form" >
        <apex:pageMessages ></apex:pageMessages>
        <apex:messages />
        <div style="width 100%">
            <apex:pageBlock title="Add Products" id="block" rendered="{!block}"> 
                <centre>
                    <div align="center"  >
                    <apex:pageBlockSection columns="1" id="section" > 
                        Enter the product to be added and select Go<br/>
                        
                        <apex:inputText value="{!query}" id="query"/> 
                    </apex:pageBlockSection> 
                  </div>
                </centre>
                <right>
                <apex:commandButton value="Go" action="{!runQuery}" style="border-style:solid;
                     color:white; class:centre;background-color:rgba(13, 112, 165, 1);style=float:right;"/>
                <apex:commandButton value="Cancel" action="{!cancel}" style="border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;" />
                      </right>
            </apex:pageBlock>
                
            <apex:pageBlock id="block1" rendered="{!block1}" >
                <apex:pageBlockSection columns="1">
                    <apex:pageBlockTable value="{!wrapProductList}" var="accWrap">
                        <apex:column >
                            <apex:facet name="header">
                                <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                            </apex:facet>
                            <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                        </apex:column>
                        <apex:column headerValue="Name">
                            <apex:outputLink value="#">{!accWrap.acc.Name}</apex:outputLink>       
                        </apex:column>
                        <apex:column headerValue="Product Code">
                            <apex:outputText value="{!accWrap.acc.ProductCode__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Product Description">
                            <apex:outputText value="{!accWrap.acc.Product2Id__r.Product_Description__c}"  />       
                        </apex:column>
                        <apex:column headerValue="Unit Price">
                            <apex:outputText value="{!accWrap.acc.UnitPrice__c}"  />  
                        </apex:column>
                        <apex:column headerValue="Standard Price">
                            <apex:outputText value="{!accWrap.acc.UseStandardPrice__c}"  />  
                        </apex:column>
                    </apex:pageBlockTable>  
                    <apex:commandButton value="Next"   action="{!processSelected}" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);align-items: right;justify-content:right;"/>  
                </apex:pageBlockSection>
            </apex:pageBlock>
        </div>
        <div>
            <apex:pageBlock id="block2" rendered="{!block2}" >
                <apex:pageblockSection title="All Products" collapsible="false" columns="3">
                    <apex:pageBlockTable value="{!selectedProduct}" var="c" id="table2" title="Selected Products">
                        <apex:column value="{!c.Name}" headerValue="Product Name"/>
                        <apex:column headerValue="Sales Price">
                            <apex:inputText value="{!c.UnitPrice__c}" id="UnitPrice" /> 
                        </apex:column>
                        <apex:column headerValue="Discount">
                            <apex:inputText value="{!discount}" id="discount" /> 
                        </apex:column>
                        <apex:column headerValue="Quantity">
                            <apex:inputText value="{!quantity}" id="quantity" /> 
                        </apex:column>
                    </apex:pageBlockTable>  
                </apex:pageblockSection>
                <apex:commandButton action="{!GoBack}" value="Back" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton action="{!saveproduct}" value="Save" style="border-style:solid;
                     color:white; background-color:rgba(13, 112, 165, 1);"/>
                <apex:commandButton value="Cancel" oncomplete="doRedirect()" style="border-style:solid;
                     color:rgb(21, 137, 238); background-color:white;"/>           
            </apex:pageBlock>
            </div>
           
        
    </apex:form>
</apex:page>
Dear Team ,

How we can define in Standard Objects that which product belongs to which Account ?

Thanks & Regards
Sachin Bhalerao
Hi All , 

I am facing the below error while trying to complete the Trial head challenge 

Challenge : Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field

Error : Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true.

Thanks 
K.VenkataSubramanyam

There was an unhandled exception. Please reference ID: MQAMWAOS. Error: NoMethodError. Message: undefined method `[]' for nil:NilClass
Close errors
User-added image
在页面New Case,在 Case Feed页面显示一条评论
Create two field on Account: 1 - Amount X (Number), 2 - Amount Y (Number).
Create a two fields on Contact: 1 - Amount Type (Picklist: Amount X, Amount Y), 2 - Amount (Number)
You have to rollup amount in the correct field on account record and it depends on the Amount Type field on Contact.

I also need to bulkify this code.
hi ,

I have to create google chart from apex class and insert the chart into attachement.

Thanks.
I'd like to describe this case in detail: First , we have created an custom sObject which OWD is Private Second, we have an approval process on this sObject and user created an record and submit for approval Third, his manager reassigned user's request to another person who has no right to view user's record because OWD is private and also has no role hierarchy with this user My question is : Can we add custom logic when manager reassign this approval to another person? So that we can apex sharing this record to person.

Appreciate for any help
HI, anyone take Platform developer certification in 2019?. can you please provide reference links and simple quiz if its available online
Hi Expert,

I am new to the programming world. I have a custom controller which insert a contact created on VF page. Now I am not able to write test class for this. I could only cover 56% code.
 
public class TestPopup {
    
    public list<Account> acc{get;set;} 
    public Account acc1 {get;set;} 
    public Contact contact {get;set;}
    public List<Contact> conlist;
    public Boolean displayPopup {get;set;}
    public String accid {get;set;}
       

    public TestPopup(){
        acc = [select ID, Name, AccountNumber,Type from Account];
	    acc1 = new Account();
        conlist = new List<Contact>();
        contact = new Contact();
        	
    }
   
    public list<Account> getacc(){
        return acc;
    }
    
    public void showPopup()
    { 
    	displayPopup = true;
        acc1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :accid];
    }
       
    public void closePopup() {
        displayPopup = false;
        
    }

    public PageReference save(){
        contact.AccountId= acc1.Id;
        insert contact;
        ID contactId = contact.Id;
        PageReference pr = new PageReference('/' + contactId);
   		return pr;
    }  
        
}
 
@isTest
public class TestCustomController {
     static testMethod void testMethod1() 
     {
         Account testAccount = new Account();
         testAccount.Name='Test Account';
         insert testAccount;
         
         Contact cont = new Contact();
         cont.LastName = 'Test';
         cont.FirstName = 'Contact';
         cont.AccountId = testAccount.Id;
          // insert cont;
         
         Account testAccount1 = new Account();
         testAccount1 = [SELECT Id, Name, Phone, (SELECT lastName FROM Contacts) FROM Account WHERE Id = :testAccount.Id];
       
         
         
         Test.StartTest(); 
         PageReference pageRef = Page.All_Account; // Add your VF page Name here
         pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
         Test.setCurrentPage(pageRef);
         
         TestPopup testAccPlan = new TestPopup();  
         testAccPlan.getacc();
        // testAccPlan.showPopup(); 
         testAccPlan.closePopup();
         
         Test.StopTest();
         
     } 
}

 
Hi,

Cannot save the Controller, please help.

https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components4
Ok, been directed here by support so hoping someone can help.

Basically noticed that our case milestones were violating outside our set business hours.  After a lot of head scratching the only conclusion was that our timezone on the business hours in use by the entitlement processes were set to GMT.  I have changed this to BST (British Summer Time) to prevent more out of hours violations.

I have asked support if having it set to BST would mean that come Autumn salesforce will automatically revert back an hour in line with daylight savings.  They have said this does not occur and you have to manually change the timezone each time daylight savings occurs.

Can anyone confirm if this is true?  Seems like something so basic that I can't believe its not in the system. 
  • April 21, 2016
  • Like
  • 3

Hi, 

This Monday I tried to do the exam but I had technical issues with camera. Kryterion support tried to help me but we couldn't solve the problem. They rescheduled my exam multiple times but they can not do it to a different day.

Please, I have opened cases and called to certification support phone without getting any answer. Could you help me?

Best regards
I want to send emails in user's language dynamically. Two approaches:
1. Use visualforce email template, create labels and use them in the template. Set language attribute in the template and provide translations for the labels using translation workbench.
2. Create multiple versions of each template, each in a separate language and choose the template dynamically.

Advantage of first approach is that no additional efforts are required if a new language is to be supported but creating so many custom labels is cumbersome. 2nd approach is good in that respect but a template needs to be added everytime a new language is supported. 
Is there any other approach? If not, which one of the above should be chosen?