• Nevin O'Regan 3
  • NEWBIE
  • 90 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 48
    Questions
  • 75
    Replies
Hi guys, 

My users would like to be able to create Accounts from the Home Page. I have created a simple custom button component which I have added to the page but I am unable to get the a working syntax for controller.

Has anyone configured something similar in the past?

User-added image
Hi guys,

I have a custom object called Payment__c, which has a lookup field to itself. I have a custom field called Replaced_Amount__c which I want to sum up the total amount of related payment records. I think the only way of doing this is through a trigger.

I have seen a lot of answers in the community on how to achieve a similar requirement but I haven't seen one where the object has a lookup to itself. 

Could anyway help me with this?
Hi guys,

I have a custom object called Year__c which related to the Lease. I have created a related child object called Year_Schedule__c. On the Year__c object there is a Start_Date__c, End_Date__c field, No_Of_Installments__c and Amount__c field. 
I'm trying to get this to behave very similar to the standar ScheduleLineItem.
When a user creates a Year__c record I'd like Year_Schedule__c records to automatically create to capture each month within the Start_Date__c and End_Date__c of the parent Year__c record. I have started this out with the below trigger which is creating the record for me but it is not creating a Year_Schedule__c for each month, it is only creating one Year_Schedule__c record. 

trigger CreateSchedulesOnYear on Year__c (after insert, after update){

if(Trigger.isInsert){

    List<Year_Schedule__c> ylst = new List <Year_Schedule__c>();

    for(Year__c yr : trigger.new){

        Year_Schedule__c ys = new Year_Schedule__c(
                    Year__c=yr.Id,
                    Start_Date__c=yr.Start_Date__c ,
                    Revenue__c=yr.Dynamic_Amount__c,
                    End_Date__c=yr.End_Date__c);

        ylst.add(ys);
    }
    insert ylst;  
}
}

 
Hi guys,

I have a custom object Target__c that is a parent object of Product2. When a  new Target__c record is created I want to automatically update the Target__c lookup field on the Product2 object with the latest Target__c record. I have tried the below trigger but I'm running into an Error: duplicate value found: <unknown> duplicates value on record with id: <unknown>

trigger MapTargetsToWarehouse on Targets__c (after insert) {
    for(Targets__c target : Trigger.new) {
        Product2[] products = [SELECT Id, Target__c FROM Product2];
        if (products.size() > 0) {
            Product2 product = products[0];
            product.Target__c  = target.Id;

            update product;
        }      
    }
}
Hi guys,

I'm looking to build an Autolaunch Flow which will update a lookup field in the OpportunityLineItemsSchedule object when a field has been update on another object.
I have created a custom object Pronto__c which is a placeholder for inbound data from an external database. I have a custom field on this object called LineItemScheduleId__c. The data coming from the external database also includes the recordId of the OpportunityLineItemSchedule record. Once the LineItemScheduleId__c is updated I want the Pronto__c record to link the the correct OpportunityLineItemSchedule record.
Can anyone guide me with the correct steps I need to take to get this to work using Flow and Process Builder?
Hi guys,

I created an AutoLaunch flow in my sandbox, along with the Process Builder. It works perfectly in the sandbox but when I deploy it, it doesn't work. 
I have activated both the Flow and the Process Builder.

Anyone any ideas?
Hi guys, 

I'm looking to try and build a custom button which creates a new record and also update a value in another record.
The object in question is a custom object called Payment. The purpose of this button is to allow users replace a payment with another payment. So if a user clicks on this button from within a payment record they will input the field values of the new payment record and the status value of the payment record from which the action was triggered will update to 'Replaced'. 
Is this possible through Quick Actions or Buttons and could anyone help me with it?
Hi guys,

I have created a custom object which is being updated with data from and external system. Data is being pulled from the OpportunityLineItemSchedule object to the external system, which then returns the Sales Order number back into the related OppLineItemSch record in Salesforce
The custom object is simply called Pronto__c. I have also created a custom field on this object called OppLineItemSchId__c which is the Id of the related OppLineItemSch record. I also have a lookup field on the OppLineItemSchedule object which looksup Pronto__c.
What I am trying to do is create the relationship between the Pronto__c record and the OpportunityLineItemSchedule record once the Pronto.LineItemScheduleId__c field matches the OpportunityLineItemSchedule.Id field.
I have a custom object called Year__c which is related to the Opportunity object.
On the Opp object I have a custom picklist field Period__c where has values 1 to 10. 
What I am trying to do is to automatically create Year__c records based on the Period__c picklist field. So if a user selects the value "2" in the Period__c field then I would like 2 Year__c records to be created.
Along with this I have a Start Date and End Date on the Opportunity and on the Year__c object. I need the Start Date in Year 1 record to = the Start Date on the Opportunity, the end Date should be 12 months after the Start Date on Year 1. On Year 2 the Start Date should be the day of the End Date of Year 1 and the End Date of Year 2 should = the End Date of the Opportunity. 

