0

I have a conga pdf generated via the conga composer. The issue is that when the file name contains Sample&Company in the invoice record in Salesforce, it clips the rest of the characters after the & symbol and I get the output as Sample.

We recently updated the conga package to incorporate DocuSign functionality but it is causing this issue in the latest version. When checked with Conga support, they were able to fix it for the Conga composer button and asked us to use SUBSTITUTE function to replace & with %26 but when the same is achieved using apex with the help of replace string function, the characters after & are getting clipped.

Here is the below code where the parameter OFN is used for the output file name. How to ensure that the characters after & are not clipped and appear as Sample&Company?

Apex:

        if(invoiceName.contains('&')){
            invoiceName = invoiceName.replace('&', '%26');
        }
        
        if(emailBody.contains('&')){
            emailBody = emailBody.replace('&', '%26');
        }
        if(outputFieldName.contains('&')){
            outputFieldName = outputFieldName.replace('&', '%26');
        }
        //redirect url for conga.
        url = url+'&Id=' + invoiceId + '&TemplateId=' + template + '&QueryId=' + congaQueryId +
            '&OFN='+outputFieldName+
            '&DefaultPDF=1'+
            '&CurrencyCulture='+ congacurrency+
            '&DocuSignVisible=1' +
            '&DocuSignR1Name='+ signatoryName +
            '&DocuSignR1Email=' + signatoryEmail +
            '&DocuSignR1Type=Signer' +
            '&DocuSignR1Role=Signer+1' +
            '&DS7=17' +
            '&DocuSignEndPoint=Prod'+
            '&DocuSignEmailSubject=' + invoiceName.replace(' ', '+') + 
            '&DocuSignEmailBody=' + emailBody.replace(' ', '+') + 
            '&ReturnPath=lightning/n/Return_Url_For_Docusign?invoiceid='+invoiceId+'&index='+index;
        system.debug('url'+url);
        return url;  
1
  • so what appears in the line system.debug('url'+url); ?
    – cropredy
    May 6 at 1:54
0

I found the solution. The & character in Conga is a reserved keyword. After substituting & with {~~~} in apex, the issue is resolved and the & is shown and the characters are not clipped.

Here is the documentation explaining the same: https://documentation.conga.com/composer/winter-20/replace-ampersands-in-reference-field-data-143199341.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.