• Prema -
  • NEWBIE
  • 200 Points
  • Member since 2017
  • Keen Learner of Salesforce


  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 5
    Likes Given
  • 42
    Questions
  • 148
    Replies
can anybody explain with a example where this scenario is used  in a simple manner,  i have gone through differnt examples , bt iam unable to understand it >>ApexPages.currentPage().getParameters().get('recordId') 
I want to do something like this. How can it be possible , Please let me know :
for(Account acc2:[select id from account limit 1])
{
    //sObject s = new Account();
    Vehicle__c vt=new Vehicle__c();
    vt=(Sobject)acc2;
    insert vt;
    System.debug('sobject '+vt);
}

I don't want to do it like this :
for(Account acc2:[select id from account limit 1])
{
    
    Vehicle__c vt=new Vehicle__c();
    vt=acc2.name;
    insert vt;
    System.debug('sobject '+vt);
}

Here we are assigning the variables one by one. I have 157 fields how can I assign all of them in one go. Please help me this is bit urgent!!.

 
******************/
        public pageReference AuthenticateUser(){
            
            system.debug('username :' +userName + ' alreadyApproved :'+alreadyApproved);            
            if(userName != '' && passWord !='')
            {   
                //calling startAppSession service
                ICSwwwViadComSecurityV2.AppSessionInfo obj ;
                ICSwwwViadComSecurityV2.BasicHttpBinding_IAuthenticationService Iobj = new ICSwwwViadComSecurityV2.BasicHttpBinding_IAuthenticationService(); 
                obj = Iobj.StartAppSession('SalesForce','76v.H-_7};9^+4(]J.;3','','');
                system.debug('app session response : '+obj.SessionID);

                //calling authicate userinfo service.
                ICSwwwViadComV1.DirectoryResult objUserInfo;
                objUserInfo = Iobj.AuthenticateUser(obj.SessionID,userName,passWord);
                system.debug('UserInfo response : '+objUserInfo.user_x.emailaddress);
                system.debug('UserInfo response : '+objUserInfo.IsSuccessful+ ' username :'+ userName + ' emailId :'+ emailid); 
                if(objUserInfo.IsSuccessful) 
                {
                    if(emailid.containsIgnoreCase(objUserInfo.user_x.emailaddress) )
                    {
                        renderApprovalPageBlock = true;
                        isAuthenticated=true;
                    }                   
                    else
                    {
                        system.debug('ICS case ID ::'+icsCaseId );
                        List<Customer_Service_Inquiries_ICS__c> lstCase = new List<Customer_Service_Inquiries_ICS__c>();
                        lstCase = [select id,(SELECT Del_AR1_Approver_Email__c,Del_AR2_Approver_Email__c,Del_CSO_Approver_Email__c FROM Refunds_ICS__r ),
                        (select id,Del_AR1_Approver_Email__c,Del_AR2_Approver_Email__c,Del_CSO_Approver_Email__c,Del_DAM_LOB_Approver_Email__c,Del_F_R_Approver_Email__c from AR_Adjustments_Approvals__r),
                        (SELECT Del_Additional_Approver_Email__c,Del_AR1_Approver_Email__c,Del_AR2_Approver_Email__c,Del_CSO_Approver_Email__c,
                        Del_F_R_Approver_Email__c,Del_LOB_Approver_Email__c FROM ICS_Credit_Memo__r) from Customer_Service_Inquiries_ICS__c where id=:icsCaseId ];
                        string DelegatedApprovers ='';
                        
                        if(!lstCase[0].Refunds_ICS__r.isEmpty())
                        {
                            for(Refunds_ICS__c tempR : lstCase[0].Refunds_ICS__r)
                            {
                                DelegatedApprovers = DelegatedApprovers +tempR.Del_AR1_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempR.Del_AR2_Approver_Email__c + ';';     
                                DelegatedApprovers = DelegatedApprovers +tempR.Del_CSO_Approver_Email__c + ';';
                            }
                            system.debug( 'Refund DelegatedApprovers :::: '+DelegatedApprovers);
                        }
                        else if(!lstCase[0].AR_Adjustments_Approvals__r.isEmpty())
                        {
                            for(AR_Adjustments__c tempAR : lstCase[0].AR_Adjustments_Approvals__r)
                            {
                                DelegatedApprovers = DelegatedApprovers +tempAR.Del_AR1_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempAR.Del_AR2_Approver_Email__c + ';';        
                                DelegatedApprovers = DelegatedApprovers +tempAR.Del_CSO_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempAR.Del_DAM_LOB_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempAR.Del_F_R_Approver_Email__c + ';';
                            }
                            system.debug( 'AR Adjustment DelegatedApprovers :::: '+DelegatedApprovers);
                        }
                        else If(!lstCase[0].ICS_Credit_Memo__r.isEmpty())
                        {
                            for(Credit_Memo_ICS__c tempCM : lstCase[0].ICS_Credit_Memo__r)
                            {
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_AR1_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_AR2_Approver_Email__c + ';';        
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_CSO_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_LOB_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_Additional_Approver_Email__c + ';';
                                DelegatedApprovers = DelegatedApprovers +tempCM.Del_F_R_Approver_Email__c + ';' ;
                            }
                            system.debug( 'Credit Memo DelegatedApprovers :::: '+DelegatedApprovers);
                        }
                        system.debug( 'DelegatedApprovers :::: '+DelegatedApprovers);
                        if(DelegatedApprovers != '' && DelegatedApprovers != 'null' && DelegatedApprovers.containsIgnoreCase(objUserInfo.user_x.emailaddress) )
                        {
                            renderApprovalPageBlock = true;
                            isAuthenticated=true;
                        }                       
                        else
                        {
                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'You are not authorized for approval'));
                        }                       
                    }       
                }else
                {
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'You are not authorized for approval'));
                }
            }           
            return null;
            
        }

 
