• Otto2020
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi - I am in the process of creating an automated flow that is supposed to do the following:

I have a timecard__c custom object. If a timecard record is in a Submitted status then that means that it is in the Manager's Items to Approve queue (Process Instance Step object).  The manager's value is in a Manager lookup field on the timecard__c object (lookup to the user record which also contains their email address).

I set up the automated flow as follows:

Start element:
User-added image
 

Get Records Element:

User-added image


Then the plan is to add a Send Email Action to finally send out the summary email (multiple records in one email)

How do I configure the flow to pick up the timecard records for each manager and send the summary email? for example, if there 10 records in the population and these are associated with 2 managers then two emails will be sent (1 for each manager) to remind them to approve the records in their queue.

Thanks in advance.
Hi there,

Please help with this class where I am getting an error upon saving the test class below:
 
@isTest
public class APTS_ResendCreditMemoEmailTest{
    static testMethod  void creditMemoDocumentGenerationTest(){

        Profile profileSO = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1];
        
        User userSO = APTS_TestDataFactory.getUser('LastName123','medidate', profileSO.ID);
        insert userSO;
        System.runAs(userSO){
            EmailTemplate emailTemplateSO1 = APTS_TestDataFactory.getEmailTemplate('APTS Non Japan Invoice','APTS_Non_Japan_Invoice', userSO.ID);
            List<EmailTemplate> listEmailTemplate = new List<EmailTemplate>();
            listEmailTemplate.add(emailTemplateSO1);
            insert emailTemplateSO1;
        }

        insert APTS_TestDataFactory.getTaxConnectorConfigSetting();

        //Create & Insert Core Currency
        appirio_core__Currency__c coreCurrencyUSD = APTS_TestDataFactory.getCoreCurrency('U.S. Dollar','USD', TRUE);
        LIst<appirio_core__Currency__c> coreCurrencylist = new List<appirio_core__Currency__c>();
        coreCurrencylist.add(coreCurrencyUSD);
        insert coreCurrencylist;
        
        APTS_Legal_Entity__c legalEntitySO= APTS_TestDataFactory.getLegalEntity('Japan', coreCurrencyUSD.ID, FALSE);
        legalEntitySO.APTS_LE_Company_Code__c = 'ABC';
        legalEntitySO.APTS_LE_Country__c  = 'DEF';
        insert legalEntitySO;

        Apttus_Config2__PaymentTerm__c paymentTermSO = APTS_TestDataFactory.createPaymentTerm('Net 120', 'Net 120 Days', 120 , TRUE);
        insert paymentTermSO;

        APTS_Invoice_Number_Settings__c invoiceNumberSettingSO = APTS_TestDataFactory.getInvoiceNumberSetting(legalEntitySO.ID);
        insert invoiceNumberSettingSO;

        //Create & Insert Account
        Account accSO = APTS_TestDataFactory.getAccount('Test Account');
        accSO.APTS_Global_MSA__c = TRUE;
        insert accSO;
        
        Contact contactSO1 = APTS_TestDataFactory.getContact(accSO.ID, 'Japan', 'Last1', 'Japan');
        Contact contactSO2 = APTS_TestDataFactory.getContact(accSO.ID, 'Esker', 'Last2', 'Japan');
        List<Contact> listContact = new List<Contact>();
        listContact.add(contactSO1);
        listContact.add(contactSO2);
        insert listContact;

        Apttus_Config2__AccountLocation__c accountLocationSO1 = APTS_TestDataFactory.getAccountLocation('USA Account Location', accSO.ID, 'USA');
        accountLocationSO1.Apttus_Config2__DefaultInvoiceTemplate__c = 'APTS Non Japan Invoice';
        Apttus_Config2__AccountLocation__c accountLocationSO2 = APTS_TestDataFactory.getAccountLocation('USA Account Location', accSO.ID, 'USA');
        List<Apttus_Config2__AccountLocation__c> accountLocationList = new List<Apttus_Config2__AccountLocation__c>();
        accountLocationList.add(accountLocationSO1);
        accountLocationList.add(accountLocationSO2);
        insert accountLocationList;

