• Badal Shinde
  • NEWBIE
  • 20 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I want to create contact record using existing account Id in Aura lightning table ? and I want save a row separately in on submit button it perform bulk insert ?

the Output look like this

Controller Code:-

addRowController : function(component, event, helper) { var contactList = component.get("v.contactList"); contactList.push({ 'sobjectType': 'Contact', 'FirstName': '', 'LastName': '', 'Phone': '', 'Email': '', }); component.set("v.contactList", contactList); // component.set("v.showTableFlag", true); }, saveContactController : function(component, event, helper) { var action = component.get("c.saveContactList"); var objId = event.currentTarget.dataset.id; alert('aya'); action.setParams({"conList": component.get("v.contactList"), objId}); action.setCallback(this, function(response) { if (response.getState() === "SUCCESS") { //set empty contact list component.set("v.contactList", []); alert('Contact saved successfully'); } }); $A.enqueueAction(action); }

Apec Class:-

 @AuraEnabled
public static boolean saveContactList(string objId){ Contact objCon = New Contact (id = objId); if(objCon != null){ insert objCon; return true; }else{
return false;
}
}
I wanted to try pass the object Name and thier related query by using design attribute and show the records on app page but I have no idea how to do this. please help me.

User-added image

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" > <aura:attribute name="objectName" type="String" /> <aura:attribute name="Query" type="String" /> <aura:handler name="init" action="{!c.doInit}" value="{!this}"/> <lightning:card> test </lightning:card> </aura:component>

<design:component> <design:attribute name="objectName" Label="Object Name"/> <design:attribute name="Query" Label="Query"/> </design:component>

 
This is the request message:
<?xml version="1.0" encoding="utf-8"?>   
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:urn="urn:enterprise.soap.sforce.com">
  <soapenv:Header>
     <urn:SessionHeader>
        <urn:sessionId>
        00D5i0000014B8m!ARYAQLtoOXETtcvv2z3WkG32psiIiDDY8yJY1vHjTEZnVuT1NxbGarPJYtsLiPTHq3_U3jYLCcq6JvFggdaM2XXClEGIpA9h
        <urn:sessionId>
     </urn:SessionHeader>
  </soapenv:Header>
  <soapenv:Body>
     <urn:query>
        <urn:queryString>SELECT id,Name FROM Account </urn:queryString>
     </urn:query>
  </soapenv:Body>
</soapenv:Envelope>

This is the response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Client</faultcode>
            <faultstring>Unexpected element {urn:enterprise.soap.sforce.com}sessionId during simple type deserialization</faultstring>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>
I am trying to create a trigger that will count activities (tasks) on leads.
My code is below....

When saving I am getting the following error....

Error: Compile Error: unexpected token: '}' at line 30 column 1

But if I remove the curly bracket I get a different error

Error: Compile Error: unexpected token: '<EOF>' at line 30 column 0


trigger TaskUpdateLead on Task (after delete, after insert, after undelete, after update)
{
Set<ID> LeadIds = new Set<ID>();

//We only care about tasks linked to Leads.

String leadPrefix = Lead.SObjectType.getDescribe().getKeyPrefix();

//Add any Lead ids coming from the new data

if (Trigger.new != null) {
    for (Task t : Trigger.new) {
     if (t.WhatId != null && string.valueOf(t.whatId).startsWith(leadprefix) )
         {LeadIds.add(t.whatId);
      }
   }
}
//Also add any Lead ids coming from the old data (deletes, moving an activity from one Lead to another)

if (Trigger.old != null) {
    for (Task t : Trigger.old) {
     if (t.WhatId != null && String.valueOf(t.whatId).startsWith(leadprefix) )
         { LeadIds.add(t.whatId);
      }
   }
}
if (LeadIds.size() > 0)

Lead.Activity_Count__c.updateLeadCount<LeadIds>
}


Any guidance is very much appreciated.