• satish090
  • NEWBIE
  • -5 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
for(Apttus_Billing__Invoice__c invoice:invoiceObjectList1) // loop over invoices
              {
                  List<InvoiceLineItems> listToStoreLineItems = new List<InvoiceLineItems>();
                  APTS_InvoiceJournalWrapper invoiceJournWrapper= new APTS_InvoiceJournalWrapper();
                   countHeader=0;
                   
                   count=count+1;
                  Decimal Sum=0;
                   
                                    invoiceJournWrapper.id=String.valueof(invoice.id);
                                    invoiceJournWrapper.HeaderKey=String.valueof(count);
                                    invoiceJournWrapper.ZCurrency=(invoice.CurrencyIsoCode!=null?invoice.CurrencyIsoCode:'USD');
                                    //invoiceJournWrapper.AccountingJournal='null';
                                    invoiceJournWrapper.AccountingJournalID=String.valueOf(invoice.Name + '_' +myDate);
                                    invoiceJournWrapper.JournalNumber=String.valueOf(invoice.Name + '_' +myDate);
                                    invoiceJournWrapper.ExternalReferenceID=String.valueOf(invoice.Name);                  
                                    invoiceJournWrapper.AccountingDate=String.valueof(Date.valueof(invoice.Apttus_Billing__InvoiceDate__c));
                  //-------------------
                  list<Apttus_Billing__InvoiceLineItem__c> invlineitems=[Select id,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__ProductId__r.ProductCode,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__OptionId__r.ProductCode,Apttus_Billing__InvoiceId__r.Name,Apttus_Billing__ProductId__r.Name,Apttus_Billing__InvoiceId__r.CurrencyIsoCode,
                                                                      Apttus_Billing__Type__c,Apttus_Billing__InvoiceId__c,Name,Apttus_Billing__Amount__c,Apttus_Billing__SoldToAccountId__r.EQ_ClientRef__c,Apttus_Billing__LocationId__c,
                                                                      Apttus_Billing__ProductId__r.EQ_FeeCode__c,Apttus_Billing__BillToAccountId__r.EQ_ClientRef__c,Apttus_Billing__ProductId__r.ProductCode,Apttus_Billing__InvoiceId__r.EQ_TotalInvoiceAmount__c 
                                                             from Apttus_Billing__InvoiceLineItem__c where Apttus_Billing__InvoiceId__c=:invoice.id and Apttus_Billing__Type__c='Contracted' and Apttus_Billing__Amount__c!=0];
                  //----
                  //
                  //-------------
                   InvoiceLineItems FirstInvItems= new InvoiceLineItems();
                            countHeader=countHeader+1;
                            FirstInvItems.LineKey=string.valueof(countHeader);

 
I have a requirement to share a note with multiple accounts. My first issue I was trying to solve is being able to store the notes data in variables then create new records based off that data. I have a trigger on ContentDocumentLink that passes info off to a class. 

Problem is, if I save the note before it auto saves, everything works. If I let the record auto save, I dont get the body of the note. 
 
trigger trasnferNotes on ContentDocumentLink (after insert) {
    
    string relatedID;
    String documentID;
    
    //Get the current ID for the note
    if (Trigger.isAfter) {
        if (Trigger.isInsert) {
            for(ContentDocumentLink cdl : Trigger.New) {
                relatedID = cdl.LinkedEntityId;
                documentID = cdl.ContentDocumentId;
                transferNotesClass db = new transferNotesClass(relatedID, documentID);
            }
        }
    }
    
}
 
global class transferNotesClass {
    
    global String noteID;
    global String contentDocumentID;
    global String cvID;
    
    global transferNotesClass(String relatedID, String documentID) {
        
        try {
            
            noteID = relatedID;
            contentDocumentID = documentID;
            
            System.debug('Class Note ID: ' + noteID);
            
            
            //Getting the ID from ContentVersion
            List<ContentVersion> cv = New List<ContentVersion>([select id from ContentVersion 
                                                                where ContentDocumentId = :contentDocumentID]);
            for(ContentVersion cv1 : cv) {
                cvID = cv1.Id; 
            }
            
            //Getting the Content Note by passing the above ID to ContentNote
            List<ContentNote> contNote = New List<ContentNote>([select Content, ContentSize, CreatedById, CreatedDate, FileExtension, FileType, 
                                                                Id, IsDeleted, IsReadOnly, LastModifiedById, LastModifiedDate, LastViewedDate, 
                                                                LatestPublishedVersionId, OwnerId, SharingPrivacy, TextPreview, Title 
                                                                from ContentNote where LatestPublishedVersionId = :cvID]);
            
            for(ContentNote contNote1 : contNote) {
                Blob contentBlob = contnote1.Content;
                String contentString = contentBlob.toString();
                List<String> csvFileLines= contentString.split('\n');
                system.debug(csvFileLines);
                System.debug('Note Title: ' + contNote1.Title);
                //System.debug('Note Content: ' + csvFileLines);
            }
            
        }
        
        catch(DmlException e) {
            System.debug('The following exception has occurred: ' + e.getMessage());
        }
        
    }
    
}

 
Hi All,
Help me on this, i want using validation rule "Dealer user cannot save if the selected picklist value in Status field in "Inquiry" record type in Case is "Uploaded".