• Shatrughna Salunke
  • NEWBIE
  • 75 Points
  • Member since 2020
  • Certified Salesforce Developer

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 14
    Replies
Hi,

Below is apex code which i am terying to execue in "Open Execute Anonymous Window"
SDSAfterConvert n1 = new SDSAfterConvert();
n1.returnInteger();


Here is Apex class
public class SDSAfterConvert {
    
    
public static List<String> returnInteger(){

List<String> inputList = new List<String>();
             
String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'};
 
for (String s1 : myAlphabets) {
    System.debug(s1);
    inputList.add(s1);
}
        
return inputList;
             
}
    
}


Can anyone help why i am getting this error as My method is static and arrays can be returned from static

Regards,
Fiona



 
List<Account> Aop = [Select Name (Select Name, StageName From Opportunites) From Account];
    
for(Account acc : Aop){
    system.debug('Parent '+ acc.name);
    
    for(Opportunity opp: acc.opportunity){
        system.debug('Child '+ opp.Stagename);
    }
}

Hi,

I am looking for something where we can access the salesforce portal inside the Microsft teams. Is there any API or any out-of-the-box feature available?

Tks,

Shatrughna Salunke

Hi,
I am looking video calling feature with Salesforce to Microsft teams 

The ability to easily call any of your contacts right from Teams and if needed, set up the online meeting or video call.

Tks,
Shatrughna Salunke
Hi All,

I'm looking for a chatbot and I want to go with the best one chatbot. Majorly I'm looking for anything from Microsoft or Salesforce chatbot. Basically, I'm looking best chatbot in the market so that I can connect with a different system, Salesforce, Custom- portal, and Company websites.


Any suggestion which one is to go. 

Regards,
Shatrughna Salunke
Hello,

Due to the existing apex trigger, apex class, and custom label I'm getting an error due to because of this error I am unable to create a new record.

All components are deployed using a package and I'm unable to uninstall this package.

Any help or solution for the same.

Regards,
Shatrughna 
Hello,

How do I insert values in the custom picklist using apex trigger.

Regards,
Shatrughna
Hello ,

I am using apex class to send attchment of csv/excel file code is working fine, but once the I file downloaded from outllok or gmail  file type is getting change to File . But I can see these files are open in google sheet ,but not from the local drive after downloading 

I'm not sure  is it contentType issue or anything.

emailAttachment.setContentType('application/pdf');
or 
emailAttachment.setContentType('application/vnd.ms-excel');

Print 1: Attachment looks like below in gmail  
User-added image
Print 2: After file downloaded the file type is getting change to Flile.
User-added image


Thanks,
Shatrughna
Hi,

I'm send excel attachment through apex class but after download the file file type is getting changed to file, but I can see in googl sheet file is open in excel format but not after downloading

  emailAttachment.setContentType('application/xlsx');
  emailAttachment.setBody(Blob.valueOf(csvFile)); 

Note : I tried with diffrent format csv, pdf but all are not working afte downloading the file.
 
Hello,

How  to add new field in belwo request body using apex class i've string of requestbody.

Fiedld Name=ERP_Set_Status__c and Customer_status__C

String requestbody='
{
  "platform": {
    "record": {
      "query_type": {
        "content": "11"
      },
      "consumer_title": "Mr.",
      "consumer_first_name": "Shatrughna",
      "consumer_surname": "Salunke",
      "consumer_date_of_birth": "1971-10-08",
      "address_line1": "19",
      "address_line2": "",
      "address_line3": "",
      "town": "Pune Hinjawadi",
      "postcode_2099407766": ""
    }
  }
}';
    
String requestbody='
{
  "platform": {
    "record": {
      "query_type": {
        "content": "11"
      },
      "consumer_title": "Mr.",
      "consumer_first_name": "Shatrughna",
      "consumer_surname": "Salunke",
      "consumer_date_of_birth": "1971-10-08",
      "address_line1": "19",
      "address_line2": "",
      "address_line3": "",
      "town": "Pune Hinjawadi",
      "postcode_2099407766": ""
    }
  }
}';

Using above request body I am getting below error
Error:System.HttpResponse[Status=null, StatusCode=400]

