• Scott Janis 6
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies
I'm trying to create a rolling formula which renders a a specific field for the first five months and then , renders the normnal revenue schedule amount after that. Every schedule ishadcorded as a 12 month schedule. 

The problem I'm having is that , rathe rthen having the amounts show up in ewach minth cumulatively, they show up at the 7th or 8th month when using a matrix report. Very odd and I can't get to the bottom of it. 





IF(YEAR(Schedule_Date__c)-YEAR(Closed_Date__c)<2,
CASE(
  MOD(
    YEAR(Schedule_Date__c)*12+(MONTH(Schedule_Date__c)-1)-
    YEAR(Closed_Date__c)*12+(MONTH(Closed_Date__c)-1),
    12),
  0, Onboarding_Amount__c,
  1, Onboarding_Amount__c*2,
  2, Onboarding_Amount__c*3,
  3, Onboarding_Amount__c*4,
  4, Onboarding_Amount__c*5,
  Schedule_Amount__c),
  NULL)
Formula field acting on a revenue schedule , but will not recognize schedules which in include part of one year and part of another
Hello, 

I have a custom object that is essentially pulling in a calculated amount based on the schedule date , and then  after 5 months, just pulls in the schedule amount. This works like a charm if the entire 12 month rev schedule is within 2018 or 2019 exlcusively. However if the scheduler is for example three months in 2018 (Oct , Nov and Dec) and the the remaining schedule goes into 2019, I get no results for those remaining 12 months. I've tried multiple variations of the statement below. I should also poing out that I  have a trigger which moves the schedule based on the close date.   



If ( MONTH(Closed_Date__c)=MONTH(  Schedule_Date__c ),  Onboarding_Amount__c ,
If ( (MONTH(Closed_Date__c)+1)=MONTH(Schedule_Date__c) ,Onboarding_Amount__c *2, 
If (  (MONTH(Closed_Date__c)+2)=MONTH(Schedule_Date__c)  , Onboarding_Amount__c *3 ,
If ( (MONTH(Closed_Date__c) +3) =MONTH(Schedule_Date__c), Onboarding_Amount__c *4 ,
If ( (MONTH(Closed_Date__c) +4) =MONTH(Schedule_Date__c), Onboarding_Amount__c *5,
If ( (MONTH(Closed_Date__c) +5) =MONTH(Schedule_Date__c),   Schedule_Amount__c  ,
If ( (MONTH(Closed_Date__c) +6) =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
If ( (MONTH(Closed_Date__c) +7)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +8)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +9)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +10)  =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
If ( (MONTH(Closed_Date__c) +11)  =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
NULL))))))))))))
Hello, 

I have a custom object that is essentially pulling in a calculated amount based on the schedule date , and then  after 5 months, just pulls in the schedule amount. This works like a charm if the entire 12 month rev schedule is within 2018 or 2019 exlcusively. However if the scheduler is for example three months in 2018 (Oct , Nov and Dec) and the the remaining schedule goes into 2019, I get no results for those remaining 12 months. I've tried multiple variations of the statement below. I should also poing out that I  have a trigger which moves the schedule based on the close date.   



If ( MONTH(Closed_Date__c)=MONTH(  Schedule_Date__c ),  Onboarding_Amount__c ,
If ( (MONTH(Closed_Date__c)+1)=MONTH(Schedule_Date__c) ,Onboarding_Amount__c *2, 
If (  (MONTH(Closed_Date__c)+2)=MONTH(Schedule_Date__c)  , Onboarding_Amount__c *3 ,
If ( (MONTH(Closed_Date__c) +3) =MONTH(Schedule_Date__c), Onboarding_Amount__c *4 ,
If ( (MONTH(Closed_Date__c) +4) =MONTH(Schedule_Date__c), Onboarding_Amount__c *5,
If ( (MONTH(Closed_Date__c) +5) =MONTH(Schedule_Date__c),   Schedule_Amount__c  ,
If ( (MONTH(Closed_Date__c) +6) =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
If ( (MONTH(Closed_Date__c) +7)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +8)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +9)  =MONTH(Schedule_Date__c),  Schedule_Amount__c,
If ( (MONTH(Closed_Date__c) +10)  =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
If ( (MONTH(Closed_Date__c) +11)  =MONTH(Schedule_Date__c),  Schedule_Amount__c ,
NULL))))))))))))
Hello, 

I'm wondering why this formula is not working as expected. It should  add the amount from the custom field (Type =currency)  Opportunity.Formula_for__c:SUM and provide a cummulative $$ for each month.  Instead its just repating the amount. 

I have this excat function , just using the 'Amount' field and it works perfectly. I even swampe out the curency field in this formual for AMOUNT and still...it's repeating rather the stacking/cummulative. 

I'm completely stuck. 