Would anyone be able to help me with this?
Hi guys,

I have created a trigger on the OpportunityLineItemSchedule record to update fields in the parent OpportunityLineItem record. However it is not updating the fields in the OpportunityLineItem to blank values if I delete a scedule. Can anyone help me with this?

trigger MapMontsOnSchedule on OpportunityLineItemSchedule (after insert, before update) {
    
    // UPDATED: Must handle multiple children for a single parent
    // Instead of a single OpportunityLineItem, hold a list of them
    Map<Id,List<OpportunityLineItemSchedule>> MapMonths = new Map<Id, List<OpportunityLineItemSchedule>>();
    
    // Have a temp list ready for looping
    List<OpportunityLineItemSchedule> tempOlisList;
    
    // Now populate the months map
    for(OpportunityLineItemSchedule sch : trigger.new) {
        // Check if the map already has an entry for the parent Id (key)
        if(MapMonths.containsKey(sch.OpportunityLineItemId)) {
            // If it does, then update the list with the new value (so it will not override the previous value)
            tempOlisList = MapMonths.get(sch.OpportunityLineItemId);
            tempOlisList.add(sch);
            MapMonths.put(sch.OpportunityLineItemId, tempOlisList);
        } else {
            // Otherwise, we will create a new entry in the map with a list value of just the current iteration's OLIS
            tempOlisList = new List<OpportunityLineItemSchedule>();
            tempOlisList.add(sch);
            MapMonths.put(sch.OpportunityLineItemId, tempOlisList);
        }
    }

    List<OpportunityLineItem> OppLineItemList = new List<OpportunityLineItem>();
    for(OpportunityLineItem oli:[
        Select id, January__c,February__c, March__c, April__c, May__c, June__c, July__c, August__c, September__c, October__c, November__c,December__c 
        From OpportunityLineItem 
        Where Id IN :MapMonths.Keyset()
    ]) {
        // Then, the following is the updated if statement inside your for loop
        if(MapMonths.containsKey(oli.id)) {
            
            // UPDATE: Because we have a list of children now, we will need to loop through all of them to assign values to each month before moving on to the next Opportunity Line Item
            // Create a for loop to go through the list of children
            for(OpportunityLineItemSchedule olis : MapMonths.get(oli.id)) {
                
                // Create a switch statement to check what value is the Month
                switch on olis.Month__c {
                    // If the opportunity line item schedule's Month field was January
                    when 'January' {
                        // Then assign the opportunity line item's January field to the opportunity line item schedule's quantity
                        oli.January__c = olis.Quantity;
                    }
                    when 'February' {
                        oli.February__c = olis.Quantity;
                    }
                    when 'March' {
                        oli.March__c = olis.Quantity;
                    }
                    when 'Apr' {
                        oli.April__c = olis.Quantity;
                    }
                    when 'May' {
                        oli.May__c = olis.Quantity;
                    }
                    when 'June' {
                        oli.June__c = olis.Quantity;
                    }
                    when 'July' {
                        oli.July__c = olis.Quantity;
                    }
                    when 'August' {
                        oli.August__c = olis.Quantity;
                    }
                    when 'September' {
                        oli.September__c = olis.Quantity;
                    }
                    when 'October' {
                        oli.October__c = olis.Quantity;
                    }
                    when 'November' {
                        oli.November__c = olis.Quantity;
                    }
                    when 'December' {
                        oli.December__c = olis.Quantity;
                    }
                    // If it did not find any matches
                    when else {
                        // EDIT: do not put anything here for now
                        // You can leave this empty or put something in here to handle cases where the Month field is NOT the name of the month
                        // e.g. Month field was for some reason populated with 'Apple'
                    }
                }
            }
            OppLineItemList.add(oli);
        }
    }
    update OppLineItemList;
}
Hi guys, 

