• Shubham_Kumar
  • NEWBIE
  • 300 Points
  • Member since 2018


  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 54
    Replies
Hi ,

I am using address field on lightning page .when user used Enter key inside Street field of Address  my call-out get failed.
 
I need to create a left arrow back button and when someone clicks this back button ,it should perform some action. Is there any out of the box functionality of lightning button with left arrow key. Please help me .  Refer the image with the first card.  <        Manage ConsentUser-added image

 
I am trying to increment the values inside a list using the ++ operator, but I get the error saying 'Expression cannot be assigned'. On the code below I am trying the increment the values of onBillings & offBillings variable.
Decimal onBillings;
    Integer offBillings;
    List<sumchans__City_Master__c> cityList = new List<sumchans__City_Master__c>();//unique city list
    List<sumchans__City_Stats__c> cityStats = new List<sumchans__City_Stats__c>();//Saving city stats
    Set<String> cities = new Set<String>();
    for(sumchans__Address_Master__c addressMaster: addressList) {
          sumchans__City_Master__c city = new sumchans__City_Master__c();
          city.Name = addressMaster.sumchans__CITY_NAME__c;// Default Name column - storing city name
          city.sumchans__City_Name_Ext_Id__c = addressMaster.sumchans__CITY_NAME__c;//Populating the external id field with city name again to pull related data.
          city.sumchans__Province_Code__c = addressMaster.sumchans__PROVINCE_CODE__c;
          if(!cities.contains(city.Name)) {               
              for(sumchans__ADDRESS_STATS__c addressStatsList: addressStats) {
                  String cityFromAddressList = (addressStatsList.Name).substringBeforeLast(' ');
                  cityFromAddressList = cityFromAddressList.substringBeforeLast(' ');
                  if(cityFromAddressList == city.Name) {
                      onBillings++ = Integer.valueOf(addressStatsList.sumchans__On_Billings__c);
                      offBillings++ = addressStatsList.get('sumchans__Off_Billings__c');
                      sumchans__City_Stats__c cityStat = new sumchans__City_Stats__c();
                        cityStat.sumchans__On_Billings__c = onBillings;
                        cityStat.sumchans__Off_Billings__c = offBillings;
                        cityStats.add(cityStat);                       
                    }
                }
                cities.add(city.Name);
                cityList.add(city);
            } 
        }

 
I am trying to retrieve a record name in my visualforce page, however it will only let me get the ID number.

I have tried putting {!Case.Name} with no luck - I get the error that the field does not exist.

<apex:page standardController="Case" renderAs="PDF" showHeader="false" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false">
<head>
 <style> body { font-family: Arial Unicode MS; font-size:14px;}
 th {font-size:18px; padding-right:20px; font-weight:bold;}
 td{padding-right:20px;}
 span {font-weight:800;}
h3 {font-family: Arial Unicode MS; font-size:14px; font-weight:bold; text-decoration: underline; margin:0;}
.product {margin-bottom:30px; border:1px; border-style: solid;}
.img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 40%;
}
.inside {margin:20px;}
  </style>
</head>
<body>
<p class="img"><apex:image url="{!URLFOR($Resource.logo,'lf_logo.png')}" width="300px"/></p>
  
 <br></br>
Regarding your warranty case number   <apex:outputText value="{!Case.Id}"/> 
 
Hello guys

I have a custom checkbox field On Campaign object.
and a custom setting called ManageData__c with 4 fields.
While creating Campaign if this checkbox is checked I want to make sure custom setting ManageData__c 's fields are filled.

if ManageData__c 's fields is not filled then while creating campaign a form will appear where I can fill the ManageData__c's filleds

please help
thank you.

