• vikas rathi91
  • NEWBIE
  • 45 Points
  • Member since 2016
  • Salesforce Developer
  • Wipro


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 17
    Replies
Hi ,

 I am put the value in map using the Aggregate list  but not abel to get the value from map.
Map<Id,List<Id>> BdrepMap = new Map<id,list<id>>();
List<AggregateResult> opp_line_item_list = [Select OpportunityId, Product_BD_Rep__c, SUM(UnitPrice) FROM OpportunityLineItem 
                                                        WHERE opportunityId IN : oppMap.keyset() GROUP By Product_BD_Rep__c, OpportunityId];
           
for(AggregateResult oli : opp_line_item_list){
                        BdrepMap.put((ID)oli.get('opportunityId'),New list<id>());
                        BdrepMap.get((ID)oli.get('opportunityId')).add((ID)oli.get('Product_BD_Rep__c'));
                  }
//oppteamlist  its another list
 for(opportunityTeamMember team : oppteamlist){
                if(team.UserId != oppMap.get(team.OpportunityId).OwnerId && 
                   team.UserId == BdrepMap.get(team.OpportunityId).Product_BD_Rep__c){
                    deleteOppTeam.add(team);
                } 
            }
// error is Variable does not exist: Product_BD_Rep__c

I am not able to find any solution .
Can any one corret me.

Thanks in advance.
Hello Community,

I am stuck to find the solution on my Trigger . I want to Optimize my trigger code because some one use Query in for loop and nested for loop. I am abel to run code for single record but not in bulk.
Here My code please help on this, Thanks In advance.
try{
            for(opportunity opportunityobj:trigger.new)
            {
                opportunity opptyofoldmap=trigger.oldmap.get(opportunityobj.id);
              if(opptyofoldmap.closeDate!=null&opptyofoldmap.closeDate!=opportunityobj.closeDate)
                {
                    Integer dueDate=opptyofoldmap.closeDate.daysBetween(opportunityobj.closeDate);
                     if(dueDate!=0 && dueDate > 0 )
                    {
                        
                        list<OpportunityLineItem> newopp=[select id,Revenue_Start_Date__c,Opportunityid, UnitPrice, 
                                                          Revenue_Exchange_Rate__c, TCV__c, contract_term__c, CYR__c, NYR__c
                                                          from OpportunityLineItem where Opportunityid=:opportunityobj.id AND Revenue_Start_Date__c < :opportunityobj.closeDate];
                        for(OpportunityLineItem OpportunityProductobject:newopp)
                        {
                            integer i=0;
                            OpportunityProductobject.Revenue_Start_Date__c=OpportunityProductobject.Revenue_Start_Date__c+dueDate;
                            
                            OpportunityProductupdate.add(OpportunityProductobject);
                        }
                    }
                }
            }    
        }

Thanks
Accky​
We have created a lightning component. Inisde the component we are refering another component. we would like to validate the data inside child component on a button click from parent component.

Can anyone give some sample code or suggestion?

Thanks and RegardsUser-added image
Here we call child component

<div class="slds-modal__content slds-p-around--medium wide400">
                <!--Transaction Editor Component Here -->
                <!--<c:TransactionViewer thistrans="{!v.thistrans}" currencies="{!v.currencies}" 
                           tdetails="{!v.thisdetails}" /> -->
             {!v.body}
</div>


below is component  code is long so I paset only 2 field code


<div class="slds-form-element slds-size--1-of-3">
                            <!--<label class="slds-form-element__label" for="descrField">Description</label>-->
                            <!--<force:inputField aura:id="descrField" class="slds-textarea" value="{!v.thistrans.Description__c}"/> -->
                            <ui:inputText aura:id="descrField" class="slds-input" required="true" label="Description" value="{!v.thistrans.Description__c}"/>
                        </div>
                        <div class="slds-form-element slds-size--1-of-3">                            
                            <c:LookupSObject label="Deal/Tranche" pluralLabel="Deal/Tranches" sObjectAPIName="Tranche__c" instanceId="tnxTr"                          
                                             
                                             iconName="standard:process"
                                             listIconClass="slds-icon-standard-account"
                                             selectedId="{!v.thistrans.Tranche__c}"
                                             selectedName="{!v.thistrans.TName}"
                                             />
                        </div>

And here is controller code
 