Hello,

How to read csv tab in apex class or aura cmp , However  I can able to read csv file body , but I could not able to read tab name in apex or aura.

please find  the  below print:
User-added image


Regards,
Shatrughna
 

Hello,

Is there any aletrnative way to achive the  below  sosl and soql error?

For the below code I am getting error

Error : Invalid IN fields group: PERSONEMAIL OR Custome_Email__C

  @AuraEnabled
   public static List<Account>  getData(String entityType)
    {   
       List<account> getDetails=new List<account>();
        List<List<Account>>  accList = [FIND : entityType IN PersonEmail Fields RETURNING Account(id,PersonEmail) limit 1];
        for(List<Account> accountList1 : accList){
            for(Account accountList2 : accountList1){
                if(accountList2.PersonEmail != null )
                {
                    if((accountList2.PersonEmail).equalsIgnoreCase(entityType)  )
                    {
                        getDetails.add(accountList2);
                    }
                }
            }
        }
        return getDetails;
    }
}

Also,getting error for this soql as well 
[Select id,PersonEmail  from Account where PersonEmail =:emailIds]

Error: we canot filter query for PersonEmail

Note: passing email id' from aura method and need to be filter record based on the email id's

 
Hi below is my code and l'am looking for chnage the date format 

JS Controller
         var previouslySearchedDate=[];   
         var temp = getList;    // here we are getting list of record 
           
            for(var i=0 ; i<temp.length;i++)
            {
              if(!$A.util.isUndefinedOrNull(temp[i].previouslySearched))
                {
                  var previousDate=(temp[i].previouslySearched=== undefined ? "" : temp[i].previouslySearched+'');
                  temp[i].previouslySearchedDate=previousDate;
                }

             }

CMP
     <div class="assoc-label slds-grid slds-wrap">Previously searched on: {!r.previouslySearchedDate}

Current output: 
    12/1/2000:T0000 ,11/10/2012:T0000

Now , I'm  looking as  below
     12/1/2000,11/10/2012
Hi All,
want to be list of record in single row with comma seprated in lightning cmp.

<aura :iteration items="v.detAllData" var="v">
   <ui:outputdate value="{!v}" format="dd/mm/yy" />
</aura;iteration>

courrent output:
      24/06/2020
      1/01/2018
      10/12/2012

looking output as below.
    24/06/2020 ,1/01/2018, 10/12/2012
  
Sort the list record in JavaScript in desc orde

var number; //here we are getting dynamic number from API

var test; //here we are getting dynamic text from API

for (var i; i <= accList.length; i++) {
 
    var odlist = 'you have :' + test + number + 

  dataList.push(odlist);
}
Current output: 


1.you have : total 4 accounts of 10

2.you have : total 11 account accounts of 23 

3.you have : total 0 accounts of 100