I am getting an "Illegal assignment from Integer to String" error on this Apex Class where:

  1. I am trying to retrieve the Case Thread ID (same one that is used in Email-To-Case feature) and this field is a custom text formula data type on the Case record
  2. Change the Case Thread ID font color to light gray (#CCCCCC) in the email body

The errors are pointing to:

String casethreadId.....  (Line 20)

'<span>....  (Line 53)

 

The whole Apex Class:

public class custom_VICasesForwarding {

    @InvocableMethod(Label='forwardToInterpretingDept')
    public static void forwardToInterpretingDept(List<ID> caseRecords){
        Set<Id> createEmailAddresses = new Set<Id>();
        List<Case> caseList = [select Id, 
                                    Subject, 
                                    CaseNumber, 
                                    Case_Reason__c, 
                                    Case_Issue__c, 
                                    Description, 
                                    Date_Time_of_Call__c, 
                                    VINumber__c, 
                                    Customer_s_VP__c, 
                                    Outbound_Audio__c,
                                    Case_Thread_ID__c,
                              (select Id from EmailMessages)
                              from Case where Id IN :caseRecords];

        String casethreadId = String.valueOf(Case.Case_Thread_ID__c);

        for(Case c: caseList){
            // Pulls field data from Case to include in the email body
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            String[] toaddr = new String[System.Label.custom_VIEmailAddresses.split(',')];
            string[] ccaddr = new string[]{};
            email.setSubject('FW: ' + c.CaseNumber + ' : ' + c.Case_Reason__c);
            email.setHtmlBody('Case Number: ' + c.CaseNumber
                                + '<br/>' + 
                                'Case Reason: ' + c.Case_Reason__c 
                                + '<br/>' +
                                'Case Issue: ' + c.Case_Issue__c 
                                + '<br/>' + 
                                + '<br/>' +
                                'Date/Time: ' + c.Date_Time_of_Call__c 
                                + '<br/>' + 
                                'VI #: ' + c.VINumber__c
                                + '<br/>' +
                                'Customer\'s VP #: ' + c.Customer_s_VP__c
                                + '<br/>' +
                                'Outbound Audio #: ' + c.Outbound_Audio__c
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                'Case Description: ' + c.Description 
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                '<i>' + '*Note: If there are any null values, this means this information was not provided by the Case Owner prior to this submission.' + '<i>'
                                + '<br/>' +
                                '<span style="color: #cccccc;">' + casethreadId + '</span>');
            email.setToAddresses(toaddr); 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
        }
        
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();   
        
    }  
}
Hi Team,
I'm facing below error.
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]

Thanks
KMK
  • November 28, 2019
  • Like
  • 0
Error: Method does not exist or incorrect signature: void replace(String, Datetime) from the type String

also, i noticed that even when i comment out the this line of code it is still returning the same error. please suggest.
 
for(ContentDocumentLink clIterator : trigger.new) {
        string strObjPrefix = String.valueOf(clIterator.LinkedEntityId).substring(0, 3);
        if(strObjPrefix == Appointment__c.sObjectType.getDescribe().getKeyPrefix()) {
            setCntDocIds.add(clIterator.ContentDocumentId);
            setAccIds.add(clIterator.LinkedEntityId);
            //Id str =setAccIds[0];
            Set<Id> str = new set<Id>(setAccIds);
            Appointment__c app= [select id from Appointment__c where id =:str limit 1] ;
			 
            system.debug('Email Body');//debug appointment
            string filename =filestitlemaps.get(clIterator.ContentDocumentId); 
            string accountname = accnamemaps.get(clIterator.LinkedEntityId);
            Set<String> KeywordSet = new Set<String>();
            
            
            
            Program_Setting__mdt[] programs = [SELECT Email_Body__c, Keyword__c, Keyword1__c FROM Program_Setting__mdt];        
            //if(filename.containsAny(programs[0].Keyword__c)){
            if((programs[0].keyword__c).containsAny(Filename)){
                
              Contact c = [Select id, name from contact where name='Ultragenyx PV'];
           //  List<string> toAddress = new List<string>();
            // toAddress.add('iamaarza@gmail.com');
             
 

                          
            EmailTemplate emailTemplate = [select Id, Subject, HtmlValue, Body from EmailTemplate where Id ='00X0i000000PGf1']; 
                String subject = emailTemplate.Subject;
                               //query appointment record pass values to replace the merge fields
        
            String plainBody = emailTemplate.Body;
            plainBody = plainBody.replace('{!app.Name}', app.Name);
            string s = string.valueOfGmt(app.Appointment_Start_Date__c);
            //plainBody = plainBody.replace('{!app.Appointment_Start_Date__c}', app.Appointment_Start_Date__c); 
            plainBody = plainBody.replace('{!app.Appointment_Start_Date__c}', s); 
                
           
      
              Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    mail.setTemplateId('00X0i000000PGf1');
                   // mail.setToAddresses(toAddress);
                    //mail.setSubject('test subject');
                    mail.setTargetObjectId(c.Id);
                    //mail.setWhatId(c.Id);
                    mail.setSaveAsActivity(false);
                    mail.setUseSignature(false);
                    
                    
                    List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
                    allmsg.add(mail); 
                     
        }
        
    }
}
}

 
  • August 26, 2019
  • Like
  • 0