okTranerror: function(component){
        var tratitle = component.find("trannameField").get("v.value");
        var haserrors = false;
        
        if(!tratitle){            
            effnamefld.set("v.errors", [{message:"Provide Name First!"}]);
            haserrors = true;
        }
please help i m try a lot but not success

thanks in advance 
I am using Lighting Icon on a page when we select the lookup field value then only icon can showing on the field not value I need the value with Lightning Icon
User-added image
And My code is 
<div aura:id="lookup-div" class="slds-lookup" data-select="single" data-scope="single" data-typeahead="true">
        <!-- This is the Input form markup -->        
        <label class="uiLabel-left form-element__label uiLabel" for="lookup">{!v.label}</label>
        <div class="slds-form-element__control slds-input-has-icon slds-input-has-icon--right">
          <!--  <c:svg class="slds-input__icon" xlinkHref="/resource/SLDS104/assets/icons/utility-sprite/svg/symbols.svg#search" /> -->
            <lightning:icon iconName="utility:search"  size="x-small" variant="search" class="slds-input__icon"/>
            <!-- This markup is for when an item is currently selected -->
            <div aura:id="lookup-pill" class="slds-pill-container slds-hide">
                <span class="slds-pill slds-pill--bare">
                    <span class="slds-pill__label">
                     <!--   <c:svg class="{!'slds-icon ' + v.listIconClass + ' slds-icon-small'}" xlinkHref="{!v.listIconSVGPath}" />{!v.searchString} -->
                         <lightning:icon iconName="{!v.iconName}"  size="x-small" variant="process" class="{!v.listIconClass}"/>
                    </span>
                    <button class="slds-button slds-button--icon-bare" onclick="{!c.clear}">
                    <!--    <c:svg class="slds-button__icon" xlinkHref="/resource/SLDS104/assets/icons/utility-sprite/svg/symbols.svg#close" /> -->
                        <lightning:icon iconName="utility:close"  size="x-small" variant="close" class="slds-button__icon"/>
                        <span class="slds-assistive-text">Remove</span>
                    </button>
                </span>
            </div>
            <!-- This markup is for when searching for a string -->
            <ui:inputText aura:id="lookup" value="{!v.searchString}" class="slds-input" updateOn="keyup" keyup="{!c.search}" />
        </div>

Thanks in Advance 
Hello Community,

One of the business processes requires the Relationship Manager (Account Manager), who is a road warrior, would like to have his team help him on tasks.
 
An Opportunity would have following states
  1. Prospecting
  2. Qualification
  3. Id. Decision Makers
  4. Needs Analysis
  5. PPM Sent
  6. Perception analysis
  7. Proposal/Term sheet sent
  8. Negotiation/Review
  9. Closed (Won or Lost)
 
Of these stages right after “Needs Analysis” is completed, a task must be automatically set for an available team member to prepare for next stage – Send PPM – which is a process by itself. But for the for the process flow it is simply a task assign to available team member (Associate).
 
When Perception analysis is complete, a similar task should be assigned to his associate to prepare “Proposal/Term Sheet”.


How to set this requirement its possible through workflow or trigger
User-added image

I try to solve but not find any solution 

how to solve it

Thanks In advance
User-added image

how to cover these line I am try but not success to cover these line 
@isTest
public class  EmailMessageTriggerHandlerTest{

 public static testMethod void test(){
  Contact objCon = new Contact();
     objCon.FirstName = 'Manas';
     objCon.LastName = 'Manas';
     objCon.AccountId = objacc.id;
     objCon.Email = 'ab@gmail.com';
     objCon.Phone = '(987) 456-4567';
     objCon.Five9_Source__c = 'Outdoor_B2B';
     objCon.MailingState = 'sd';
     insert objCon;
     
     Task t = new Task();
        t.OwnerId = UserInfo.getUserId();
        t.whoId= objcon.id;
        t.Subject='[Outreach] [Email] [Out] Hello';
        t.Status='Not Started';
        t.Priority='Normal';
        insert t;  
     }
}

 
Hello Every one 

I want to replace  {!Enhancement_Tracker__c.Id}  from <a href=https://ap2.salesforce.com/{!Enhancement_Tracker__c.Id}">Click Here</a>

I am using 
string body = obj.emailtemplate 
bodyString = bodyString.replace('{!Enhancement_Tracker__c.Id} ',objEnhancement.id);

and result is https://ap2.salesforce.com/%7B!Enhancement_Tracker__c.Id%7D

I want the id of the record
any help how to replace 

Thanks
Vikas Rathi
MY  callout class 
public with sharing class XeroCalloutUtility {
    public static Xero_Settings__c xeroSettings {
        get {
            if (xeroSettings == null) {
                xeroSettings = Xero_Settings__c.getInstance('Xero');          
            }
            return xeroSettings;
        }
        set;
    }
    public static HttpResponse executeCallout (String method, String resourceName, String requestBody) {
        system.debug('>>>>>>>>>>xeroSettings '+xeroSettings);
        HttpRequest request = new HttpRequest();    
        request.setMethod(method);
        request.setEndpoint(xeroSettings.Endpoint__c + resourceName);
        request.setHeader('Accept', 'application/json');
        system.debug('>>>>>>>>>>>>>>>>>>request '+request);
        if (String.isNotBlank(requestBody)) {
            request.setBody(requestBody);           
            request.setHeader('Content-Type', 'text/xml');
        }  
        request = XeroOAuthUtility.signRequest(request, xeroSettings.Consumer_Key__c);        
        return new Http().send(request);
    }
}


Here is my test class 
@isTest
public with sharing class XeroCalloutUtilityTest{
        
     Public Static TestMethod Void Testcallout(){
             Test.StartTest();
             Xero_Settings__c xeroseting = new Xero_Settings__c();
             xeroseting.name = 'testName';
             xeroseting.Consumer_Key__c = 'testConsumer';
             xeroseting.Endpoint__c = 'www.xero.com';
             insert xeroseting;
         
       XeroCalloutUtility.executeCallout(' request.setMethod','request.setEndpoint','request.setBody');
       
        HttpRequest request =  new HttpRequest();
        String contentType = request.getHeader('Content-Type');
        String actualValue = request.getBody();
        request.setHeader('Accept', 'application/json');
        //HttpResponse response = new HTTP().send(request);
        Test.StopTest();     
     }  
}

Any one  help me  where I am wrong
I am New in salesforce want to know how to write the test class for the call out class 

public with sharing class XeroCalloutUtility {
   
    public static Xero_Settings__c xeroSettings {

        get {

            if (xeroSettings == null) {
                
                xeroSettings = Xero_Settings__c.getInstance('Xero');
               
            }
            return xeroSettings;
        }
        set;
    }
    
    
    
    public static HttpResponse executeCallout (String method, String resourceName, String requestBody) {

        system.debug('>>>>>>>>>>xeroSettings '+xeroSettings);
        HttpRequest request = new HttpRequest();    
        request.setMethod(method);
        request.setEndpoint(xeroSettings.Endpoint__c + resourceName);
        request.setHeader('Accept', 'application/json');
        system.debug('>>>>>>>>>>>>>>>>>>request '+request);
       
        if (String.isNotBlank(requestBody)) {
            request.setBody(requestBody);           
            request.setHeader('Content-Type', 'text/xml');
        }

       
        request = XeroOAuthUtility.signRequest(request, xeroSettings.Consumer_Key__c);        
        return new Http().send(request);
    }

}

I am try but not Success code coverage 0% 
Hello Community,

I am stuck to find the solution on my Trigger . I want to Optimize my trigger code because some one use Query in for loop and nested for loop. I am abel to run code for single record but not in bulk.
Here My code please help on this, Thanks In advance.
try{
            for(opportunity opportunityobj:trigger.new)
            {
                opportunity opptyofoldmap=trigger.oldmap.get(opportunityobj.id);
              if(opptyofoldmap.closeDate!=null&opptyofoldmap.closeDate!=opportunityobj.closeDate)
                {
                    Integer dueDate=opptyofoldmap.closeDate.daysBetween(opportunityobj.closeDate);
                     if(dueDate!=0 && dueDate > 0 )
                    {
                        
                        list<OpportunityLineItem> newopp=[select id,Revenue_Start_Date__c,Opportunityid, UnitPrice, 
                                                          Revenue_Exchange_Rate__c, TCV__c, contract_term__c, CYR__c, NYR__c
                                                          from OpportunityLineItem where Opportunityid=:opportunityobj.id AND Revenue_Start_Date__c < :opportunityobj.closeDate];
                        for(OpportunityLineItem OpportunityProductobject:newopp)
                        {
                            integer i=0;
                            OpportunityProductobject.Revenue_Start_Date__c=OpportunityProductobject.Revenue_Start_Date__c+dueDate;
                            
                            OpportunityProductupdate.add(OpportunityProductobject);
                        }
                    }
                }
            }    
        }

Thanks
Accky​
We have created a lightning component. Inisde the component we are refering another component. we would like to validate the data inside child component on a button click from parent component.

Can anyone give some sample code or suggestion?

Thanks and RegardsUser-added image
Here we call child component

<div class="slds-modal__content slds-p-around--medium wide400">
                <!--Transaction Editor Component Here -->
                <!--<c:TransactionViewer thistrans="{!v.thistrans}" currencies="{!v.currencies}" 
                           tdetails="{!v.thisdetails}" /> -->
             {!v.body}
</div>


below is component  code is long so I paset only 2 field code


<div class="slds-form-element slds-size--1-of-3">
                            <!--<label class="slds-form-element__label" for="descrField">Description</label>-->
                            <!--<force:inputField aura:id="descrField" class="slds-textarea" value="{!v.thistrans.Description__c}"/> -->
                            <ui:inputText aura:id="descrField" class="slds-input" required="true" label="Description" value="{!v.thistrans.Description__c}"/>
                        </div>
                        <div class="slds-form-element slds-size--1-of-3">                            
                            <c:LookupSObject label="Deal/Tranche" pluralLabel="Deal/Tranches" sObjectAPIName="Tranche__c" instanceId="tnxTr"                          
                                             
                                             iconName="standard:process"
                                             listIconClass="slds-icon-standard-account"
                                             selectedId="{!v.thistrans.Tranche__c}"
                                             selectedName="{!v.thistrans.TName}"
                                             />
                        </div>

And here is controller code
 
okTranerror: function(component){
        var tratitle = component.find("trannameField").get("v.value");
        var haserrors = false;
        
        if(!tratitle){            
            effnamefld.set("v.errors", [{message:"Provide Name First!"}]);
            haserrors = true;
        }
please help i m try a lot but not success

thanks in advance 
Hi ALL,

I have 100 users in myorg.
 based on date of birth send greeting to particular users.

Please hlep me on this post.
Hi Friends,

I am trying to cover a test class for below Trigger. But it's not cover as well , yeah it's just 42% only . already i have inserted Account and Opportunity also. But Still it's Not Covering. Kindly give me a valid advise ! Why it's happening .

************************ Trigget *******************
trigger OpportunityRollUp on Opportunity  ( after insert, after update,after delete) {
     
       Set<ID> accSet = New Set<ID>();
       List<Account> accList  = New List<Account>();
      
      If(Trigger.IsDelete){
        
        for(Opportunity opp1 : Trigger.old){  /* Not Covered */
            accSet.add(opp1.AccountId);   /* Not Covered */
        }
      }
      
      If(Trigger.IsUpdate){
        for(Opportunity opp : Trigger.new){
        
            if(opp.Amount != Trigger.oldMap.get(opp.id).amount && opp.AccountId != Null ){
            
                accSet.add(opp.AccountId);  /* Not Covered */
            }        
        }          
      }
      

      if(!accSet.isEmpty()){
       /* Below Aggregate Result is Not Covered */
        for(AggregateResult age : [Select AccountId,sum(Amount)tot, avg(Amount)opAvg, Min(Amount)opMin,  Max(Amount)opMax  from opportunity     
                    Where AccountId IN :accSet GROUP BY AccountId]){
        
                  accList.add(New Account(Id = (ID)age.get('AccountId'), 
                                         opportunity_Total_Amount__c = (Decimal)age.get('tot'),
                                         Opportunity_Average__c = (Decimal)age.get('opAvg'),
                                         Opportunity_Max__c = (Decimal)age.get('opMax'),
                                         Opportunity_Min__c = (Decimal)age.get('opMin')));
        }
      }  
      
      if(accList.size() > 0){
          update accList;
      } 
      

}

*****************TEST CLASS ********************
@IsTest
Public Class OpportunityRollUp_Test{

public static testMethod void oppRollup(){


//Insert Account
Account acc = New Account();
acc.name = 'Test_Account';
acc.Account_Code__c = 'AP001';
acc.Opportunities_Total_Amount__c = '1000';
acc.Total_Opportunities__c = 5;
acc.Opportunity_Average__c = 1000;
acc.Opportunity_Min__c = 500;
acc.Opportunity_Max__c = 1000;
insert acc;
system.debug('Insert Account Details' + acc);

//insert CurrencyType
CurrencyType__c ctype = New CurrencyType__c();
ctype.name = 'Test_Type';
ctype.Conversion_Rate__c = 50;
ctype.ISO_Code__c = 'INR';
insert ctype;
system.debug('Insert Currency Type details : ' + ctype);

CurrencyType__c ctype1 = New CurrencyType__c();
ctype1.name = 'Test_Type';
ctype1.Conversion_Rate__c = 50;
ctype1.ISO_Code__c = 'AUD';
insert ctype1;

//Insert Oportunity
Opportunity Opp  = New Opportunity();
opp.name = 'Test_Opportunity';
opp.closeDate = System.today();
opp.stageName = 'Closed Won';
opp.Amount = 1000;
opp.Currency__c = 'INR';
opp.USD_Amount1__c = 1000;
opp.AccountId = acc.id;
insert opp;
system.debug('Insert Opp details : ' + opp);


Opportunity Opp1  = New Opportunity();
Opp1.name = 'Test_Opportunity';
Opp1.closeDate = System.today();
Opp1.stageName = 'Closed Won';
Opp1.Amount = 1000;
Opp1.Currency__c = 'INR';
Opp1.USD_Amount1__c = 1000;
Opp1.AccountId = acc.id;
insert opp1;
Opp1.Currency__c = 'AUD';
update opp1;
} 

}

Thanks In Advance...

Regards,
Soundar.
 
I have a Visual force page in which I have a custom picklist and custom text field. I want that text field become dependent upon selecting one value from picklist using VF page.
i want to create two picklist on one is project and another is projectTeamMember, When i select from first picklist project on second picklist we get its related projectteammember..Just like if we selecte Account on first picklist second picklist show its related contacts.
Something Like this Or not:-
public List<SelectOption> getObjectProject
             
            List<SelectOption> projectList = new List<SelectOption>();
             
            for(Project__c po : [Select Name from Project__c])
            {
                projectList.add(new SelectOption(po.Name, po.Name));
            }
            return projectList;
    }
Thank You
Hi All,

this is my business hours:
List<BusinessHours> lstBusinessHours = [SELECT Id,name,isdefault FROM BusinessHours where name='MGS Business Hours' LIMIT 1];

i want to calculate differece b/w two business days and expecting result is in DateTime format.

Ex:  datetime newDate = system.now().addHours(-8);
Decimal dt = BusinessHours.diff(lstBusinessHours[0].newDate , system.now())/3600000.0;
here i am getting hours. but i am expecting like MM/DD/YY HH:MM:SS.

i appriciate your response.

Thanks.
MY  callout class 
public with sharing class XeroCalloutUtility {
    public static Xero_Settings__c xeroSettings {
        get {
            if (xeroSettings == null) {
                xeroSettings = Xero_Settings__c.getInstance('Xero');          
            }
            return xeroSettings;
        }
        set;
    }
    public static HttpResponse executeCallout (String method, String resourceName, String requestBody) {
        system.debug('>>>>>>>>>>xeroSettings '+xeroSettings);
        HttpRequest request = new HttpRequest();    
        request.setMethod(method);
        request.setEndpoint(xeroSettings.Endpoint__c + resourceName);
        request.setHeader('Accept', 'application/json');
        system.debug('>>>>>>>>>>>>>>>>>>request '+request);
        if (String.isNotBlank(requestBody)) {
            request.setBody(requestBody);           
            request.setHeader('Content-Type', 'text/xml');
        }  
        request = XeroOAuthUtility.signRequest(request, xeroSettings.Consumer_Key__c);        
        return new Http().send(request);
    }
}


Here is my test class 
@isTest
public with sharing class XeroCalloutUtilityTest{
        
     Public Static TestMethod Void Testcallout(){
             Test.StartTest();
             Xero_Settings__c xeroseting = new Xero_Settings__c();
             xeroseting.name = 'testName';
             xeroseting.Consumer_Key__c = 'testConsumer';
             xeroseting.Endpoint__c = 'www.xero.com';
             insert xeroseting;
         
       XeroCalloutUtility.executeCallout(' request.setMethod','request.setEndpoint','request.setBody');
       
        HttpRequest request =  new HttpRequest();
        String contentType = request.getHeader('Content-Type');
        String actualValue = request.getBody();
        request.setHeader('Accept', 'application/json');
        //HttpResponse response = new HTTP().send(request);
        Test.StopTest();     
     }  
}

Any one  help me  where I am wrong
Hi all,
Canyone help me how to validate the phone number in custom vfpage bfeore redirecting to next page. I'm tried with the standard validation but it fires after submitting the record.

Thanks in advance.

Regards,
mac.
Hi All,

We have created a lightning component. Inisde the component we are refering another component. we would like to validate the data inside child component on a button click from parent component.

Can anyone give some sample code or suggestion?

Thanks and Regards,
Ganesh Babu.