4. you have : total 2 accounts of 6
```

Now I want to sort above list in descending order looking for output as per below:


1.you have : total 0 accounts of 100

2.you have : total 11 account accounts of 23 

3.you have : total 4 accounts of 10

4.you have : total 2 accounts of 6
 
Hi,

Please find the below details of the case routing requirement.

When an agent choose a status of the case to Xyz it should try to pop in the omnichannel of an original agent who changed the case status 

And if an agent is offline then the case should go to the escalated queue

Note:  I have tried with queue-based and skill-based routing and it seems to be that it is not possible.

Please let me know if any other approach to resolve the above problem.

Regards,
Shatrughna

 
Hello,

I am unable to set up  "Chat with Customers" I am getting below error while setup.

Note: I have tried with the newly created instance and old instance.

Before that, I was successfully set up my flow but now I am facing below problem almost every instance.


Please find the below screenshot.
 
User-added image

Regards,
Shatrughna
 
Hi,

Below is apex code which i am terying to execue in "Open Execute Anonymous Window"
SDSAfterConvert n1 = new SDSAfterConvert();
n1.returnInteger();


Here is Apex class
public class SDSAfterConvert {
    
    
public static List<String> returnInteger(){

List<String> inputList = new List<String>();
             
String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'};
 
for (String s1 : myAlphabets) {
    System.debug(s1);
    inputList.add(s1);
}
        
return inputList;
             
}
    
}


Can anyone help why i am getting this error as My method is static and arrays can be returned from static

Regards,
Fiona



 
Hello,

I'm trying to send mail using apex class.

While I'm executing via Execute Anonymous Apex with Editors Content it throws an error stating "Unexpected token 'body' on line #3".

Below I'm pasting my code.

List<String> address = new List<String> { 'prince.sharma930@gmail.com', 'rahuls91221@gmail.com' };
String subject = 'Topcoder Challenge Sample Mail';
String body = 'Hi, Hope you stay safe and healthy during the COVID-19.;
WelcomeEmailProcessor.sendMail(address, subject, body);

Kindly Help.
Thanks you!
Hi Guys,

Please Help out. I have created one Email Template. And I have use this in Email Services As follows,

public class sendEmailNotification {
    public static void sendemail(){
        String EmailId;
        Id OrgWideEAId;
        Lead leadLst = [Select Id from Lead limit 1];
        EmailTemplate emailTemplate = [Select Id,Subject,Description,HtmlValue,DeveloperName,Body from EmailTemplate where name = 'EmailToClinicUsersWithClinic'];
        for(OrgWideEmailAddress owa : [SELECT Id, Address, DisplayName FROM OrgWideEmailAddress]){
            if(owa.DisplayName.contains('Medi')){
                EmailId = owa.Address;
                OrgWideEAId = owa.Id;
            }
        }
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setTargetObjectId(leadLst.id);
        message.setSubject('Sample Notification');
        message.setReplyTo(EmailId);
        message.setUseSignature(false);
        message.setOrgWideEmailAddressId(OrgWideEAId);
        message.setBccSender(false);
        message.setSaveAsActivity(false); 
        message.setTemplateID(emailTemplate.Id);
        message.setHtmlBody(emailTemplate.Body);
        //message.setWhatId(ld.accountid); //This is important for the merge fields in template to work
        message.toAddresses = new String[] {'sandeep@gmsil.com'};
            Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
                Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);
        
        if (results[0].success) 
        {
            System.debug('The email was sent successfully.');
        } else {
            System.debug('The email failed to send: ' +  results[0].errors[0].message);
        }
    }
    
}

I should get this:
User-added image

I Got This:
User-added image

 
Good Morning,

I facing an error in Batch class : 

Merge failed. First exception on row 0 with id 0030U00001ESVzyQAH; first error: LIMIT_EXCEEDED, System.LimitException: Too many queueable jobs added to the queue: 2: []

Code: 

global class MergeContactBatch implements database.Batchable<sObject>{
    
    String Name = '%Test%';
    global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT Id FROM Contact WHERE Email = NULL AND Name LIKE \''+Name+'\'';
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<Contact> scope){
        
        Contact masterConact = MergeContactBatch.getContact();
        
        List<Contact> dupcontactList = new List<Contact>();
        Set<Id> Ids = new Set<Id>();
        for(Contact contactRecrd : scope){
            Ids.add(contactRecrd.Id);
            dupcontactList.add(contactRecrd);
        }
        
        List<Contact> contactList = [SELECT Id FROM Contact WHERE Id IN: Ids];
        for(Contact con : contactList){
            Database.merge(masterConact, con);
        }
        
       // Database.MergeResult[] results = Database.merge(masterConact, dupcontactList);
    }
    
    global void finish(Database.BatchableContext BC){}
    
    
    public Static Contact getContact(){
        
        List<Contact> contactList = [SELECT Id FROM Contact WHERE Id = '0030U00001ESW0S'];
        if(!contactList.isEmpty()){
            return contactList[0];
        }else{
            return null;
        }
    }
}

please help me,

Thanks,
Dhilip Dussa
Hello All,

I have written following code in apex class:

public class StudentSelection {
    Public Static Void StudentSelectionCriteria(List<Student__c> StudentListNew){
        for(Student__c S : StudentListNew){
            if (S.Age__c<=30 && S.Experience__c>8){
                S.Status__c='Selected';
            }
            else if(S.Age__c>30 && S.Experience__c<8){
                S.Status__c='Not Selected';
            }
           
      }       
  }
}

Trigger :
trigger StudentSelectionTrigger on Student__c (before insert) {
    
    if(Trigger.isBefore==True && Trigger.isInsert==True){
        
       StudentSelection.StudentSelectionCriteria(Trigger.New);
    }

}

Can you check while satisfying not selected condition i am gettin error:

StudentSelectionTrigger: data changed by trigger for field Status: data value too large: (value has been hidden)

Also can we use only else instead of if else??
I have the working trigger below that attaches whatever document that is in the Files related list to an email and sends it the contact on a case.

If there is more than one doc in the Files realted list, I get an error. Can anyone advise on how to modify the code to add all related list docs to the email?
 
trigger SendContentVersion on Case (after update) {

    String subject = 'Placeholder';
    String body = 'Placeholder';

    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
    for(Case myCase : trigger.new){
        Case oldCase = Trigger.oldMap.get(myCase.Id);
    // Get ContentVersion
    ContentDocumentLink a = [SELECT Id, LinkedEntityId, ContentDocumentId, Visibility, IsDeleted, ShareType,
                            ContentDocument.Title, ContentDocument.createdDate, ContentDocument.FileType
                            FROM ContentDocumentLink 
                            WHERE LinkedEntityId =: myCase.id];
    Id contentDocumentId = a.ContentDocumentId;

    ContentVersion[] cv_list = [select VersionData, PathOnClient from ContentVersion where ContentDocumentId =: contentDocumentId];
    ContentVersion cv = new ContentVersion();
    
    if(cv_list.size() != 0) {
        cv = cv_list[0];
    
        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName(cv.pathOnClient); 
        efa.setBody(cv.versionData);
        email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
    }
    //add address's that you are sending the email to
    List<String> sendTo = new List<String>();
    String owneremail = [select Email from User where Id = :myCase.OwnerId].Email;
    sendTo.add(myCase.ContactEmail);
    sendTo.add(owneremail);

    email.setSubject(subject);
    String[] toAddresses = (sendto);
    email.setToAddresses( toAddresses );
    email.setPlainTextBody(body);
    
    
    // Sends the email  
    Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
}
    }
}

 
List<Account> Aop = [Select Name (Select Name, StageName From Opportunites) From Account];
    
for(Account acc : Aop){
    system.debug('Parent '+ acc.name);
    
    for(Opportunity opp: acc.opportunity){
        system.debug('Child '+ opp.Stagename);
    }
}
Hi,

I'm send excel attachment through apex class but after download the file file type is getting changed to file, but I can see in googl sheet file is open in excel format but not after downloading

  emailAttachment.setContentType('application/xlsx');
  emailAttachment.setBody(Blob.valueOf(csvFile)); 

Note : I tried with diffrent format csv, pdf but all are not working afte downloading the file.
 
Hello,

Is there any aletrnative way to achive the  below  sosl and soql error?

For the below code I am getting error

Error : Invalid IN fields group: PERSONEMAIL OR Custome_Email__C

  @AuraEnabled
   public static List<Account>  getData(String entityType)
    {   
       List<account> getDetails=new List<account>();
        List<List<Account>>  accList = [FIND : entityType IN PersonEmail Fields RETURNING Account(id,PersonEmail) limit 1];
        for(List<Account> accountList1 : accList){
            for(Account accountList2 : accountList1){
                if(accountList2.PersonEmail != null )
                {
                    if((accountList2.PersonEmail).equalsIgnoreCase(entityType)  )
                    {
                        getDetails.add(accountList2);
                    }
                }
            }
        }
        return getDetails;
    }
}

Also,getting error for this soql as well 
[Select id,PersonEmail  from Account where PersonEmail =:emailIds]

Error: we canot filter query for PersonEmail

Note: passing email id' from aura method and need to be filter record based on the email id's

 
Hi,

Please find the below details of the case routing requirement.

When an agent choose a status of the case to Xyz it should try to pop in the omnichannel of an original agent who changed the case status 

And if an agent is offline then the case should go to the escalated queue

Note:  I have tried with queue-based and skill-based routing and it seems to be that it is not possible.

Please let me know if any other approach to resolve the above problem.

Regards,
Shatrughna