I have a trigger as follows:

trigger LeadConvert on Lead (after update) {

  // no bulk processing; will only run from the UI
  if (Trigger.new.size() == 1) {

    if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {

      // if a new account was created
      if (Trigger.new[0].ConvertedAccountId != null) {

        // update the converted account with some text from the lead
        Account a = [Select a.Id, a.Initial_Payment__c, a.BPS__c,a.Monthly_Payment__c, a.X401_k_Plan_Type__c From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
        if (a.X401_k_Plan_Type__c == 'Individual')
        {
            a.NumberOfEmployees = Integer.Valueof(Trigger.new[0].Number_of_Owners__c);
        }
        update a;

      }         

      }        

    }

  
}

It maps converted lead field to an account field.

Have written a test for the same which is giving 0% code coverage.

@isTest
private class LeadConvertTest {
@testSetup static void setup() {
        User users2=createUser();
        system.runAs(users2){
            Lead l1=new Lead();
            l1.LastName='test';
            l1.Number_of_Owners__c = 25;
            insert l1;
   
        }
    }
    
    @isTest
    static void updateAccount1(){
        user us2=[select Id from user where  Email ='xxx@ddd.com'];
        system.runAs(us2){
            Account a2=[select Id from Account limit 1];
            a2.X401_k_Plan_Type__c = 'Individual';
            update a2;
            
        }
        
    }
    
    
    private static user createUser(){
        User plannerUser2 = new User(
            ProfileId = [SELECT Id,name FROM Profile where name='System Administrator'].Id,
            LastName = 'last',
            Email = 'xxx@ddd.com',
            Username = 'xxx@ddd.com' + System.currentTimeMillis(),
            CompanyName = 'TEST1',
            Title = 'title',
            Alias = 'alias',
            TimeZoneSidKey = 'America/Los_Angeles',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            LocaleSidKey = 'en_GB',
            IsActive=true);
        database.insert(plannerUser2);
        return plannerUser2;
    }
    
}

I am new to development and any help woulf be graetly appreciated.
Hi ,

I am using address field on lightning page .when user used Enter key inside Street field of Address  my call-out get failed.
 
I need to create a left arrow back button and when someone clicks this back button ,it should perform some action. Is there any out of the box functionality of lightning button with left arrow key. Please help me .  Refer the image with the first card.  <        Manage ConsentUser-added image

 
I am trying to increment the values inside a list using the ++ operator, but I get the error saying 'Expression cannot be assigned'. On the code below I am trying the increment the values of onBillings & offBillings variable.
Decimal onBillings;
    Integer offBillings;
    List<sumchans__City_Master__c> cityList = new List<sumchans__City_Master__c>();//unique city list
    List<sumchans__City_Stats__c> cityStats = new List<sumchans__City_Stats__c>();//Saving city stats
    Set<String> cities = new Set<String>();
    for(sumchans__Address_Master__c addressMaster: addressList) {
          sumchans__City_Master__c city = new sumchans__City_Master__c();
          city.Name = addressMaster.sumchans__CITY_NAME__c;// Default Name column - storing city name
          city.sumchans__City_Name_Ext_Id__c = addressMaster.sumchans__CITY_NAME__c;//Populating the external id field with city name again to pull related data.
          city.sumchans__Province_Code__c = addressMaster.sumchans__PROVINCE_CODE__c;
          if(!cities.contains(city.Name)) {               
              for(sumchans__ADDRESS_STATS__c addressStatsList: addressStats) {
                  String cityFromAddressList = (addressStatsList.Name).substringBeforeLast(' ');
                  cityFromAddressList = cityFromAddressList.substringBeforeLast(' ');
                  if(cityFromAddressList == city.Name) {
                      onBillings++ = Integer.valueOf(addressStatsList.sumchans__On_Billings__c);
                      offBillings++ = addressStatsList.get('sumchans__Off_Billings__c');
                      sumchans__City_Stats__c cityStat = new sumchans__City_Stats__c();
                        cityStat.sumchans__On_Billings__c = onBillings;
                        cityStat.sumchans__Off_Billings__c = offBillings;
                        cityStats.add(cityStat);                       
                    }
                }
                cities.add(city.Name);
                cityList.add(city);
            } 
        }

 
I am trying to retrieve a record name in my visualforce page, however it will only let me get the ID number.

I have tried putting {!Case.Name} with no luck - I get the error that the field does not exist.

<apex:page standardController="Case" renderAs="PDF" showHeader="false" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false">
<head>
 <style> body { font-family: Arial Unicode MS; font-size:14px;}
 th {font-size:18px; padding-right:20px; font-weight:bold;}
 td{padding-right:20px;}
 span {font-weight:800;}
h3 {font-family: Arial Unicode MS; font-size:14px; font-weight:bold; text-decoration: underline; margin:0;}
.product {margin-bottom:30px; border:1px; border-style: solid;}
.img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 40%;
}
.inside {margin:20px;}
  </style>