        Opportunity oppSO1 = APTS_TestDataFactory.getOppty(accSO.ID, 'USA Opp');
        Opportunity oppSO2 = APTS_TestDataFactory.getOppty(accSO.ID, 'USA Opp');
        List<Opportunity> oppList = new List<Opportunity>();
        oppList.add(oppSO1);
        oppList.add(oppSO2);
        insert oppList;

        Apttus_Config2__Order__c orderSo = APTS_TestDataFactory.getOrder(accSO.Id, oppSO1.ID, accountLocationSO1.ID);
        orderSo.Apttus_Config2__PaymentTermId__c = paymentTermSO.ID;
        orderSo.APTS_Invoice_Delivery_Method_Email__c = true;
        orderSo.APTS_Invoice_Delivery_Method_Print__c = true;
        insert orderSo;

        Apttus_Billing__Invoice__c invoiceSO1 = APTS_TestDataFactory.getInvoice(accSO.ID, paymentTermSO.ID);
        invoiceSO1.APTS_Legal_Entity__c = legalEntitySO.ID;
        invoiceSO1.Apttus_Billing__LocationId__c = accountLocationSO1.ID;
        invoiceSO1.APTS_Order__c = orderSo.ID;
        
        Apttus_Billing__Invoice__c invoiceSO2 = APTS_TestDataFactory.getInvoice(accSO.ID, paymentTermSO.ID);
        invoiceSO2.APTS_Legal_Entity__c = legalEntitySO.ID;
        invoiceSO2.Apttus_Billing__LocationId__c = accountLocationSO2.ID;
        invoiceSO2.APTS_Order__c = orderSo.ID;

        List<Apttus_Billing__Invoice__c> invoiceList = new List<Apttus_Billing__Invoice__c>();
        invoiceList.add(invoiceSO1);
        invoiceList.add(invoiceSO2);
        insert invoiceList;

        Apttus_Billing__CreditMemo__c creditMemoSO = APTS_TestDataFactory.getCreditMemmo(accSO.ID, invoiceSO1.ID);
        creditMemoSO.APTS_Legal_Entity__c = legalEntitySO.ID;
        creditMemoSO.Apttus_Billing__LocationId__c = accountLocationSO1.ID;
        creditMemoSO.APTS_Shipping_Location__c = accountLocationSO1.ID;
        //creditMemoSO.Apttus_Billing__Status__c = 'Approved';
        creditMemoSO.Apttus_Billing__DeliveryStatus__c = 'Pending';
        creditMemoSO.APTS_Order__c = orderSo.ID;

        List<Apttus_Billing__CreditMemo__c>creditMemolist = new List<Apttus_Billing__CreditMemo__c>();
        creditMemolist.add(creditMemoSO);
        insert creditMemolist;
        
        Attachment attachmentSO = APTS_TestDataFactory.getAttachment(creditMemoSO.ID,'CreditMemo Attachment');
        List<Attachment> listAttachment = new List<Attachment>();
        listAttachment.add(attachmentSO);
        insert listAttachment;


        Apttus_Billing__RelatedARTransaction2__c relatedARTransactionSO = APTS_TestDataFactory.getRelatedARTransaction(invoiceSO1.ID);
        relatedARTransactionSO.Apttus_Billing__TxnType__c = 'Refund';
        relatedARTransactionSO.Apttus_Billing__DestinationCreditMemoId__c = creditMemoSO.ID;
        insert relatedARTransactionSO;
        
        Test.startTest();
        Test.setCurrentPageReference(new PageReference('Page.myPage'));
        System.currentPageReference().getParameters().put('creditMemoID', creditMemoSO.ID);
        System.currentPageReference().getParameters().put('status', 'Approved');

        APTS_ResendCreditMemoEmail resendCreditMemoEmail = new APTS_ResendCreditMemoEmail();
        resendCreditMemoEmail.resendEmail();
        
        Test.stopTest();

    }
}

The error is:

Error: Compile Error: Method does not exist or incorrect signature: void getOrder(Id, Id, Id) from the type APTS_TestDataFactory at line 62

Any guidance would be most appreciated. Thank you!
 
I have a custom agreement object that is associated to a custom order object which shows up as a related list on the agreement. 