So whenever user enters any name inside the input field it should create a lightning component. Please help me on this.
The reason I am not able to reproduce the error because it's happening at the User's end.. Any idea why it's happening? He has tried in other browsers as well but still the same issue..
The logic which is mentioned in class is :
 
//Check for the time value if before 12 and accordingly check for AM or PM value
            starttime  = starttime +(startTimeValue.Hour()<12?clsStaticVariables.AM:clsStaticVariables.PM);
            endTime = endTime +(endTimeValue.Hour()<12?clsStaticVariables.AM:clsStaticVariables.PM);

 
How to login to Apex Dataloader with Custom URL because whenever I am trying to login. It pops up a login page and it says incorrect username & password even if i have tried with Security token..Also the Custom url from which we login redirects to adsso.. Please help me on urgent basis.
Also do we need to create the object's fields as well while creating the Custom metadata types? Please help me with an example . Why do we need to convert the apex class  exactly to metadata types/?
  • September 24, 2018
  • Like
  • 0
How to create smart search picklist like whenever i enter any text it should display under it? https://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/ i am following this but i am unable to create interested technologies picklist please help
public class AccountWrapper 
{

    public List<WrapperAccounts> wrapItems{set;get;}
    public List<WrapperAccounts> wrapConItems{set;get;}
    public List<WrapperAccounts> selectedItem{set;get;}
    public List<Contact> accContacts{set;get;}
      
    public Set<Id> accId=new Set<Id>();
    public AccountWrapper()
    {
        wrapItems=new List<WrapperAccounts>();
        List<Account> accItem2=new List<Account>([SELECT Name FROM Account limit 10]);
        wrapConItems=new List<WrapperAccounts>();
        for(Account a1:accItem2)
        {    
            boolean check=false;
            wrapItems.add(new WrapperAccounts(check,a1));
            
        }
        if(accId!=null)
        {
            for(Contact cx:conwrap)
            {
                wrapConItems.add(new WrapperAccounts(false,cx));
            }
        }
        
    }
//Defining pagference to perform actionsupport onclick event
public PageReference fetch()
{
    fetchRecords();
    return null;
}
public PageReference fetchCont()
{
    fetchConRecords();
    return null;
}
//Method to define fetchRecords which will fetch Related Contacts
public void fetchRecords()
    {
     accContacts=new List<Contact>(); 
     for(WrapperAccounts wraps : wrapItems)
     {
            if(wraps.selected==true)
            {
                accId.add(wraps.accList.Id);
            }
          System.debug('Selected Accounts:'+wraps);
             
      }
            System.debug('Accounts IDs:accId='+accId); 
          
    
         List<Contact> cons=[Select Name from Contact WHERE AccountId IN:accId];
          
              for(Contact con:cons)
              {
                      
                 accContacts.add(con);  
                
             }
                  System.debug('Contacts Lists:'+accContacts);

     }
 //method to fetch contact's detail page
 public Set<Id> conId=new Set<Id>();
 public void fetchConRecords()
    {
     
     for(WrapperAccounts contwraps : wrapConItems)
     {
            if(contwraps.conSel==true)
            {
                conId.add(contwraps.contLists.Id);
            }
          System.debug('Selected Contacts:'+contwraps);
             
      }
            
          
    
         List<Contact> conx2=[Select Id from Contact WHERE Id IN:conId];
          
          System.debug('Contacts Lists in conx2:'+conx2);

     }   
       
//Wrapper Class
public class WrapperAccounts
    {
        public boolean selected{set;get;}
        public Account accList{set;get;}
        public Contact contLists{set;get;}
        public boolean conSel{set;get;}
        
