• Sarava
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 14
    Replies
As salesforce is making changes to the URL format for lightning experience as below
Current format: https://{lightning.domain.com}/one/one.app/#/sObject/Account/home
New format: https://{lightning.domain.com}/lightning/o/Account/home

I am wondering how to change the below URL format to support the lightning experience.
https://na**.salesforce.com/one/one.app#eyJjb21*****etc.,

I have tried various options but did not work. Any help or thoughts?

Thanks!
  • April 19, 2018
  • Like
  • 0
I am working on sending an email with the opportunity files based on certain criteria. I am able to send an email with the 'versionData' as an email body which is queried from 'Contentversion'. 
Problem: When i try to open the attachment from email it says 'Preview not available' and also i am not able to open the downloaded attachment too.
Please find the code below and let me know where I am going wrong. Thanks!
List<id> ContentDocumentids = new List<id>();

for(contentDocumentLink CDLink : [SELECT LinkedEntityid, ContentDocumentid FROM contentDocumentLink WHERE LinkedEntityid=:'Object id'])
                {
                   ContentDocumentids.add(CDLink.ContentDocumentid);  
                }
                for ( ContentVersion cversion : [SELECT title, 
                                                        PathOnClient, 
                                                        versiondata 
                                                  FROM contentversion 
                                                  WHERE ContentDocumentId IN :ContentDocumentids  
                                                   AND title LIKE 'WOCF%'])
                 {
                  blob WOCFbody = cversion.versiondata;
                  system.debug('body : '+WOCFbody+'-----------'+cversion.title);
                  Messaging.Emailfileattachment efa1 = new Messaging.Emailfileattachment();
                  efa.setFileName(war2.opportunity__r.name+'-'+cversion.title);
                  efa.setBody(WOCFbody);
                  fileAttachments.add(efa); 
                 }

 
  • March 14, 2018
  • Like
  • 0
There are four templates. I want to generate Quote document for each Template whenever the Status on the SBQQ__Quote__c object changes. I have the  
generateDocument(String language, String quoteId, String templateId, String documentName, String outputFormat, List documentIds) and  saveProposal(String language, String quoteId, String templateId, String documentName, String outputFormat, List documentIds) class inside the template loop but only one document is getting saved.
The loop is running four times.
I assume the value for SBQQ__key__c is holding the same ID since the second loop runs before the 1st job gets completed.
Below is my code and the error on APEX job
list<SBQQ__QuoteTemplate__c> templateLst = [SELECT Name, id 
                                                    from SBQQ__QuoteTemplate__c     ];                                          
        
        for (SBQQ__Quote__c QuoteRec : QuoteLst)
        {
            for (SBQQ__QuoteTemplate__c TemplateRec :templateLst ) // Four Records from Template object
            {
                List<id> documentIds 	= new List<id>(); 
                id jobId = SBQQ.QuoteDocumentController.generateDocument ('en_US', 
                                                                          QuoteRec.Id, 
                                                                          TemplateRec.id, 
                                                                          'DocumentName', 
                                                                          'PDF', 
                                                                          documentIds);
                system.debug('Doc Id size: '+documentIds.size()); //Size 0 for all 4 loops
                documentIds.add(QuoteRec.Id);
                system.debug('Doc Id size: '+documentIds.size()); //Size 1 for all 4 loops
                
                jobId = SBQQ.QuoteDocumentController.saveProposal ('en_US', QuoteRec.Id, TemplateRec.id, 'DocumentName', 'PDF', documentIds);
            }
        }

Error I am getting for the second Document : Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SBQQ__Key__c duplicates value on record with id: XXXXXXXXXXXXXX: []

How can I overcome this problem? 

Thanks!
  • March 02, 2018
  • Like
  • 0
I am working on sending an email with the opportunity files based on certain criteria. I am able to send an email with the 'versionData' as an email body which is queried from 'Contentversion'. 
Problem: When i try to open the attachment from email it says 'Preview not available' and also i am not able to open the downloaded attachment too.
Please find the code below and let me know where I am going wrong. Thanks!
List<id> ContentDocumentids = new List<id>();

