• Praveen Choudhary
  • -1 Points
  • Member since 2022

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 7
I have the below line of code in my aura component. I would like to append href to include recordId. I'm currently getting an error message as below. How can I fix this?
"Cannot mix expression and literal string in attribute value, try rewriting like {!'foo' + v.bar}"

Here is the line of code:

 <a href = "https://amgenpatientservices--dev4.lightning.force.com/lightning/r/{!v.recordId}/related/Cases/view">
I am coding using Salesforce Apex and DocuSign API. Here a part of my code :
DocuSignAPI.Tab tab100 = new DocuSignAPI.Tab() ;                        
tab100.Type_x = 'Custom' ;     
tab100.RecipientID = 1 ;                           
tab100.DocumentID = 1 ;                           
tab100.PageNumber = 1 ;                           
tab100.XPosition = 40 ;                           
tab100.YPosition = 40 ;
Unfortunately, I try to use other field name like "Font, FontSize" but it is not recognized : I got this message "Variable does not exist : Font".

This is my LWC 
     <lightning-card title="" icon-name="custom:custom19">
            label="Attach receipt"
    <lightning-record-edit-form object-api-name="DMS__c" onsuccess={handleSuccess} onsubmit ={handleSubmit} >
        <div class="slds-grid">
            <div class="slds-col slds-size_1-of-2">
        <lightning-input-field field-name='Name'></lightning-input-field>
        <lightning-input-field field-name='Version__c'></lightning-input-field>
        <lightning-input-field field-name='Key_Words__c'></lightning-input-field>
        <lightning-input-field field-name='Doc_type__c'></lightning-input-field>
        <lightning-input-field field-name='Description__c'></lightning-input-field>
        <div class="slds-col slds-size_1-of-2">
            <lightning-input-field field-name='Contract_LOB__c'></lightning-input-field>
            <lightning-input-field field-name='Active_Contract__c'></lightning-input-field>
            <lightning-input-field field-name='Competitor_Contract__c'></lightning-input-field>
            <lightning-input-field field-name='Folder__c'></lightning-input-field>
        <div class="slds-clearfix">
            <div class="slds-align_absolute-center">
        <lightning-button class="slds-m-top_small" type="submit" label="Upload"  onclick={showSuccessToast}></lightning-button>
        <lightning-button class="slds-m-top_small" label="Cancel" onclick={allowReset}></lightning-button>