I would like to write a line of apex code that: upon save ie before update of the agreement , check the order related list, and if there is more than one order in it, then, throw an error asking the user to remove all other oder records, except for the latest one.

Only allow the user to save the record after this action is taken

Any ideas on how I can write this line of code?
I have a custom agreement object that is associated to a custom order object which shows up as a related list on the agreement. 

I would like to write a line of apex code that: upon save ie before update of the agreement , check the order related list, and if there is more than one order in it, then, throw an error asking the user to remove all other oder records, except for the latest one.

Only allow the user to save the record after this action is taken

Any ideas on how I can write this line of code?
Hi there,

Please help with this class where I am getting an error upon saving the test class below:
 
@isTest
public class APTS_ResendCreditMemoEmailTest{
    static testMethod  void creditMemoDocumentGenerationTest(){

        Profile profileSO = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1];
        
        User userSO = APTS_TestDataFactory.getUser('LastName123','medidate', profileSO.ID);
        insert userSO;
        System.runAs(userSO){
            EmailTemplate emailTemplateSO1 = APTS_TestDataFactory.getEmailTemplate('APTS Non Japan Invoice','APTS_Non_Japan_Invoice', userSO.ID);
            List<EmailTemplate> listEmailTemplate = new List<EmailTemplate>();
            listEmailTemplate.add(emailTemplateSO1);
            insert emailTemplateSO1;
        }

        insert APTS_TestDataFactory.getTaxConnectorConfigSetting();

        //Create & Insert Core Currency
        appirio_core__Currency__c coreCurrencyUSD = APTS_TestDataFactory.getCoreCurrency('U.S. Dollar','USD', TRUE);
        LIst<appirio_core__Currency__c> coreCurrencylist = new List<appirio_core__Currency__c>();
        coreCurrencylist.add(coreCurrencyUSD);
        insert coreCurrencylist;
        
        APTS_Legal_Entity__c legalEntitySO= APTS_TestDataFactory.getLegalEntity('Japan', coreCurrencyUSD.ID, FALSE);
        legalEntitySO.APTS_LE_Company_Code__c = 'ABC';
        legalEntitySO.APTS_LE_Country__c  = 'DEF';
        insert legalEntitySO;

        Apttus_Config2__PaymentTerm__c paymentTermSO = APTS_TestDataFactory.createPaymentTerm('Net 120', 'Net 120 Days', 120 , TRUE);
        insert paymentTermSO;

        APTS_Invoice_Number_Settings__c invoiceNumberSettingSO = APTS_TestDataFactory.getInvoiceNumberSetting(legalEntitySO.ID);
        insert invoiceNumberSettingSO;

        //Create & Insert Account
        Account accSO = APTS_TestDataFactory.getAccount('Test Account');
        accSO.APTS_Global_MSA__c = TRUE;
        insert accSO;
        
        Contact contactSO1 = APTS_TestDataFactory.getContact(accSO.ID, 'Japan', 'Last1', 'Japan');
        Contact contactSO2 = APTS_TestDataFactory.getContact(accSO.ID, 'Esker', 'Last2', 'Japan');
        List<Contact> listContact = new List<Contact>();
        listContact.add(contactSO1);
        listContact.add(contactSO2);
        insert listContact;

        Apttus_Config2__AccountLocation__c accountLocationSO1 = APTS_TestDataFactory.getAccountLocation('USA Account Location', accSO.ID, 'USA');
        accountLocationSO1.Apttus_Config2__DefaultInvoiceTemplate__c = 'APTS Non Japan Invoice';
        Apttus_Config2__AccountLocation__c accountLocationSO2 = APTS_TestDataFactory.getAccountLocation('USA Account Location', accSO.ID, 'USA');
        List<Apttus_Config2__AccountLocation__c> accountLocationList = new List<Apttus_Config2__AccountLocation__c>();
        accountLocationList.add(accountLocationSO1);
        accountLocationList.add(accountLocationSO2);
        insert accountLocationList;

        Opportunity oppSO1 = APTS_TestDataFactory.getOppty(accSO.ID, 'USA Opp');
        Opportunity oppSO2 = APTS_TestDataFactory.getOppty(accSO.ID, 'USA Opp');
        List<Opportunity> oppList = new List<Opportunity>();
        oppList.add(oppSO1);
        oppList.add(oppSO2);
        insert oppList;