for(contentDocumentLink CDLink : [SELECT LinkedEntityid, ContentDocumentid FROM contentDocumentLink WHERE LinkedEntityid=:'Object id'])
                {
                   ContentDocumentids.add(CDLink.ContentDocumentid);  
                }
                for ( ContentVersion cversion : [SELECT title, 
                                                        PathOnClient, 
                                                        versiondata 
                                                  FROM contentversion 
                                                  WHERE ContentDocumentId IN :ContentDocumentids  
                                                   AND title LIKE 'WOCF%'])
                 {
                  blob WOCFbody = cversion.versiondata;
                  system.debug('body : '+WOCFbody+'-----------'+cversion.title);
                  Messaging.Emailfileattachment efa1 = new Messaging.Emailfileattachment();
                  efa.setFileName(war2.opportunity__r.name+'-'+cversion.title);
                  efa.setBody(WOCFbody);
                  fileAttachments.add(efa); 
                 }

 
  • March 14, 2018
  • Like
  • 0
There are four templates. I want to generate Quote document for each Template whenever the Status on the SBQQ__Quote__c object changes. I have the  
generateDocument(String language, String quoteId, String templateId, String documentName, String outputFormat, List documentIds) and  saveProposal(String language, String quoteId, String templateId, String documentName, String outputFormat, List documentIds) class inside the template loop but only one document is getting saved.
The loop is running four times.
I assume the value for SBQQ__key__c is holding the same ID since the second loop runs before the 1st job gets completed.
Below is my code and the error on APEX job
list<SBQQ__QuoteTemplate__c> templateLst = [SELECT Name, id 
                                                    from SBQQ__QuoteTemplate__c     ];                                          
        
        for (SBQQ__Quote__c QuoteRec : QuoteLst)
        {
            for (SBQQ__QuoteTemplate__c TemplateRec :templateLst ) // Four Records from Template object
            {
                List<id> documentIds 	= new List<id>(); 
                id jobId = SBQQ.QuoteDocumentController.generateDocument ('en_US', 
                                                                          QuoteRec.Id, 
                                                                          TemplateRec.id, 
                                                                          'DocumentName', 
                                                                          'PDF', 
                                                                          documentIds);
                system.debug('Doc Id size: '+documentIds.size()); //Size 0 for all 4 loops
                documentIds.add(QuoteRec.Id);
                system.debug('Doc Id size: '+documentIds.size()); //Size 1 for all 4 loops
                
                jobId = SBQQ.QuoteDocumentController.saveProposal ('en_US', QuoteRec.Id, TemplateRec.id, 'DocumentName', 'PDF', documentIds);
            }
        }

Error I am getting for the second Document : Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SBQQ__Key__c duplicates value on record with id: XXXXXXXXXXXXXX: []

How can I overcome this problem? 

Thanks!
  • March 02, 2018
  • Like
  • 0
The below code used to work.  Now it doesn't.  Anyone know why?
List<id> documentIds = new List<id>();
id templateId = 'template id here';
id quoteId = 'quote id here';

id jobId = SBQQ.QuoteDocumentController.generateDocument('en_US', quoteId, templateId, 'Proposal.pdf', 'PDF', documentIds);

documentIds.add(quoteId);

jobId = SBQQ.QuoteDocumentController.saveProposal('en_US', quoteId, templateId, 'Proposal.pdf', 'PDF', documentIds);
The below code used to work.  Now it doesn't.  Anyone know why?
List<id> documentIds = new List<id>();
id templateId = 'template id here';
id quoteId = 'quote id here';

id jobId = SBQQ.QuoteDocumentController.generateDocument('en_US', quoteId, templateId, 'Proposal.pdf', 'PDF', documentIds);

documentIds.add(quoteId);

jobId = SBQQ.QuoteDocumentController.saveProposal('en_US', quoteId, templateId, 'Proposal.pdf', 'PDF', documentIds);