I have built my first trigger with the help of this group. I'm hoping someone can help me out building a test class for it so that I can deploy it into production. The trigger basically maps fields from OppLineItemSchedule to the OppLineItem

trigger MapMontsOnSchedule on OpportunityLineItemSchedule (after insert, before update) {
    
    // UPDATED: Must handle multiple children for a single parent
    // Instead of a single OpportunityLineItem, hold a list of them
    Map<Id,List<OpportunityLineItemSchedule>> MapMonths = new Map<Id, List<OpportunityLineItemSchedule>>();
    
    // Have a temp list ready for looping
    List<OpportunityLineItemSchedule> tempOlisList;
    
    // Now populate the months map
    for(OpportunityLineItemSchedule sch : trigger.new) {
        // Check if the map already has an entry for the parent Id (key)
        if(MapMonths.containsKey(sch.OpportunityLineItemId)) {
            // If it does, then update the list with the new value (so it will not override the previous value)
            tempOlisList = MapMonths.get(sch.OpportunityLineItemId);
            tempOlisList.add(sch);
            MapMonths.put(sch.OpportunityLineItemId, tempOlisList);
        } else {
            // Otherwise, we will create a new entry in the map with a list value of just the current iteration's OLIS
            tempOlisList = new List<OpportunityLineItemSchedule>();
            tempOlisList.add(sch);
            MapMonths.put(sch.OpportunityLineItemId, tempOlisList);
        }
    }

    List<OpportunityLineItem> OppLineItemList = new List<OpportunityLineItem>();
    for(OpportunityLineItem oli:[
        Select id, January__c,February__c, March__c, April__c, May__c, June__c, July__c, August__c, September__c, October__c, November__c,December__c 
        From OpportunityLineItem 
        Where Id IN :MapMonths.Keyset()
    ]) {
        // Then, the following is the updated if statement inside your for loop
        if(MapMonths.containsKey(oli.id)) {
            
            // UPDATE: Because we have a list of children now, we will need to loop through all of them to assign values to each month before moving on to the next Opportunity Line Item
            // Create a for loop to go through the list of children
            for(OpportunityLineItemSchedule olis : MapMonths.get(oli.id)) {
                
                // Create a switch statement to check what value is the Month
                switch on olis.Month__c {
                    // If the opportunity line item schedule's Month field was January
                    when 'January' {
                        // Then assign the opportunity line item's January field to the opportunity line item schedule's quantity
                        oli.January__c = olis.Quantity;
                    }
                    when 'February' {
                        oli.February__c = olis.Quantity;
                    }
                    when 'March' {
                        oli.March__c = olis.Quantity;
                    }
                    when 'Apr' {
                        oli.April__c = olis.Quantity;
                    }
                    when 'May' {
                        oli.May__c = olis.Quantity;
                    }
                    when 'June' {
                        oli.June__c = olis.Quantity;
                    }
                    when 'July' {
                        oli.July__c = olis.Quantity;
                    }
                    when 'August' {
                        oli.August__c = olis.Quantity;
                    }
                    when 'September' {
                        oli.September__c = olis.Quantity;
                    }
                    when 'October' {
                        oli.October__c = olis.Quantity;
                    }
                    when 'November' {
                        oli.November__c = olis.Quantity;
                    }
                    when 'December' {
                        oli.December__c = olis.Quantity;
                    }
                    // If it did not find any matches
                    when else {
                        // EDIT: do not put anything here for now
                        // You can leave this empty or put something in here to handle cases where the Month field is NOT the name of the month
                        // e.g. Month field was for some reason populated with 'Apple'
                    }
                }
            }
            OppLineItemList.add(oli);
        }
    }
    update OppLineItemList;
}
Hi guys,

I have created 12 custom number fields in the OppLineItem, each labeled a month of the year. I have also created a custom formula text field in the OppLineItemSchedule object called Month which defines the month based on the scheduled date.
I am trying to create a trigger to map the Quantity value from the related OppLineItemSchedule record to the relevant OppLineItem Month field. I have created the below trigger but the issue is that it is populating every Month field on the OppLineItem with a value even if there is not a related OppLineItemSch Quantity. 