        Apttus_Config2__Order__c orderSo = APTS_TestDataFactory.getOrder(accSO.Id, oppSO1.ID, accountLocationSO1.ID);
        orderSo.Apttus_Config2__PaymentTermId__c = paymentTermSO.ID;
        orderSo.APTS_Invoice_Delivery_Method_Email__c = true;
        orderSo.APTS_Invoice_Delivery_Method_Print__c = true;
        insert orderSo;

        Apttus_Billing__Invoice__c invoiceSO1 = APTS_TestDataFactory.getInvoice(accSO.ID, paymentTermSO.ID);
        invoiceSO1.APTS_Legal_Entity__c = legalEntitySO.ID;
        invoiceSO1.Apttus_Billing__LocationId__c = accountLocationSO1.ID;
        invoiceSO1.APTS_Order__c = orderSo.ID;
        
        Apttus_Billing__Invoice__c invoiceSO2 = APTS_TestDataFactory.getInvoice(accSO.ID, paymentTermSO.ID);
        invoiceSO2.APTS_Legal_Entity__c = legalEntitySO.ID;
        invoiceSO2.Apttus_Billing__LocationId__c = accountLocationSO2.ID;
        invoiceSO2.APTS_Order__c = orderSo.ID;

        List<Apttus_Billing__Invoice__c> invoiceList = new List<Apttus_Billing__Invoice__c>();
        invoiceList.add(invoiceSO1);
        invoiceList.add(invoiceSO2);
        insert invoiceList;

        Apttus_Billing__CreditMemo__c creditMemoSO = APTS_TestDataFactory.getCreditMemmo(accSO.ID, invoiceSO1.ID);
        creditMemoSO.APTS_Legal_Entity__c = legalEntitySO.ID;
        creditMemoSO.Apttus_Billing__LocationId__c = accountLocationSO1.ID;
        creditMemoSO.APTS_Shipping_Location__c = accountLocationSO1.ID;
        //creditMemoSO.Apttus_Billing__Status__c = 'Approved';
        creditMemoSO.Apttus_Billing__DeliveryStatus__c = 'Pending';
        creditMemoSO.APTS_Order__c = orderSo.ID;

        List<Apttus_Billing__CreditMemo__c>creditMemolist = new List<Apttus_Billing__CreditMemo__c>();
        creditMemolist.add(creditMemoSO);
        insert creditMemolist;
        
        Attachment attachmentSO = APTS_TestDataFactory.getAttachment(creditMemoSO.ID,'CreditMemo Attachment');
        List<Attachment> listAttachment = new List<Attachment>();
        listAttachment.add(attachmentSO);
        insert listAttachment;


        Apttus_Billing__RelatedARTransaction2__c relatedARTransactionSO = APTS_TestDataFactory.getRelatedARTransaction(invoiceSO1.ID);
        relatedARTransactionSO.Apttus_Billing__TxnType__c = 'Refund';
        relatedARTransactionSO.Apttus_Billing__DestinationCreditMemoId__c = creditMemoSO.ID;
        insert relatedARTransactionSO;
        
        Test.startTest();
        Test.setCurrentPageReference(new PageReference('Page.myPage'));
        System.currentPageReference().getParameters().put('creditMemoID', creditMemoSO.ID);
        System.currentPageReference().getParameters().put('status', 'Approved');

        APTS_ResendCreditMemoEmail resendCreditMemoEmail = new APTS_ResendCreditMemoEmail();
        resendCreditMemoEmail.resendEmail();
        
        Test.stopTest();

    }
}

The error is:

Error: Compile Error: Method does not exist or incorrect signature: void getOrder(Id, Id, Id) from the type APTS_TestDataFactory at line 62

Any guidance would be most appreciated. Thank you!
 
I have a custom agreement object that is associated to a custom order object which shows up as a related list on the agreement. 

I would like to write a line of apex code that: upon save ie before update of the agreement , check the order related list, and if there is more than one order in it, then, throw an error asking the user to remove all other oder records, except for the latest one.

Only allow the user to save the record after this action is taken

Any ideas on how I can write this line of code?