• prasanth sfdc
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 22
    Replies
I have a fresh salesfroce CPQ developer org, In order object i am not able to find the "Bill Now" check box as mentioned in the below article. I am trying to generate Inovice for the activated Order. Kindly help me on this. 

Please refer the point No.2 in the below article. 

https://help.salesforce.com/s/articleView?id=sf.blng_manually_invoice_order.htm&type=5
WE are using saleforce maps module. The seach box is visible at maps tab and not displaying account's related list record page. User-added image

We need to display the above search box in the below page also. (account record page)


User-added image
Hi,
  I am facing this issue.  Once i sent email to a person (x@gmail.com) in case record from "Email" quick action then if i click on again "Email" quick action the "To address" is autopoluating the email address which i have already sent mail earlier (x@gmail.com). Is there any way to remove this cache issue ? . Please help. Even after refreshing the case record page also this "To address" is not getting empty.

I have tried with new Email quick action with predefined field at To address like "custom_email__c" but, even the "custom_email__c" is changing the value then the "To address" in email action is not changing. Kindly help. 

User-added image
Hi, 
 I have custom field called Email__c and marked it as Unique . 
When i insert lead using some apex logic with duplicate Email__c then it shows error in debug log like 
 
duplicate value found: Email__c duplicates value on record with id: 00Q1700000DfdUO;

But when insert the duplicate lead from test calss then giving the below output. 
 
duplicate value found: <unknown> duplicates value on record with id: <unknown>;

How to get Email__c in the place of "<unknown>" in test class. Please help. Due to this i am not able to cover some lines of code. 