trigger MapMontsOnSchedule on OpportunityLineItemSchedule (after insert, before update) {
    Map<Id,Integer> MapMonths = new Map<Id, Integer>();
 
    for(OpportunityLineItemSchedule sch:trigger.new) {
         MapMonths.put(sch.OpportunityLineItemId, Integer.valueOf(sch.Quantity));
    }
 
    List<OpportunityLineItem> OppLineItemList = new List<OpportunityLineItem>();
 
    for(OpportunityLineItem oli:[Select id, January__c, 
                                            February__c, 
                                            March__c, 
                                            April__c, 
                                            May__c, 
                                            June__c, 
                                            July__c, 
                                            August__c, 
                                            September__c, 
                                            October__c, 
                                            November__c,
                                            December__c From OpportunityLineItem Where Id IN :MapMonths.Keyset()])
    {
        if(MapMonths.containsKey(oli.id))
        {
            OppLineItemList.add(new OpportunityLineItem(Id = oli.id, January__c=MapMonths.get(oli.id), 
                                                                     February__c=MapMonths.get(oli.id),
                                                                        March__c=MapMonths.get(oli.id), 
                                                                     April__c=MapMonths.get(oli.id),
                                                                     May__c=MapMonths.get(oli.id),
                                                                     June__c=MapMonths.get(oli.id),
                                                                     July__c=MapMonths.get(oli.id),
                                                                     August__c=MapMonths.get(oli.id),
                                                                     September__c=MapMonths.get(oli.id),
                                                                     October__c=MapMonths.get(oli.id),
                                                                     November__c=MapMonths.get(oli.id),
                                                                     December__c=MapMonths.get(oli.id)));
                                                                                    
        }
    }
    update OppLineItemList;
}
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;
}

 
Hi guys,

I have custom formula fields on the OpportunityLineItemSchedule object which display a month based on the month the scheduled date falls within. 

I have created 12 custom fields on the OppLine object, each labeled one of the months of the year. I need a way of rolling up the Quantity of the the related schedules to the corresponding custom fields on the OppLine. 

Has anyone created anything similar in the past?
I have to Auto Number fields on the Opportunity and the Quote objects. They are both running using the same format which is confusing for users. I'd like to identify the records that have matching Auto Number field values. How can I achieve this through SOQL?
I have an Approval_Status__c field on the Opportunity. When a related OpportunityLineItem.UnitPrice is below the List Price I need this to update to 'Needs Approval'. If the Unit Price is above the List Price then the Approval_Status__c field should be null. 
Can anyone give me some help with wrighting a trigger for this?
Hi Guys,

We have a need to be able to add more than one pricebook to an Opportunity. I know that this is not possible out of the box but is there a way that this can be achieved through custom development? Has anyone implemented something similiar in the past?

 
Hi guys,

I have created two lenses which calculate the No. of rows after I apply a couple of filters to the dataset. One gives me the Full Allocation and the other gives me Partial Allocation. 

Partial
q = load "FillRatio201902";
q = filter q by 'BO_Qty' > 0;
q = filter q by 'Status' != "Cancelled";
q = filter q by 'Formula' < 0;
q = group q by all;
q = foreach q generate count() as 'count';
q = limit q 2000;

Full Allocation
q = load "FillRatio201902";
q = filter q by 'BO_Qty' == 0;
q = filter q by 'Status' != "Cancelled";
q = filter q by date('Allocated_Date_Year', 'Allocated_Date_Month', 'Allocated_Date_Day') in [dateRange([1970,10,6], [2019,3,3])];
result = group q by all;
result = foreach result generate count(q) as 'A', sum(q.'BO_Qty') as 'B';
result = limit result 2000;

I now need to calculate a 'Fill Ratio' which includes the results of the Full Allocation and Partial Allocation in it.
Fill Ratio = Full Allocation + (Partial * 0.5) / Total No. Of Rows

Is it even possible to calculate this through SAQL?
Hi guys,

I am trying to filter out data to only show lines where the dates in two columns are matching in einstein analytics.
Can anyone help me with this?
Is it possible to override a file? The requirement is based around Conga Composer. When a user generates a document it is automatically saved to the record. The business would like to override the same file. I know there is a version control function that can be used but this is not required. 
I have created custom buttons which I would only make available based on the Contact.Type field value selected. Is it possible to create a custom component where I can group these buttons?
If I create a Big Object and then delete it is that counted towards the 100 big object limit? 
Hi guys, 

My users would like to be able to create Accounts from the Home Page. I have created a simple custom button component which I have added to the page but I am unable to get the a working syntax for controller.

Has anyone configured something similar in the past?

User-added image
Hi guys,

