• tulasi tayer
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi guys,

I am relatively new to writing triggers and I am running into an issue with one that I am currently working on. 

I would like to update custom fields in the OpportunityLineItem object with the value from the OpportunityLineItemSchedule.Quantity field. I have 12 custom fields in the OpportunityLineItem for each month of the year, Jan to Dec.

Here is the code that I have so far but I am running into an error "Method does not exist or incorrect signature: void put(Id, Decimal) from the type Map<Id,Integer>" on Line 6.

trigger MapMontsOnSchedule on OpportunityLineItemSchedule (after insert, before update) {
Map<Id,Integer> OpportunityLineItemIdwithOpportunityLineItemScheduleField = new Map<Id, Integer>();
 
    for(OpportunityLineItemSchedule sch:trigger.new)
    {
        OpportunityLineItemIdwithOpportunityLineItemScheduleField.put(sch.OpportunityLineItemId, sch.Quantity);
    }
 
    List<OpportunityLineItem> listUpdatedOpportunityLineItem = new List<OpportunityLineItem>();
 
    for(OpportunityLineItem oli:[Select id, January__c From OpportunityLineItem Where Id IN :OpportunityLineItemIdwithOpportunityLineItemScheduleField.Keyset()])
    {
        if(OpportunityLineItemIdwithOpportunityLineItemScheduleField.containsKey(oli.id))
        {
            listUpdatedOpportunityLineItem.add(new OpportunityLineItem(Id = oli.id, January__c=OpportunityLineItemIdwithOpportunityLineItemScheduleField.get(oli.id)));
        }
    }
    update listUpdatedOpportunityLineItem;
}

 

So the request I have is to create a custom button on opportunity that pops a window allowing the user to add a comment
: That comment must be appended with today date and should be added to comment section
 Next time another comment is added the previous comment should be added to a description filedSo on so forth
 Where comment and description will be read only fields on the page
 Comment is Rich text field
 
i have my apex class
 
public with sharing class AddCommentbuttonOpportunity { 
public Opportunity getComments{get;set;} 
public AddCommentbuttonOpportunity(Apexpages.StandardController controller){ List<String> fields= new List<String> {'Comments_Next_Steps__c'}; controller.addFields(fields); this.getComments=(Opportunity)controller.getRecord(); if(getComments.Comments_Next_Steps__c!=null) { getComments.Comments_Next_Steps__c = System.today() + ' ' + getComments.Comments_Next_Steps__c; string temp= getComments.Description; if(temp==null && String.isBlank(temp)){ getComments.Description= getComments.Comments_Next_Steps__c; }else If(temp!=null && String.isNotBlank(temp)){ getComments.Description= getComments.Comments_Next_Steps__c +'/n' +temp; } } } public PageReference save() { insert getComments; return new PageReference('/'+getComments.id); } } This is my VF page <apex:page sidebar="false" standardController="Opportunity" extensions="AddCommentbuttonOpportunity"> <apex:form > <apex:pageBlock title="Add a New Comment"> <apex:pageBlockSection > <apex:inputfield value="{! Opportunity.Comments_Next_Steps__c}" /> <br/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page> but when i enter value and click save i am getting error ' what am i missing

​​​​​​​

Hey all,

I am facing problem in authorization of my org through visual code for using lightening web component. I am using window 10. I have followed all the steps mentioned in trailhead. I have installed the salesforce CLI, latest version of visual studio. salesforce extension pack and salesforce CLI. I have created project using sfdx command create project. Now using ctrl+shift+p  when i select "Authorize an org". It shows error as mentioned in screnshot. Please help for the same as it is very urgent.User-added image

I have VF page i am calling batchapex class from my controller class to perform update operation on records.Now after successfull updation using batchapex i want to display those updated record on VF page.
Hi,

I am new to Lightning Component with fair knowledge in Apex and VF. I have a custom object(B) that is lookup relationship field to the Contact record. I want to create a Lightning Component to display the Contact's related custom object (B) in Gmail (Lightning for Gmail side panel). So whenever I access an Email, the component will display that contact's related custom object. Please help with the code! Thanks.
  • July 25, 2018
  • Like
  • 2