Main class code here. 
in the below code not enteringing into if statement because of "<unknown>" is coming instead of "Email__c"
for (Database.Error dbE : errorList) {
            //handle duplicate applicant
            system.debug('the sai 1st outside:'+dbE+'....'+dbE.getStatusCode()+'....'+System.StatusCode.DUPLICATE_VALUE);
            if((dbE.getStatusCode() == System.StatusCode.DUPLICATE_VALUE && dbE.getMessage().contains('Email__c') )) {
             system.debug('the sai 1st inside:'+dbE.getMessage());
                String dupId = dbE.getMessage();
                
                    dupId = dupId.substringAfter('Prospect_UUID__c duplicates value on record with id: ');
                
                errList.add(handleDuplicateUUIDApplicant(dupId, NULL, leadRec.Email__c));
            }

 
Hi, 
I am following the below article for "auto generate Swagger Documentation for API". But not able to complete it. Downloaded the Apex Swagger dependent files from https://editor.swagger.io/, after this step not able to find how to auto generate Swagger documentation files in SFDC for my APIs.  

https://developer.salesforce.com/blogs/2018/04/connecting-to-swagger-backed-apis-with-clicks-or-code

Please help me to auto generate API's documentation
I am following this trail head module for "External Servive" where they have mentioned about swagger and outbound integration, but not able to find the inbound integration.  Please help me to to find some documentation for this. 

https://trailhead.salesforce.com/en/content/learn/modules/external-services/use-external-services-in-a-flow
To connect with swagger for my custom rest api endpoints I am following the below document.  Please let me know if any has clear steps to implement. 

I am following the below link to setup swagger codegen from vs code. 
https://developer.salesforce.com/blogs/2018/04/connecting-to-swagger-backed-apis-with-clicks-or-code

step 1:- success . runned
"sfdx plugins:install muenzpraeger-sfdx-plugin"  . 

step2:- falied. 
"
sfdx muenzpraeger:swagger:import -p http://petstore.swagger.io/v2/swagger.json -d /Users/rwinkelmeyer/Development/testApex"

User-added image
In case trigger code, I have the below logic,  When more than 3 email to cases are creating at same time (creating under same Account record), I am getting this error.  Please help me to solve this. 

even error is coming, the cases are created and updated sucessfully. 

This  logic in after insert/ update section of trigger. 
if ( newCase.RecordTypeid == RecordTypeHelper.CASES.GENERAL is &&
            String.isNotBlank(settings.Site_Url__c)
        ) {
            Case clonedCase = new Case(Id = newCase.Id);
            String uuId = ApexUtils.encodeValue(newCase.Id);
            clonedCase.SecureUpload_Link__c = settings.Site_Url__c + '?hashCode=' + uuId;
            casesToUpdate.add(clonedCase);
        }
    

try{
if (!casesToUpdate.isEmpty()) {
   update casesToUpdate;
  }
} catch(Exception e) {
            ApexUtils.notifyError(e);
        }

 
I am trying to get the data PDF file from REST API, while storing it into the attachment object as PDF it is showing the empty PDF pages, kidnly help me to solve this issue. 

Note:- Encodeutil decode and encode not wokring while attachment creating converting the response,getBody() into attachment. 
 
string url = AWSUtility.viewS3Object('a1h0n00000187sc');
system.debug('The url is:' + url);

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(url);
request.setMethod('GET');
request.setHeader('Content-Type', 'application/pdf'); 
request.setHeader('Content-Encoding', 'UTF-8');
//req.setHeader('Content-Disposition', 'attachment; filename=' + fileName);
//req.setHeader('Connection', 'keep-alive');

HttpResponse response = http.send(request);
system.debug('The response is :' +response.getBody());
attachment att = new attachment();
att.parentId = 'a1h2g000000I1IN';
att.Name = 'Testing Raja2.pdf';
att.contentType = 'application/pdf'; 

att.body = blob.valueof(response.getBody());

//att.body = EncodingUtil.Base64Decode(response.getBody());
//att.body = EncodingUtil.base64Decode(response.getBody());
//att.body = EncodingUtil.base64Decode(blob.valueof(response.getBody()));
//att.body = EncodingUtil.base64Encode(blob.valueof(response.getBody()));
insert att;  (// attachment is getting created but, all empty pages only).

 
I am trying to get PDF attachment from amazon s3 into salesforce, While converting into Base64 i am getting this error. 

Error is thorwing in the last line dubug statment as below. 
Line: 5, Column: 1 System.StringException: Unrecognized base64 character: %

 
string url = AWSUtility.viewS3Object('a1h01000000Hk1r');
system.debug('The url is:' + url);

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(url);
request.setMethod('GET');
HttpResponse response = http.send(request);
system.debug('The response is :' +EncodingUtil.base64Decode(response.getBody()));

and i have tried like this also for the last debug like but, not working
Line: 15, Column: 1
System.JSONException: Unexpected character ('%' (code 37)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

Please help me to solve this. 
Hi,
  I am getting this error if i run the test class. Kindly help me to solve this, i tried for around 4 hours to solve this but, not to do.

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out
 
@isTest
private class ProjectCalloutServiceTest {

 @testSetup
  public static void setupData() {
         // ProjectCalloutServiceTestData testdata = new ProjectCalloutServiceTestData();
         account acc = new account(name='testing acc');
        insert acc;
        opportunity opp1 = new opportunity(name='testing',closedate=date.today(),amount=200,accountid=acc.id,StageName='closed won');
        insert opp1;
        
        ServiceTokens__c token= new ServiceTokens__c(name='ProjectServiceToken',Token__c='a9b50c09-a94b-4826-9aa6-64407574cad6');
        insert token;
        
  
  }
   @istest 
   public static void testPostCallout() {
        list<id> oppidslst = new list<id>();
        for(opportunity opp:[select id,name from opportunity where accountid!=null])
        {
        oppidslst.add(opp.id);
        }
        
        
         Test.startTest();
      Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMock());  
                       
        
    ProjectCalloutService.postOpportunityToPMS(oppidslst);
    Test.stopTest();
    }
}

 
Hi,
  I am displaying map in lightning component using lightning:map tag. on click of the address at the left side i am not able to get the address information in javscript controller.  Please help me to sort this. 
 
<lightning:map mapMarkers="{!v.mapMarkers}" zoomLevel="{!v.zoomLevel}"  onclick="{!c.onclickofMap}" />
 
onclickofMap:function(component,event,helper)
    {
      //  alert('The event is:'+JSON.stringify(event));
       // var locationNameVal =  event.getParam("v.value");
      //  var temp =  component.find("mapvals").get("v.value");      
        //  var id = event.currentTarget.dataset.id; //it will return thisDiv
  //  var getTargetedButton = component.find(id); //it will return the source button

        var res = null ;
        var oTarget = event.target ;
        if (oTarget.attributes[title] != null)
        {  
            alert('The oTarget is:' +oTarget);
            res = oTarget.attributes[title].value;
         
        }
        else
        {
            for (var i = 0; i < oTarget.attributes.length; i++)
            {
                if (oTarget.attributes[i].name === title)
                    res = oTarget.attributes[i].value;
                 alert('coming here: '+res+'.....');
            }
        }
       
    }

User-added imageUser-added image
I am trying to display 100 locations address from cutom object to Lightning:map tag, its showing only first 11 addresses plotting on the map.  Is there any limitation for this lightning:map tag ?

Please help to solve this. 

I have followed this link to create component. 
http://sfdcmonkey.com/2018/09/16/mark-locations-google-map-salesforce-lightning/User-added image
I have trigger the below simple trigger to add BCC address dynamically, but its not firing to email. It is showing in the debug log about the added email address . Please help to solve this. 
 
trigger EmailMessage_Trigger on EmailMessage (before insert) {
    
       // EmailMessage_Trigger_Helper.emailMessage(Trigger.New);
     
     for(EmailMessage emsg : Trigger.New){
         if (emsg.Incoming==false && emsg.Status == '3') 
         {
             emsg.BccAddress ='saiprasanth123@gmail.com';  
             emsg.CcAddress ='saiprasanth1234@gmail.com';
           system.debug('coming sai inside:'+emsg.CcAddress+'....'+emsg.FromAddress);

         }
           system.debug('coming sai outside:'+emsg);
     }
}


Thanks,
Sai.
I am trying to integrate with Indian postal department data.  I am getting the below error from VF page code.   Please help me to solve this. 

System.JSONException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]
Error is in expression '{!submit}' in component <apex:commandButton> in page postacodeapi: Class.System.JSON.deserialize: line 15, column 1
Class.fromJSON.parse: line 23, column 1
Class.postacodeAPIClass.submit: line 30, column 1


 
//
//Generated by AdminBooster
//

public class fromJSON{
    public String Message;  //Number of Post office(s) found: 11
    public String Status;   //Success
    public cls_PostOffice[] PostOffice;
    class cls_PostOffice {
        public String Name; //Addanki Gate
        public String Description;  //
        public String BranchType;   //Sub Post Office
        public String DeliveryStatus;   //Non-Delivery
        public String Taluk;    //Ongole
        public String Circle;   //Ongole
        public String District; //Prakasam
        public String Division; //Prakasam
        public String Region;   //Vijayawada
        public String State;    //Andhra Pradesh
        public String Country;  //India
    }
    public static fromJSON parse(String json){
        return (fromJSON) System.JSON.deserialize(json, fromJSON.class);
    }

   
}
 
public class postacodeAPIClass {
public string pcode{set;get;}
public string result{set;get;}
public integer scode{set;get;}
public string status{set;get;}
public List<fromJSON> wrapList{set;get;}
public void submit()
{


wrapList = new list<fromJSON>();

http p=new http();
httprequest req=new httprequest();
 req.setendpoint('http://postalpincode.in/api/pincode/'+pcode);
//req.setendpoint('http://facebook.com');
req.setmethod('GET');
httpresponse res=new httpresponse();
res =p.send(req);

result=res.getbody();

 
// result = '[{"Name":"Addanki Gate","Description":"","BranchType":"Sub Post Office","DeliveryStatus":"Non-Delivery","Taluk":"Ongole","Circle":"Ongole","District":"Prakasam","Division":"Prakasam","Region":"Vijayawada","State":"Andhra Pradesh","Country":"India"},{"Name":"Dcp(O)","Description":"","BranchType":"Sub Post Office","DeliveryStatus":"Non-Delivery","Taluk":"Ongole","Circle":"Ongole","District":"Prakasam","Division":"Prakasam","Region":"Vijayawada","State":"Andhra Pradesh","Country":"India"}]';
scode=res.getstatuscode();
status=res.getstatus();

   //  wrapList  = (List<fromJSON>)System.JSON.deserialize(result, list<fromJSON>.class);
  //fromJSON fromJSON2  = (fromJSON)System.JSON.deserialize(result,fromJSON.class);
 fromJSON wrapList = fromJSON.parse(res.getbody());

}

  
      
      
      

}

 
I am calling the below class from the lighting component OR form devloper console and i am getting the same error in the debug log. Kindly help me to sort this. Response body is coming and when I am deserilizing the error is coming.  please help to sort this.

Debug log error message.
public class ApiCallLightningComponent {
 /*
 * @Name : - fetchUserSessionId
 * @Description: - Call the VF page and get the Log In Use Session Id
 * @Params : - none
 * @ReturnType : - String
 */
 public static String fetchUserSessionId(){
 String sessionId = '';
 // Refer to the Page
 PageReference reportPage = Page.GetSessionIdVF;
 // Get the content of the VF page
 String vfContent = reportPage.getContent().toString();
 System.debug('vfContent '+vfContent);
 // Find the position of Start_Of_Session_Id and End_Of_Session_Id
 Integer startP = vfContent.indexOf('Start_Of_Session_Id') + 'Start_Of_Session_Id'.length(),
 endP = vfContent.indexOf('End_Of_Session_Id');
 // Get the Session Id
 sessionId = vfContent.substring(startP, endP);
 System.debug('sessionId '+sessionId);
 // Return Session Id
 return sessionId;
 }
 /*
 * @Name - makeAPICall
 * @Description - Responsible for making API Call out
 * @params - None
 * @ReturnType - String
 */
 @AuraEnabled
 public static list<accountwrapper> makeAPICall(){
 String sessionId = fetchUserSessionId();
 HTTP h = new HTTP();
 HTTPRequest req = new HTTPRequest();
 HttpResponse resp = new HttpResponse();
 req.setMethod('GET');
 req.setHeader('Authorization', 'Bearer ' + sessionId);
     system.debug('coming here 1');
 req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v41.0/query?q=Select+Id,+Name+From+Account');
 resp = h.send(req);
 System.debug('#### Response Status '+resp.getStatus());
 System.debug('#### Response Status Code '+resp.getStatusCOde());
 System.debug(resp.getBody());
    list<accountwrapper> accountwrapperList = new list<accountwrapper>();
    //  string temp = string.valueof(resp.getBody()).substringAfter('"records":');
      system.debug('the response:'+resp.getBody());
    // system.debug('the temp is:'+temp);
     accountwrapperList = (list<accountwrapper>)system.json.deserialize(resp.getBody(), list<accountwrapper>.class);
     // return JSON.serialize(resp.getBody());
     system.debug('The accountwrapperList is :'+accountwrapperList);
      return accountwrapperList;
 } 
    
    public class accountwrapper{
       @AuraEnabled public string Id;
       @AuraEnabled public string Name;
    }
}

 
Hi,
    I have written rest api code (http Get) method for capturing lead information from external system. I have rested the api, it is working good. But duing the test class i am getting NULL values for parameters. Kindly help me on this. 

Apex class:-  

In the below class, "allvalue" varible is showing as null null .......  in debug log.  Please help me on this. 
 
@RestResource(urlMapping='/timeemailer/*')
global class timeemailerRestApi{

    @HttpGet
    global static String createNewLead()
    {
    string erroMsg = '';
    string allvalue ='';
    try{
     RESTRequest req = RESTContext.Request;
     RESTResponse res = RESTContext.Response;
  //  String body =  req.requestBody.Tostring();
    
    String name = req.params.get('name');
    string emailid = req.params.get('emailid');
    string  Phonenumber = req.params.get('Phonenumber');
    string Projectname = req.params.get('Projectname');
    string key = req.params.get('key');
    
    allvalue = name +'..'+emailid+'...'+phonenumber+'....'+projectname+'..'+key;
    
    system.debug('The coming values are  : '  + allvalue);
   
   if(key!= null && key.Equals(label.Times_E_mailer_key)) 
   { 
    lead l1 = new lead();
    l1.lastname = name;
    if(emailid != null && emailid !='NA')
    l1.Email = emailid;
    l1.mobilephone = phonenumber;
    l1.projects__c = Projectname;
    l1.company ='NA';
    l1.Source_Channel__c = 'Times-E-mailer';
    l1.run_lead_assignment__c =true;
    
    insert l1; 
    
    erroMsg = 'Record sucessfully inserted in salesforce. ';
   } 
   else{
     erroMsg = 'You have entered a wrong API key';
      Error_Log__c el = new Error_Log__c();
           el.Class_Trigger_Name__c ='timeemailerRestApi ';
           el.Error_Description__c = 'Sent wrong key ......................................... The original sent data is :'  + allvalue;
           el.Method_Name__c = 'lead insert method';
           insert el;           
   }
    }
      catch(exception ert)
      {
         Error_Log__c el = new Error_Log__c();
           el.Class_Trigger_Name__c ='timeemailerRestApi ';
           el.Error_Description__c = string.valueof(ert)+'......................................... The original sent data is :'  + allvalue;
           el.Method_Name__c = string.valueof(ert.getLineNumber());
           insert el;           
         erroMsg = 'Records are not inserted ' + string.valueof(ert);
      }
      
    
    return erroMsg;
  
 
    
    }
    
    }

TEST CLASS:-
 
@istest
private class timeemailerRestApi_test{

@istest private static void testmethod1()
{

  


   // req.requestURI = '/services/apexrest/timeemailer';  //Request URL
  //  req.addParameter('name','hellotesting');
  //  req.addParameter('emailid','testing123123get@gmail.com');
  //  req.addParameter('Phonenumber','9842011142');
  //  req.addParameter('Projectname','Acropolis');
  //  req.addparameter('Key','Times-E-mailer');
  
  
   
   
    RestRequest req1 = new RestRequest(); 
    RestResponse res1 = new RestResponse();

    // pass the req and resp objects to the method     
    req1.requestURI = '/services/apexrest/timeemailer?key=Times-E-mailer&name=TestingGetmethod&emailid=testing123123get@gmail.com&Phonenumber=9842011142&Projectname=myprojectName';  //Request URL
    req1.httpMethod = 'GET';
    
    RestContext.request = req1;
    RestContext.response = res1;

 


   string responseMsg = timeemailerRestApi.createNewLead(); //Call the Method of the Class with Proper 


}
}

 

I am trying to populate the one input text field(after entering the date) into another inputtext field in table at visualforce page. I am using change function but, it is not working. Please help me to solve this. Even alert is also not working in my change function code.

Visualforce and apex code below. 
 
<apex:page controller="jquerytableaddrows">
  
  <head>
<title>jQuery Add Elements to DOM</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
var dropdwn='';

dropdwn = '{!optionsstr}';

  $j = jQuery.noConflict();
  
    $j(document).ready(function(){
        $j("#btn").click(function(){
 $j("#tabletab").append('<tr valign="top"><th scope="row"><label for="customFieldName">Custom Field</label></th><td><input type="text" class=".cfonee" id="cfone" name="customFieldName[]" value="" placeholder="Input Name" /> &nbsp;'+dropdwn +' <input type="text" class="code" id="customFieldValue" name="customFieldValue[]" value="" placeholder="Input Value" /> &nbsp; <a href="javascript:void(0);" class="remCF">Remove</a></td></tr>');
    });
        
        
        
       $j("#tabletab").on('click','.remCF',function(){
        $j(this).parent().parent().remove();
    });
   
       $j('input[id$=cfone]').change(function(){
         alert('123123');
        });
  
        });
   
    
   
    
</script>
</head>
<body>
    <p>This is a paragraph.</p>
 
    <button id="btn">Add new list item</button><br/>
    <table class="ipfields" id="tabletab">
    </table>
    <ol>
        <li>list item</li>
        <li>list item</li>
        <li>list item</li>
    </ol>
</body> 
  </apex:page>
 
public class jquerytableaddrows {

public list<string> names{set;get;}
public string optionsstr{set;get;}

public jquerytableaddrows()
{
names = new list<string>();
optionsstr = '<select>';
 for(contact con:[select name from contact  order by createddate asc limit 10])
 {
     optionsstr = optionsstr + '<option value=\"' + con.name +'\">'+con.name+'</option>';
 
// optionsstr=+ '<option value='+"volvo">Volvo</option>
 }
 optionsstr = optionsstr +'</select>';

 
}
}

User-added image
      Please help me to solve this for me.  I have installed SFDC open cti adapter but, I am not able to find where to pass the API links data and how to pass which has been given from my client. (one is freepbx  another one is Mcube). Salesforce documentation is saying that, we need to uncomment the TWILO code after installing the Twillio package in SFDC org.  But Twilio is paid one and client doesn't want to pay for TWILIO. Could you guide me any documentation or code for doing CTI with SFDC OPEN CTI ADAPTER. 


In the below class "SoftphoneProviderHelper" sfdc documents saying that remove the comments after installing the TWILIO package.

Or do we need to modify the TWILIO package for CTI with our credentails ? 

​Please help me to solve this.  
Hi,

   I want to display all contacts.
Conditions:-  We need to display only if the contact parent account has more then 3 contacts. 

So i write this soql. but its not wokring.,  Please help.  If this is done then i need to do the same for custom objects in my project. 

If we write "select count(account.id) from contact group by account.name"  then it is displaying result as excepted. But below query is not working.  
select id,name from contact where (select count(account.id) from contact group by account.name) > 2

 
Hi,  i am trying to display wrapper class data in lighning page. But noting is coming. But in cosole.log data is coming. Please help me to findout this thing.   

 
public class accwrapperclass {

    public class accwrapper
    {
      @AuraEnabled  public account acc{set;get;}
      @AuraEnabled  public boolean check{set;get;}
    }
}



public class selectedaccountslight {
 
    
    @auraEnabled
    public static list<accwrapperclass.accwrapper> getalldatas()
    {
        list<accwrapperclass.accwrapper> accWrapperList = new list<accwrapperclass.accwrapper>();
        
        for(account a1:[select id,name,phone,industry from account ])
        {
            accwrapperclass.accwrapper aw1 = new accwrapperclass.accwrapper();
            aw1.check= false;
            aw1.acc = a1;
            accWrapperList.add(aw1);
            
        }
        return accWrapperList;
    }

}








<aura:component controller="selectedaccountslight">
           <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
   <aura:attribute name="accwrappervalues" type="accwrapperclass.accwrapper[]" /> 

    <aura:iteration items="{!v.accwrappervalues}" var="data">
    {!data.check}....  
    
    
    </aura:iteration>
	
</aura:component>











({
	myAction : function(component, event, helper) {
        
        var action = component.get("c.getalldatas");
 console.log("hello raja");
        
        //Setting the Callback
            action.setCallback(this,function(a){
                //get the response state
                var state = a.getState();
                		  console.log("hello raja2");

                //check if result is successfull
                if(state == "SUCCESS"){
                    
                    var wrapdata = a.getReturnValue();
                    console.log("The wrapdata is: " ,wrapdata);
                  component.get("v.accwrappervalues",wrapdata);
                    
                } 
            });
            
            //adds the server-side action to the queue        
            $A.enqueueAction(action);
		  console.log("hello raja3");
	}
})

 
Hi,
  I am facing this issue.  Once i sent email to a person (x@gmail.com) in case record from "Email" quick action then if i click on again "Email" quick action the "To address" is autopoluating the email address which i have already sent mail earlier (x@gmail.com). Is there any way to remove this cache issue ? . Please help. Even after refreshing the case record page also this "To address" is not getting empty.

I have tried with new Email quick action with predefined field at To address like "custom_email__c" but, even the "custom_email__c" is changing the value then the "To address" in email action is not changing. Kindly help. 

User-added image
To connect with swagger for my custom rest api endpoints I am following the below document.  Please let me know if any has clear steps to implement. 

I am following the below link to setup swagger codegen from vs code. 
https://developer.salesforce.com/blogs/2018/04/connecting-to-swagger-backed-apis-with-clicks-or-code

step 1:- success . runned
"sfdx plugins:install muenzpraeger-sfdx-plugin"  . 

step2:- falied. 
"
sfdx muenzpraeger:swagger:import -p http://petstore.swagger.io/v2/swagger.json -d /Users/rwinkelmeyer/Development/testApex"

User-added image
In case trigger code, I have the below logic,  When more than 3 email to cases are creating at same time (creating under same Account record), I am getting this error.  Please help me to solve this. 

even error is coming, the cases are created and updated sucessfully. 

This  logic in after insert/ update section of trigger. 
if ( newCase.RecordTypeid == RecordTypeHelper.CASES.GENERAL is &&
            String.isNotBlank(settings.Site_Url__c)
        ) {
            Case clonedCase = new Case(Id = newCase.Id);
            String uuId = ApexUtils.encodeValue(newCase.Id);
            clonedCase.SecureUpload_Link__c = settings.Site_Url__c + '?hashCode=' + uuId;
            casesToUpdate.add(clonedCase);
        }
    

try{
if (!casesToUpdate.isEmpty()) {
   update casesToUpdate;
  }
} catch(Exception e) {
            ApexUtils.notifyError(e);
        }

 
I am trying to get the data PDF file from REST API, while storing it into the attachment object as PDF it is showing the empty PDF pages, kidnly help me to solve this issue. 

Note:- Encodeutil decode and encode not wokring while attachment creating converting the response,getBody() into attachment. 
 
string url = AWSUtility.viewS3Object('a1h0n00000187sc');
system.debug('The url is:' + url);

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(url);
request.setMethod('GET');
request.setHeader('Content-Type', 'application/pdf'); 
request.setHeader('Content-Encoding', 'UTF-8');
//req.setHeader('Content-Disposition', 'attachment; filename=' + fileName);
//req.setHeader('Connection', 'keep-alive');

HttpResponse response = http.send(request);
system.debug('The response is :' +response.getBody());
attachment att = new attachment();
att.parentId = 'a1h2g000000I1IN';
att.Name = 'Testing Raja2.pdf';
att.contentType = 'application/pdf'; 

att.body = blob.valueof(response.getBody());

//att.body = EncodingUtil.Base64Decode(response.getBody());
//att.body = EncodingUtil.base64Decode(response.getBody());
//att.body = EncodingUtil.base64Decode(blob.valueof(response.getBody()));
//att.body = EncodingUtil.base64Encode(blob.valueof(response.getBody()));
insert att;  (// attachment is getting created but, all empty pages only).

 
Hi,
  I am getting this error if i run the test class. Kindly help me to solve this, i tried for around 4 hours to solve this but, not to do.

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out
 
@isTest
private class ProjectCalloutServiceTest {

 @testSetup
  public static void setupData() {
         // ProjectCalloutServiceTestData testdata = new ProjectCalloutServiceTestData();
         account acc = new account(name='testing acc');
        insert acc;
        opportunity opp1 = new opportunity(name='testing',closedate=date.today(),amount=200,accountid=acc.id,StageName='closed won');
        insert opp1;
        
        ServiceTokens__c token= new ServiceTokens__c(name='ProjectServiceToken',Token__c='a9b50c09-a94b-4826-9aa6-64407574cad6');
        insert token;
        
  
  }
   @istest 
   public static void testPostCallout() {
        list<id> oppidslst = new list<id>();
        for(opportunity opp:[select id,name from opportunity where accountid!=null])
        {
        oppidslst.add(opp.id);
        }
        
        
         Test.startTest();
      Test.setMock(HttpCalloutMock.class, new ProjectCalloutServiceMock());  
                       
        
    ProjectCalloutService.postOpportunityToPMS(oppidslst);
    Test.stopTest();
    }
}

 
I am trying to display 100 locations address from cutom object to Lightning:map tag, its showing only first 11 addresses plotting on the map.  Is there any limitation for this lightning:map tag ?

Please help to solve this. 

I have followed this link to create component. 
http://sfdcmonkey.com/2018/09/16/mark-locations-google-map-salesforce-lightning/User-added image
I have trigger the below simple trigger to add BCC address dynamically, but its not firing to email. It is showing in the debug log about the added email address . Please help to solve this. 
 
trigger EmailMessage_Trigger on EmailMessage (before insert) {
    
       // EmailMessage_Trigger_Helper.emailMessage(Trigger.New);
     
     for(EmailMessage emsg : Trigger.New){
         if (emsg.Incoming==false && emsg.Status == '3') 
         {
             emsg.BccAddress ='saiprasanth123@gmail.com';  
             emsg.CcAddress ='saiprasanth1234@gmail.com';
           system.debug('coming sai inside:'+emsg.CcAddress+'....'+emsg.FromAddress);

         }
           system.debug('coming sai outside:'+emsg);
     }
}


Thanks,
Sai.
Hi,
    I have written rest api code (http Get) method for capturing lead information from external system. I have rested the api, it is working good. But duing the test class i am getting NULL values for parameters. Kindly help me on this. 

Apex class:-  

In the below class, "allvalue" varible is showing as null null .......  in debug log.  Please help me on this. 
 
@RestResource(urlMapping='/timeemailer/*')
global class timeemailerRestApi{

    @HttpGet
    global static String createNewLead()
    {
    string erroMsg = '';
    string allvalue ='';
    try{
     RESTRequest req = RESTContext.Request;
     RESTResponse res = RESTContext.Response;
  //  String body =  req.requestBody.Tostring();
    
    String name = req.params.get('name');
    string emailid = req.params.get('emailid');
    string  Phonenumber = req.params.get('Phonenumber');
    string Projectname = req.params.get('Projectname');
    string key = req.params.get('key');
    
    allvalue = name +'..'+emailid+'...'+phonenumber+'....'+projectname+'..'+key;
    
    system.debug('The coming values are  : '  + allvalue);
   
   if(key!= null && key.Equals(label.Times_E_mailer_key)) 
   { 
    lead l1 = new lead();
    l1.lastname = name;
    if(emailid != null && emailid !='NA')
    l1.Email = emailid;
    l1.mobilephone = phonenumber;
    l1.projects__c = Projectname;
    l1.company ='NA';
    l1.Source_Channel__c = 'Times-E-mailer';
    l1.run_lead_assignment__c =true;
    
    insert l1; 
    
    erroMsg = 'Record sucessfully inserted in salesforce. ';
   } 
   else{
     erroMsg = 'You have entered a wrong API key';
      Error_Log__c el = new Error_Log__c();
           el.Class_Trigger_Name__c ='timeemailerRestApi ';
           el.Error_Description__c = 'Sent wrong key ......................................... The original sent data is :'  + allvalue;
           el.Method_Name__c = 'lead insert method';
           insert el;           
   }
    }
      catch(exception ert)
      {
         Error_Log__c el = new Error_Log__c();
           el.Class_Trigger_Name__c ='timeemailerRestApi ';
           el.Error_Description__c = string.valueof(ert)+'......................................... The original sent data is :'  + allvalue;
           el.Method_Name__c = string.valueof(ert.getLineNumber());
           insert el;           
         erroMsg = 'Records are not inserted ' + string.valueof(ert);
      }
      
    
    return erroMsg;
  
 
    
    }
    
    }

TEST CLASS:-
 
@istest
private class timeemailerRestApi_test{

@istest private static void testmethod1()
{

  


   // req.requestURI = '/services/apexrest/timeemailer';  //Request URL
  //  req.addParameter('name','hellotesting');
  //  req.addParameter('emailid','testing123123get@gmail.com');
  //  req.addParameter('Phonenumber','9842011142');
  //  req.addParameter('Projectname','Acropolis');
  //  req.addparameter('Key','Times-E-mailer');
  
  
   
   
    RestRequest req1 = new RestRequest(); 
    RestResponse res1 = new RestResponse();

    // pass the req and resp objects to the method     
    req1.requestURI = '/services/apexrest/timeemailer?key=Times-E-mailer&name=TestingGetmethod&emailid=testing123123get@gmail.com&Phonenumber=9842011142&Projectname=myprojectName';  //Request URL
    req1.httpMethod = 'GET';
    
    RestContext.request = req1;
    RestContext.response = res1;

 


   string responseMsg = timeemailerRestApi.createNewLead(); //Call the Method of the Class with Proper 


}
}

 
Hi everyone. In our company we are currently implementing the opencti for our customers.
So one of the feature that we want is to create a call log while or after the call is finish. 
I saw that I can use the 
sforce.opencti.screenPop({
                            type: sforce.opencti.SCREENPOP_TYPE.NEW_RECORD_MODAL, 
                            params: { entityName: 'Task'}
}); 

because I read something that a call log is the same as task but unfortunately this is not shareable. 
Only the one user can see the this call log that is not our customer wants. Is there any other way around that can solve this?
I tried to create a public group and assign the task but it's not working only contacts and lead can be assign or relate to the task.
Is there any open cti function that I can use regarding this issue? because this is a sample scenario we want. 
For example, there are list of phone numbers that the agents need to call, if the other agents already called this number there's no need to call
that number. and so agents need to know about it by having a call log that is visible to all assigned users in a open cti call center.

I hope you can help me about this. Thank you.

Austin
In this code. call back function state is coming as false.  Please help.
 
newcontacts : function(component, event, helper){
    var contval = component.get("v.newcontact");
        console.log('The con vlaue is ',contval);
        
        var action = component.get("c.getlightcons");
        action.setParams({
            con : contval
        });
             
        
        action.setCallback(this,function(a){
            //get the response state
            var state = a.getState();
            if(state == true)
            {    
            
            
                    console.log("The state is true");
                     component.get("v.errormeg",a.getReturnValue());
            }
            else
            {
                console.log("The state is false");
            }
           
        });
    $A.enqueueAction(action);
  }
})