I have a custom object called Payment__c, which has a lookup field to itself. I have a custom field called Replaced_Amount__c which I want to sum up the total amount of related payment records. I think the only way of doing this is through a trigger.

I have seen a lot of answers in the community on how to achieve a similar requirement but I haven't seen one where the object has a lookup to itself. 

Could anyway help me with this?
Hi guys,

I'm looking to build an Autolaunch Flow which will update a lookup field in the OpportunityLineItemsSchedule object when a field has been update on another object.
I have created a custom object Pronto__c which is a placeholder for inbound data from an external database. I have a custom field on this object called LineItemScheduleId__c. The data coming from the external database also includes the recordId of the OpportunityLineItemSchedule record. Once the LineItemScheduleId__c is updated I want the Pronto__c record to link the the correct OpportunityLineItemSchedule record.
Can anyone guide me with the correct steps I need to take to get this to work using Flow and Process Builder?
Hi guys,

I created an AutoLaunch flow in my sandbox, along with the Process Builder. It works perfectly in the sandbox but when I deploy it, it doesn't work. 
I have activated both the Flow and the Process Builder.

Anyone any ideas?
Hi guys, 

I'm looking to try and build a custom button which creates a new record and also update a value in another record.
The object in question is a custom object called Payment. The purpose of this button is to allow users replace a payment with another payment. So if a user clicks on this button from within a payment record they will input the field values of the new payment record and the status value of the payment record from which the action was triggered will update to 'Replaced'. 
Is this possible through Quick Actions or Buttons and could anyone help me with it?
I have a custom object called Year__c which is related to the Opportunity object.
On the Opp object I have a custom picklist field Period__c where has values 1 to 10. 
What I am trying to do is to automatically create Year__c records based on the Period__c picklist field. So if a user selects the value "2" in the Period__c field then I would like 2 Year__c records to be created.
Along with this I have a Start Date and End Date on the Opportunity and on the Year__c object. I need the Start Date in Year 1 record to = the Start Date on the Opportunity, the end Date should be 12 months after the Start Date on Year 1. On Year 2 the Start Date should be the day of the End Date of Year 1 and the End Date of Year 2 should = the End Date of the Opportunity. 

Would anyone be able to help me with this?
Hi guys,

I have created 12 custom number fields in the OppLineItem, each labeled a month of the year. I have also created a custom formula text field in the OppLineItemSchedule object called Month which defines the month based on the scheduled date.
I am trying to create a trigger to map the Quantity value from the related OppLineItemSchedule record to the relevant OppLineItem Month field. I have created the below trigger but the issue is that it is populating every Month field on the OppLineItem with a value even if there is not a related OppLineItemSch Quantity. 

trigger MapMontsOnSchedule on OpportunityLineItemSchedule (after insert, before update) {
    Map<Id,Integer> MapMonths = new Map<Id, Integer>();
 
    for(OpportunityLineItemSchedule sch:trigger.new) {
         MapMonths.put(sch.OpportunityLineItemId, Integer.valueOf(sch.Quantity));
    }
 
    List<OpportunityLineItem> OppLineItemList = new List<OpportunityLineItem>();
 
    for(OpportunityLineItem oli:[Select id, January__c, 
                                            February__c, 
                                            March__c, 
                                            April__c, 
                                            May__c, 
                                            June__c, 
                                            July__c, 
                                            August__c, 
                                            September__c, 
                                            October__c, 
                                            November__c,
                                            December__c From OpportunityLineItem Where Id IN :MapMonths.Keyset()])
    {
        if(MapMonths.containsKey(oli.id))
        {
            OppLineItemList.add(new OpportunityLineItem(Id = oli.id, January__c=MapMonths.get(oli.id), 
                                                                     February__c=MapMonths.get(oli.id),
                                                                        March__c=MapMonths.get(oli.id), 
                                                                     April__c=MapMonths.get(oli.id),
                                                                     May__c=MapMonths.get(oli.id),
                                                                     June__c=MapMonths.get(oli.id),
                                                                     July__c=MapMonths.get(oli.id),
                                                                     August__c=MapMonths.get(oli.id),
                                                                     September__c=MapMonths.get(oli.id),
                                                                     October__c=MapMonths.get(oli.id),
                                                                     November__c=MapMonths.get(oli.id),
                                                                     December__c=MapMonths.get(oli.id)));
                                                                                    
        }
    }
    update OppLineItemList;
}