Thefollowing is my .js file
import { LightningElement, api } from 'lwc';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import POST from '@salesforce/apex/docUpload.POST';  
export default class Final extends LightningElement {
    @api recordId;
    get acceptedFormats() {
        return ['.pdf', '.png','.jpg','.jpeg'];
    handleUploadFinished(event) {
        // Get the list of uploaded files
        const uploadedFiles = event.detail.files;
        let uploadedFileNames = '';
        for(let i = 0; i < uploadedFiles.length; i++) {
            uploadedFileNames += uploadedFiles[i].name + ', ';
          var Name = component.get("v.Name");
            var Doc_type__c = component.get("v.Doc_type__c");
            var Active_Contract__c = component.get("v.Active_Contract__c");
            var Competitor_Contract__c = component.get("v.Competitor_Contract__c");
            var Version__c = component.get("v.Version__c");
            var Key_Words__c = component.get("v.Key_Words__c");
            var Folder__c = component.get("v.Folder__c");
            var action = component.get("c.POST");
            action.setParams({ file : uploadedFiles, Name : Name, Doc_type__c : Doc_type__c, Active_Contract__c : Active_Contract__c, Competitor_Contract__c : Competitor_Contract__c, Version__c : Version__c, Key_Words__c : Key_Words__c, Folder__c : Folder__c });
            action.setCallback(this, function(response) {
                var returnValue = response.getReturnValue();
                component.set("v.message", returnValue);
                new ShowToastEvent({
                    title: 'Success',
                    message: uploadedFiles.length + ' Files uploaded Successfully: ' + uploadedFileNames,
                    variant: 'success',
    handleSuccess(event) {
        console.log('onsuccess event ',event.detail.id)
    handleSubmit(event) {
        console.log('onsubmit event Newcomp'+ event.detail.fields);
    showSuccessToast() {
        const evt = new ShowToastEvent({
            title: 'Toast Success',
            message: 'Opearion sucessful',
            variant: 'success',
            mode: 'dismissable'
    allowReset(event) {
        const inputFields = this.template.querySelectorAll(
        if (inputFields) {
            inputFields.forEach(field => {
my apex post callout is given
public with sharing class docUpload {
    public String resBody {get; set;}          
        public static String POST(Blob file, String Name, String Doc_type__c, String Active_Contract__c, String Competitor_Contract__c, String Version__c, String Key_Words__c, String Folder__c) {
            Http h = new Http();
    //    String fileName = 'leads.csv';
            String url = 'https://csv-file-upload.herokuapp.com/leads/' + recordId;
            String separationString = 'da5cbc76-39ba-4f80-8b81-090b82e90cf0';
            String str = file.toString();
       //     String csvBody = EncodingUtil.base64Encode(csvBlob);
            // decode 
            Blob decodedBlob = EncodingUtil.base64Decode(str);
            system.debug('string ==>'+decodedBlob);
            // convert to string
            String result = decodedBlob.toString();
            // assemble the body payload
            String header = '--' + separationString + '\nContent-Disposition: form-data; name="file"; filename="' + fileName + '"\nContent-Type: application/octet-stream\n\n';
            //String body = EncodingUtil.base64Encode(file) + '\n';
            String body = result + '\n';
            String footer = '--' + separationString + '--';
            String bodyPayload = header + body + footer;
            system.debug('PAYLOAD: ' + bodyPayload);
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-Type', 'multipart/form-data; boundary=' + separationString);
            system.debug('REQUEST: ' + req);
            // Send the request, and return a response
            HttpResponse res = h.send(req);
            return res.getBody();

My apex code doesn't not increment the count. Can't find out Why.
Could someone help?
Apex class:
public class FeedItemTriggerHandler {
    public static void countFeedItem(List<FeedItem> lstFeed){ 
        set<id> relatedCasesIds = new set<id>();
        for(FeedItem fd : lstFeed) {
            if (fd.type =='TextPost')relatedCasesIds.add(fd.ParentId);
        Map<Id, case> relatedCases = new Map<Id, case> ([Select id, caseNumber,All_Users_Feed_Count__c FROM case where id in: relatedCasesIds]);
       	List<case> casesToUpdate = new List<case>(); 
        integer count = 0;
        for(case c:relatedCases.values()) {
           for(FeedItem fd : lstFeed) {
               if (fd.type =='TextPost' && fd.Visibility =='AllUsers' && fd.ParentId == c.id) {
            c.All_Users_Feed_Count__c = count;
            count = 0;
        if(casesToUpdate.size() > 0) update casesToUpdate; 
trigger FeedItemTrigger on FeedItem (after insert,before delete) {
    } else if(Trigger.isBefore){

We’re a SaaS company that builds platforms for our clients, and we’ve recently integrated with your API to allow our clients to send data from our platform into their own Salesforce instance.
Before connecting, we ask clients to provide us with their version number, object they’d like to connect to, and ID object so that we can match platform users to those in Salesforce. We then pull this data into the API call and send it to Salesforce. This works for all our clients, except one.
We are now trying to help one of our clients connect and coming across the following error: [{salesforce sync HTTP Method 'PATCH' not allowed. Allowed are HEAD,GET,POST"}]
The client has confirmed that the version number, object and ID are correct, but continue to get this error.

Does anyone have any ideas?
Hi Devs,

How do we something simple like below in SOQL.


These boards have numerous threads about sending emails from s-controls.  Having just wrestled with a variant of the problem for a customer, I thought I'd post the solution I used, which (now!) seems fairly straightforward (although it took some bobbing & weaving to get here).

Problem Statement
:  With one click, allow a user to create an object, then send a template-based email to a Contact associated with that object.  The email template must populate with correct values from the just-created object.

Solution:  Save the following code as an s-control snippet.  Then include the snippet, and call the function from anywhere in your main s-control.  (I won't cover the part about creating a new object here - let's assume you can do that, and then retrieve the object ID of your newly created object.)

function sendEmail(templateId, contactIdForToAddress, relatedObjectId) {

  var url = "https://na3.salesforce.com/email/author/emailauthor.jsp?";
  url += "p2_lkid=" + contactIdForToAddress;
  url += "&p3_lkid=" + relatedObjectId;
  url += "&template_id=" + templateId;
  url += "&new_template=1";
  url += "&retURL=%2F" + relatedObjectId;
  url += "&nosave=0";   // not sure what this parameter does, or if it's really needed
  url += "&save=1";   // send it now - don't just bring us to the "send email" page


The net effect here is that a new window (actually, a tab in Firefox) will open up, pointing at the newly created object.  If it has an Activity History related list, the just-sent email will appear there. 

This all worked rather elegantly for me.  The actual use case is a Google Map showing the location of various Communities (a custom object).  The user can select several Communities (from a sidebar with a list of accounts & checkboxes), then click a single button to create "Referrals" (a custom object) to each selected Community, and email each Community's primary contact with their Referral data.  After the click, the user waits a moment, and then multiple tabs open up, one for each newly-created Referral.

I'm happy to discuss further if anyone is interested or needs help doing something similar - glenn@appirio.com.

Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM

Message Edited by GlennAtAppirio on 02-18-2007 01:05 PM