public class eventsexampleapexclass {
     @AuraEnabled
     public static string getlightcons(contact con)
     {           system.debug('inside the The error message value is : ');

         string errormsg ='';
         try{
         		if(con!= null)
         		{
             		insert con;
         		}
            }
         catch(exception er1)
         {
             errormsg=string.valueOf(er1);
             system.debug('inside the catch method');
         }
         system.debug('The error message value is : '+errormsg);
         return errormsg;
     }
    
}

 
Hi, 

I want to display list of accounts with contacts in lightning page. Here the code i have written. Here accounts are displaying but contacts are not display. Please help me to display the accounts with contacts.

Thank you.


 
<aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
	 
    <aura:attribute name="accounts" type="Account[]" />
    <ui:button label="click this" press="{!c.myAction}" />
    <table>
            <tr><td><b>Name</b></td><td><b>Industry</b></td></tr>

    <aura:iteration items="{!v.accounts}" var="accs1" >
        <tr>   
        <td> {!accs1.Name}  </td>
         
      <td>   {!accs1.Industry}  </td> 
      <!--   <td>   {!accs1.Contacts.lastName}  </td> -->
        </tr>     
     <tr>   <aura:iteration items="{!v.accs1.contacts}" var="con1" >
            
             <td>{!con1.lastName} </td>
            
        </aura:iteration></tr>
     </aura:iteration>                                            
        </table>
    
</aura:component>








({
	myAction : function(component, event, helper) {
		var action =component.get("c.getAllAccounts");
        console.log('The action value is: '+action);
         action.setCallback(this, function(a){ 
             
            component.set("v.accounts", a.getReturnValue());
           //  console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
            console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
          
        });
        $A.enqueueAction(action);
	}
})











public class accountsWithContactsClass {

@auraEnabled
public static list<account> getAllAccounts()
    {
       list<account> accs =[select id,name,phone,industry,(select lastName from contacts) from account limit 10];
      //  list<account> accs =[select id,name,phone,industry from account limit 10];
     //   return [select Id,Name from account limit 10];
     return accs;
    }
}