        public WrapperAccounts(Boolean sel,Account acc)
        {
            this.accList=acc;
            this.selected=sel;         
        }
        public WrapperAccounts(Boolean selec,Contact co)
        {
            this.conSel=selec;
            this.contLists=co;
        }
    }
}

<apex:page controller="AccountWrapper" sidebar="false">
<apex:form >
<apex:pageBlock >
            <apex:pageBlockButtons >
            <!--<apex:commandButton value="Select" action="{!fetchRecords}" reRender="block2" rerender="block3"/>-->
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Accounts" columns="3">
            <apex:pageBlockTable value="{!wrapItems}" var="c" id="table">
                <apex:column headerValue="Select">
                   <apex:inputCheckbox value="{!c.selected}"/>
                   <apex:actionSupport event="onclick"  action="{!fetch}"/>
                </apex:column>
                <apex:column value="{!c.accList.Name}" headerValue="Account Name"/>
            </apex:pageBlockTable>
           
            
            <apex:pageBlockTable value="{!accContacts}" var="c1" id="block2">
            <apex:column headerValue="Select">
                   <!--<apex:inputCheckbox value="{!c1.conSel}"/>-->
                   <apex:actionSupport event="onclick"  action="{!fetchCont}"/>
                </apex:column>
            <apex:column value="{!c1.Name}" headerValue="Related Contacts Name"/>
            </apex:pageBlockTable>
            
            
            <apex:pageBlockTable value="{!accContacts}" var="d1" id="block3">
            <apex:column value="{!d1.Name}" headerValue="Contact Detail Page"/>
            </apex:pageBlockTable>
            </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 
<apex:page controller="CheckEmailwithContact" >
  
  <apex:form >
  <apex:pageBlock title="Select Options as per your choice" >
<apex:selectRadio value="{!selectedCheckbox}" onclick="!getCons2(this.value)"  immediate="true">
<apex:selectOptions value="{!items}"/>
</apex:selectRadio><p/>
<!--<apex:commandButton value="Click Here" action="{!getCons2}"/>-->
</apex:pageBlock>
</apex:form>
 <apex:pageblock >
          <apex:pageBlockTable value="{!conlists}" var="l" id="Table">
          <apex:column headerValue="First Name" value="{!l.FirstName}"/>
          <apex:column headerValue="Last Name" value="{!l.LastName}"/>     
          <apex:column headerValue="Email" value="{!l.Email}"/>  
          </apex:pageBlockTable>
          
  </apex:pageBlock>
 
</apex:page>

 
I want to do something like this. How can it be possible , Please let me know :
for(Account acc2:[select id from account limit 1])
{
    //sObject s = new Account();
    Vehicle__c vt=new Vehicle__c();
    vt=(Sobject)acc2;
    insert vt;
    System.debug('sobject '+vt);
}

I don't want to do it like this :
for(Account acc2:[select id from account limit 1])
{
    
    Vehicle__c vt=new Vehicle__c();
    vt=acc2.name;
    insert vt;
    System.debug('sobject '+vt);
}

Here we are assigning the variables one by one. I have 157 fields how can I assign all of them in one go. Please help me this is bit urgent!!.

 
So whenever user enters any name inside the input field it should create a lightning component. Please help me on this.
The reason I am not able to reproduce the error because it's happening at the User's end.. Any idea why it's happening? He has tried in other browsers as well but still the same issue..
The logic which is mentioned in class is :
 
//Check for the time value if before 12 and accordingly check for AM or PM value
            starttime  = starttime +(startTimeValue.Hour()<12?clsStaticVariables.AM:clsStaticVariables.PM);
            endTime = endTime +(endTimeValue.Hour()<12?clsStaticVariables.AM:clsStaticVariables.PM);

 
How to login to Apex Dataloader with Custom URL because whenever I am trying to login. It pops up a login page and it says incorrect username & password even if i have tried with Security token..Also the Custom url from which we login redirects to adsso.. Please help me on urgent basis.
can anybody explain with a example where this scenario is used  in a simple manner,  i have gone through differnt examples , bt iam unable to understand it >>ApexPages.currentPage().getParameters().get('recordId') 

Hii , Just I Want  to make a ActivityHistory on What Id Object not on Target Object Id on Sending an Email From Apex . Then What Can I do ?
Its Urgent. Actually my Email Is Go From  Cutom Object Email Field  and also Using Email template ?

Hi Experts,
I want to create a trigger for following case:

Whenever a case is opened and closed for an account of particular region ( e.x. WE- West), the respective inside rep ( it's a sales rep) for that account should get email alert notification. What will be the trigger for this scenario?
 
Hi All 
I am facing problem when creating formula field it showing

You have reached the maximum number of 10 object references 

How to update field value of one object from other object field with some calculation.is it possible using trigger