Opportunity.Formula_for__c:SUM

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,1)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM
, CLOSE_DATE,1), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM , CLOSE_DATE,2)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM
, CLOSE_DATE,2), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,3)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM
, CLOSE_DATE,3), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,4)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,4), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,5)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,5), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,6)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,6), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,7)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,7), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,8)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,8), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,9)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,9), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,10)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,10), 0) 

IF(NOT ISBLANK(PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,11)), 
PREVGROUPVAL(Opportunity.Formula_for__c:SUM, CLOSE_DATE,11), 0)
This is the trigger :
Trigger CreatingAutoRecords on OrderItem(After Insert, After Update)
{
    
    List<Screens__c> ScreensRecordsFinalListToInsert = New List<Screens__c>();
    
    If(Trigger.IsInsert || Trigger.IsUpdate)
    {
        For(OrderItem con : Trigger.New)
        {
            If(con.Quantity != null)
            {
                List<Screens__c> fetchingAlreadyExixtsedRecords = [Select Id FROM Screens__c WHERE  Order_Product__c =:con.Id];
                
                If(fetchingAlreadyExixtsedRecords.IsEmpty())
                {
                    // We are only creating a records when there is no Screen Record records exixts.
                    For(Integer I = 0; I < con.Quantity; I++)
                    {
                        Screens__c crd = New Screens__c();
                        
                        crd.Order_Product__c = con.Id;
                          crd.Name = 'Screen';
                          crd.Account__c = con.Account__c;
                   
                        ScreensRecordsFinalListToInsert.add(crd);
                    }
                    
                   
                }
                
            }
            
            try{
                If(!ScreensRecordsFinalListToInsert.IsEmpty()){
                    insert ScreensRecordsFinalListToInsert;
                }
            }
            Catch(Exception e){
                System.debug('The thrown exception for CreatingAutoRecords is:: ' + e.getMessage());
            }
        }
    }
    }

This is the test class:
@isTest

private class CreateAutoRecordsTest {
    @istest
    private static void insertRecord()


{




List<Screens__c> ScreensRecordsFinalListToInsert = New List<Screens__c>();

    
                   
                 Screens__c crd = New Screens__c();
                        
                          crd.Name = 'Screen';
                          
                           ScreensRecordsFinalListToInsert.add(crd);
                          
                            insert ScreensRecordsFinalListToInsert;
   
   } 
   }


I deploy them together. Then I run try to validate in production and I keep getting a code coverage error. 

 
"Create a flow in salesforce where you enter an account name and you pull up all contacts foir that account". This was not covered yet, Not coss object stuff was covered unless it was implied some how? In any even HOW do I do this. I know I use a screen and I need to store the AccountID and some how link it to the AccountID in the contact object. But ather that ...I',m lost. 
Hello,

Im just learnig flow and I spent a fortune in a book that ...at the end of each chapter has a quiz. But something is not rigt because the first question in the first chapter is the following ....Create a flow in salesforce where you enter an account name and you pull up all contacts foir that account". This was not covered yet, Not coss object stuff was covered unless it was implied some how? In any even HOW do I do this. I know I use a screen and I need to store the AccountID and some how link it to the AccountID in the contact object. But ather that ...I',m lost. 
This is the trigger :
Trigger CreatingAutoRecords on OrderItem(After Insert, After Update)
{
    
    List<Screens__c> ScreensRecordsFinalListToInsert = New List<Screens__c>();
    
    If(Trigger.IsInsert || Trigger.IsUpdate)
    {
        For(OrderItem con : Trigger.New)
        {
            If(con.Quantity != null)
            {
                List<Screens__c> fetchingAlreadyExixtsedRecords = [Select Id FROM Screens__c WHERE  Order_Product__c =:con.Id];
                
                If(fetchingAlreadyExixtsedRecords.IsEmpty())
                {
                    // We are only creating a records when there is no Screen Record records exixts.
                    For(Integer I = 0; I < con.Quantity; I++)
                    {
                        Screens__c crd = New Screens__c();
                        
                        crd.Order_Product__c = con.Id;
                          crd.Name = 'Screen';
                          crd.Account__c = con.Account__c;
                   
                        ScreensRecordsFinalListToInsert.add(crd);
                    }
                    
                   
                }
                
            }
            
            try{
                If(!ScreensRecordsFinalListToInsert.IsEmpty()){
                    insert ScreensRecordsFinalListToInsert;
                }
            }
            Catch(Exception e){
                System.debug('The thrown exception for CreatingAutoRecords is:: ' + e.getMessage());
            }
        }
    }
    }

This is the test class:
@isTest

private class CreateAutoRecordsTest {
    @istest
    private static void insertRecord()


{




List<Screens__c> ScreensRecordsFinalListToInsert = New List<Screens__c>();

    
                   
                 Screens__c crd = New Screens__c();
                        
                          crd.Name = 'Screen';
                          
                           ScreensRecordsFinalListToInsert.add(crd);
                          
                            insert ScreensRecordsFinalListToInsert;
   
   } 
   }


I deploy them together. Then I run try to validate in production and I keep getting a code coverage error.