</head>
<body>
<p class="img"><apex:image url="{!URLFOR($Resource.logo,'lf_logo.png')}" width="300px"/></p>
  
 <br></br>
Regarding your warranty case number   <apex:outputText value="{!Case.Id}"/> 
 
<apex:page controller="setterGetterapex_class" >
    <apex:form>
        <apex:pageBlock title="My calculations">
        <apex:pageBlockButtons>
            <apex:commandButton value="ADD" action="{!add}"/>
            <apex:commandButton value="SUB" action="{!sub}"/>
            </apex:pageBlockButtons>
            <apex:BlockSection title="Simple Operations">
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter x value</apex:outputLabel>
                    <apex:inputText value="{!xvalue}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter y value</apex:outputLabel>
                    <apex:inputText value="{!yvalue}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    you ave performed{!opretion of value{!xvalue} and {!yvalue} finally result is{!result} }
                </apex:pageBlockSectionItem>
            </apex:BlockSection>
       </apex:pageBlock>
    </apex:form>
</apex:page>
Hello guys

I have a custom checkbox field On Campaign object.
and a custom setting called ManageData__c with 4 fields.
While creating Campaign if this checkbox is checked I want to make sure custom setting ManageData__c 's fields are filled.

if ManageData__c 's fields is not filled then while creating campaign a form will appear where I can fill the ManageData__c's filleds

please help
thank you.
Hi All, I need to write a trigger on Opportunity object for checkbox field update by checking the value of a field in Account Object, this trigger will be before insert.
if account.custonersuccess=TRUE then opportunity.customersuccessblock= TRUE

I am getting an "Illegal assignment from Integer to String" error on this Apex Class where:

  1. I am trying to retrieve the Case Thread ID (same one that is used in Email-To-Case feature) and this field is a custom text formula data type on the Case record
  2. Change the Case Thread ID font color to light gray (#CCCCCC) in the email body

The errors are pointing to:

String casethreadId.....  (Line 20)

'<span>....  (Line 53)

 

The whole Apex Class:

public class custom_VICasesForwarding {

    @InvocableMethod(Label='forwardToInterpretingDept')
    public static void forwardToInterpretingDept(List<ID> caseRecords){
        Set<Id> createEmailAddresses = new Set<Id>();
        List<Case> caseList = [select Id, 
                                    Subject, 
                                    CaseNumber, 
                                    Case_Reason__c, 
                                    Case_Issue__c, 
                                    Description, 
                                    Date_Time_of_Call__c, 
                                    VINumber__c, 
                                    Customer_s_VP__c, 
                                    Outbound_Audio__c,
                                    Case_Thread_ID__c,
                              (select Id from EmailMessages)
                              from Case where Id IN :caseRecords];

        String casethreadId = String.valueOf(Case.Case_Thread_ID__c);

        for(Case c: caseList){
            // Pulls field data from Case to include in the email body
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            String[] toaddr = new String[System.Label.custom_VIEmailAddresses.split(',')];
            string[] ccaddr = new string[]{};
            email.setSubject('FW: ' + c.CaseNumber + ' : ' + c.Case_Reason__c);
            email.setHtmlBody('Case Number: ' + c.CaseNumber
                                + '<br/>' + 
                                'Case Reason: ' + c.Case_Reason__c 
                                + '<br/>' +
                                'Case Issue: ' + c.Case_Issue__c 
                                + '<br/>' + 
                                + '<br/>' +
                                'Date/Time: ' + c.Date_Time_of_Call__c 
                                + '<br/>' + 
                                'VI #: ' + c.VINumber__c
                                + '<br/>' +
                                'Customer\'s VP #: ' + c.Customer_s_VP__c
                                + '<br/>' +
                                'Outbound Audio #: ' + c.Outbound_Audio__c
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                'Case Description: ' + c.Description 
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                '<i>' + '*Note: If there are any null values, this means this information was not provided by the Case Owner prior to this submission.' + '<i>'
                                + '<br/>' +
                                '<span style="color: #cccccc;">' + casethreadId + '</span>');
            email.setToAddresses(toaddr); 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
        }
        
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();   
        
    }  
}
HI All,

I have one custom VF page. I want to open th vf page on button click at lighting community. How can I achieve the functionality.
I am new in lightning 
Hi ,

I am getting a error
FIELD_CUSTOM_VALIDATION_EXCEPTION
when my trigger and Process builder both are active.

Thanks
 
Hi everyone,

I am working on Apex bulk api request. I have completed class and got stuck in test class. I have started the test class and need to know how to complete and pass 75% code coverage.

Apex Class:
@RestResource(urlMapping='/insertAccount/*')
global with sharing class insertAccount
{
    @HttpPost
    global static List<Id> doPost(insertAccount.reqAcc reqAccount) 
    {
        Set<String> emails = new Set<String>();
        List<insertAccount.reqAccount> accounts = reqAccount.Account;
        
        for(insertAccount.reqAccount ac : accounts)
        {
            emails.add(ac.email);
            System.debug('--- Account Email ---' + ac.email);
            System.debug('--- Adding Account Email  ---' + emails);
        }

        Map<String, Id> mapAccount = new Map<String, Id>();
        
        for(Account a : [SELECT Id, PersonEmail FROM Account WHERE PersonEmail IN: emails])
        {
            mapAccount.put(a.PersonEmail, a.Id);
            System.debug('--- Map Acc Email ---' + a.PersonEmail);
        }
                
        List<Account> accList = new List<Account>();        
        
        for(insertAccount.reqAccount ac : accounts)
        {
            Account acc = new Account();
            if(mapAccount.containsKey(ac.email))
            {
                acc.Id = mapAccount.get(ac.email);
            }
            acc.lastname = ac.lastname;
            acc.firstname = ac.firstname;
            acc.PersonMobilePhone = ac.mobile;
            acc.PersonEmail = ac.email;
            acc.Billingcity = ac.city;
            acc.BillingState = ac.state;
            acc.BillingCountry = ac.country;
            acc.BillingPostalcode = ac.postal;
            acc.phone = ac.phone;
            
            accList.add(acc);
        }
        
        List<Id> successIds = new List<Id>();
        
        if(!accList.isEmpty())
        {
            for(Database.UpsertResult upsertresult: Database.upsert(accList))
            {
                successIds.add(upsertresult.getId());
            }
        }
        return successIds;
    }
    
    global class reqAcc 
    {
            global List<insertAccount.reqAccount> account;
    }
    
    global class reqAccount
    {
        Public String lastname;
        Public String firstname;
        Public String phone;
        Public String mobile;
        Public String email;
        Public String city;
        Public String state;
        Public String country;
        Public String postal;
    }
}
Test Class:
@IsTest
private class insertAccountTest
{
    static testMethod void testPostMethod()
    {
        RestRequest request = new RestRequest();
        request.requestUri ='/services/apexrest/insertAccount';
        request.httpMethod = 'POST';
        RestContext.request = request;        
        
        String strId = insertAccount.doPost();
        System.assert(strId !=null );
    }
}
Thanks in Advance.

 
Hi Team,
I'm facing below error.
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]

Thanks
KMK
  • November 28, 2019
  • Like
  • 0
When I am trying to execute in lightning it show alert message 'Error in calling server side action ' how can I solve this can any one suggest me

Regards 
Srikanth
Hi all,

I had created ligtning button in uising lightning:button and i want to show error on it.
Anyone know how to do it?

I tried this but it dosen't work
var op = component.find("button1");
op.set("v.errors", [{message:"Select any one option"}]);

Thanks in advance