• Prakhyat sapra
  • NEWBIE
  • 50 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 62
    Questions
  • 39
    Replies
in the status flag field i am getting tag but not the image this source came from the formula field & I am using the lightning datatable in lwc
User-added image
how to check that how many queues are working in a bot in the salesfroce?
<apex:page controller="LineChartController">
  <apex:chart height="400" width="500" data="{!data}" >
    <apex:axis type="Numeric" position="left" fields="count" title="Count Of the Record"/>
    <apex:axis type="Category" position="bottom" fields="month" title="Month of the Year"/>
    <apex:lineSeries axis="left"  xField="month" markerType="circle" yField="count"/>
  </apex:chart>
</apex:page>
----------------------------------------------------
public with sharing class LineChartController {
  public List<Data> data { get; set; }

  public LineChartController() {
    data = new List<Data>();
    for (AggregateResult ar : [
        SELECT  Calendar_Month(Created_date__C)month,COUNT(Created_date__C)
        FROM Account
        GROUP BY Calendar_Month(Created_date__C)
        
    ]) 
    {
        System.debug('ar-----'+ar);
      data.add(new Data(
          
        (Integer) ar.get('month'),
          (Integer) ar.get('count')
        
      ));
    }
  }

  public class Data {
    public Integer month { get; set; }
      public Integer count { get; set; }
    
   

    public Data(Integer month,Integer count) {
      this.month = month;
        this.count = count;
      
     
        
    }
  }
}
insert account with related contacts through batch apex in salesforce?????
create 2 custom objects main Object & Copy Object then create 3 custom fields in both the objects 1-month picklist 2price fiend 3 name  field & then  there is no relation between in both the object & the condition is if we create record in the copy object the when the batch run then record is  already insert in the main object ?????? please help me to figger in out with this problem 
can anyone help me to iterate map.keyset in apex ??
Whenever the account is updated. Those related opportunities whose created date is above 30 days and the stage is closed won that opportunity stage convert in the closed lost.
Hiii team ,
when i click on the proceed to checkout. i got this 
The flow failed to start because the provided values were not valid: We ran into a problem trying to run your flow. Make sure your checkout flow is assigned to a store or contact your account rep. error .& my checkout flow is allready assign to the store... plrase help me to fix this...
thank you so much in advance 
how to show the product in the product detail page in the b2b commerce in salesfroce??
Can anyone help me to write the batch class & test class of this. in which i have to change the recordtype of all the record of account ?only one time 
I have 2 custom field in lead 1 is of text type & 2nd one is of lookup with lead. so when we create the lead & we filll th text in the 1st text type field & save the lead & again do the same & give the id of the that above lead record so that text field data of the above lead record will also show in the another lead record ???? plz. help me to work on this 
  global void execute(Database.BatchableContext BC, list<case> caseList){
        set<Id> getIDs = new Set<Id>();
        Map<Id,Id> caseWithCasePlanIdMap = new Map<Id,Id>();
        Map<Id, List<String>> casePlanWithGoalsMap = new Map<Id, List<String>>();
       
        for(Case cse : caseList){
            if(cse.Case_Plans__r != null && cse.Case_Plans__r.size() >0){
                caseWithCasePlanIdMap.put(cse.id, cse.Case_Plans__r[0].Id);
            }
        }
        system.debug('caseWithCasePlanIdMap'+caseWithCasePlanIdMap);
        Map<Id, case> caseMap = new Map<Id, case>(caseList);
        System.debug('caseMap'+caseMap);
        for(caseman__Goal__c goal : [SELECT Id,Name, caseman__CasePlan__c, caseman__Status__c FROM caseman__Goal__c 
                                     where caseman__CasePlan__c IN: caseWithCasePlanIdMap.values() AND caseman__Status__c !='Completed']){ // 'a0SM000000EBStkMAH' ]){
                                         System.debug('caseWithCasePlanIdMap.values()'+caseWithCasePlanIdMap.values());
                                         System.debug('goal'+goal);
                                         if(!casePlanWithGoalsMap.containskey(goal.caseman__CasePlan__c)){
                                             casePlanWithGoalsMap.put(goal.caseman__CasePlan__c, new List<String>());
                                         }
                                         casePlanWithGoalsMap.get(goal.caseman__CasePlan__c).add(goal.Name);
                                         casePlanWithGoalsMap.get(goal.caseman__CasePlan__c).add(goal.caseman__Status__c);
                                     }
        System.debug('casePlanWithGoalsMap'+casePlanWithGoalsMap);
        
        CaseSevenDayFollowUpEmailBatch.afterSevenDaysEmail(caseList,casePlanWithGoalsMap);

 global static void afterSevenDaysEmail(List<case> CaseList,  Map<Id, List<String>> casePlanData){
        System.debug('casePlanData'+casePlanData);
        // for(case cas : CaseList){
        //  for(caseman__CasePlan__c  c : cas.Case_Plans__r){
        // for(caseman__Goal__c  go :c.caseman__Goals__r){
        // List<caseman__CasePlan__c> casePlanList =[Select id, Name, caseman__Status__c From caseman__CasePlan__c WHERE caseman__Status__c!= 'Completed'];
        Integer casePlanLength= casePlanData.size();
        
        System.debug('casePlanLength'+casePlanLength);
        // }
        //}         
        // } 
        if(casePlanData.size() > 0){ //casePlanLength
            system.debug('casePlanData.size()'+casePlanData.size());
            //  Set<Id> casePlanId = new Set<Id>();
            
            
            Set<id> goalIdSet = new Set<Id>();
            for(case ca :CaseList){
                for(caseman__CasePlan__c casePlan1 : ca.Case_Plans__r){
                    System.debug('caseman__Goals__r'+casePlan1.caseman__Goals__r);
                    for(caseman__Goal__c goal : casePlan1.caseman__Goals__r){
                        
                        System.debug('goal - ' + goal);
                        goalIdSet.add(goal.Id);
                    }
                    
                    Map<id,List<caseman__ActionItem__c>> actionItemMap = new Map<id,List<caseman__ActionItem__c>>();
                    List<caseman__ActionItem__c> actionItemList = [Select Id,Name,caseman__Goal__c,caseman__Status__c
                                                                   from caseman__ActionItem__c where caseman__Goal__c =: goalIdSet];
                    System.debug('actionItemList'+actionItemList);
                    for(caseman__ActionItem__c item : actionItemList){
                        if(actionItemMap.containsKey(item.caseman__Goal__c))
                        {   
                            actionItemMap.get(item.caseman__Goal__c).add(item);
                            
                        }
                        else 
                        {   
                            actionItemMap.put(item.caseman__Goal__c,new list<caseman__ActionItem__c>{item}); 
                        }
                    }        
                    String casePlanStatus = '';
                        String caseGoalStatus = '';
                        if(iterCase.Case_Plans__r.size() > 0) {
                            casePlanStatus = '<br/>'+iterCase.Case_Plans__r[0].caseman__Status__c+'<br/>';
                            System.debug('casePlanStatus'+casePlanStatus);
                            System.debug('casePlanData - ' + casePlanData);
                            if(casePlanData.size() > 0){
                              //  System.debug('casePlanData - ' + casePlanData.get('caseman__Status__c'));
                                  caseGoalStatus = '<br/>'+casePlanData[1]+'<br/>';
                                System.debug('caseman__Goal__c.caseman__Status__c'+caseman__Goal__c.caseman__Status__c);
                                 System.debug('caseGoalStatus'+caseGoalStatus);
                            }
                        }
}
}



 
i have one chackbox type field in account. & if chackbox is false the account owner != contact owner & if true account owner != contact owner through trigger?????
How to write schedulable Batch class to send email on week,1st month,3rd month,6thmonth,9thmonth,12thmonth from createdDate???
Send email to those records the records that past 7days, 30days,90days,180,days,9 month & 1year through shaduled batch class 
how can i insert the a lead record through apex class?
I have to make a lwc component take 4 inputs from the screen for the obiect Lead. then on the click of save button it will direct to new component in this component. I need to fetch all the details which I saved in the previous screen. 
 
import { LightningElement } from 'lwc';
import { createRecord } from 'lightning/uiRecordApi';
import LeadObject from '@salesforce/schema/Lead';
import LeadLastName from '@salesforce/schema/Lead.LastName';
import LeadEmail from '@salesforce/schema/Lead.Email';
import LeadCompany from '@salesforce/schema/Lead.Company';
import LeadStatus from '@salesforce/schema/Lead.Status'
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class LeadForm extends LightningElement {
lastName = '';
emailId='';
Company='';
status= '';
LeadChangeVal(event) {
console.log(event.target.label);
console.log(event.target.value);
if(event.target.label=='Last Name'){
this.lastName = event.target.value;
}
if(event.target.label=='Company'){
this.Company = event.target.value;
}
if(event.target.label=='Email'){
this.emailId = event.target.value;
}
if(event.target.label=='Status'){
this.Status = event.target.value;
}
}
insertLeadAction(){
const fields = {};
fields[LeadLastName.fieldApiName] = this.lastName;
fields[LeadCompany.fieldApiName] = this.Company;
fields[LeadEmail.fieldApiName] = this.emailId;
fields[LeadStatus.fieldApiName] = this.Status;
const recordInput = { apiName: LeadObject.objectApiName, fields };
createRecord(recordInput)
.then(Leadobj=> {
this.LeadId = Leadobj.id;
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: 'Lead record has been created',
variant: 'success',
}),
);
})
.catch(error => {
this.dispatchEvent(
new ShowToastEvent({
title: 'Error creating record',
message: error.body.message,
variant: 'error',
}),
);
});
}
value = 'inProgress';
get options() {
return [
{ label: 'Open - Not Contacted ', value: 'Open - Not Contacted' },
{ label: ' Working - Contacted ', value: 'Working - Contacted' },
{ label: 'Closed - Converted ', value: 'Closed - Converted' },
{ label: 'Closed - Not Converted ', value: 'Closed - Not Converted ' },
];
}
handleChange(event) {
}
}
I have 1 org in which i search any user that user detail shows on the next page ?? through flow in salesforce
Open pdf which is uploaded in the document in Salesforce classic & i have to create the aura component in which I have to create the button by clicking the button the pdf will open in the new tab????
create the aura component for account with 4 fields & a save button in the aura component ???
Create the opportunity whose state is closewon & account is !null then update closedate__c on account as todat date by trigger handler ??
insert account with related contacts through batch apex in salesforce?????
Can anyone help me to write the batch class & test class of this. in which i have to change the recordtype of all the record of account ?only one time 
I have 2 custom field in lead 1 is of text type & 2nd one is of lookup with lead. so when we create the lead & we filll th text in the 1st text type field & save the lead & again do the same & give the id of the that above lead record so that text field data of the above lead record will also show in the another lead record ???? plz. help me to work on this 
  global void execute(Database.BatchableContext BC, list<case> caseList){
        set<Id> getIDs = new Set<Id>();
        Map<Id,Id> caseWithCasePlanIdMap = new Map<Id,Id>();
        Map<Id, List<String>> casePlanWithGoalsMap = new Map<Id, List<String>>();
       
        for(Case cse : caseList){
            if(cse.Case_Plans__r != null && cse.Case_Plans__r.size() >0){
                caseWithCasePlanIdMap.put(cse.id, cse.Case_Plans__r[0].Id);
            }
        }
        system.debug('caseWithCasePlanIdMap'+caseWithCasePlanIdMap);
        Map<Id, case> caseMap = new Map<Id, case>(caseList);
        System.debug('caseMap'+caseMap);
        for(caseman__Goal__c goal : [SELECT Id,Name, caseman__CasePlan__c, caseman__Status__c FROM caseman__Goal__c 
                                     where caseman__CasePlan__c IN: caseWithCasePlanIdMap.values() AND caseman__Status__c !='Completed']){ // 'a0SM000000EBStkMAH' ]){
                                         System.debug('caseWithCasePlanIdMap.values()'+caseWithCasePlanIdMap.values());
                                         System.debug('goal'+goal);
                                         if(!casePlanWithGoalsMap.containskey(goal.caseman__CasePlan__c)){
                                             casePlanWithGoalsMap.put(goal.caseman__CasePlan__c, new List<String>());
                                         }
                                         casePlanWithGoalsMap.get(goal.caseman__CasePlan__c).add(goal.Name);
                                         casePlanWithGoalsMap.get(goal.caseman__CasePlan__c).add(goal.caseman__Status__c);
                                     }
        System.debug('casePlanWithGoalsMap'+casePlanWithGoalsMap);
        
        CaseSevenDayFollowUpEmailBatch.afterSevenDaysEmail(caseList,casePlanWithGoalsMap);

 global static void afterSevenDaysEmail(List<case> CaseList,  Map<Id, List<String>> casePlanData){
        System.debug('casePlanData'+casePlanData);
        // for(case cas : CaseList){
        //  for(caseman__CasePlan__c  c : cas.Case_Plans__r){
        // for(caseman__Goal__c  go :c.caseman__Goals__r){
        // List<caseman__CasePlan__c> casePlanList =[Select id, Name, caseman__Status__c From caseman__CasePlan__c WHERE caseman__Status__c!= 'Completed'];
        Integer casePlanLength= casePlanData.size();
        
        System.debug('casePlanLength'+casePlanLength);
        // }
        //}         
        // } 
        if(casePlanData.size() > 0){ //casePlanLength
            system.debug('casePlanData.size()'+casePlanData.size());
            //  Set<Id> casePlanId = new Set<Id>();
            
            
            Set<id> goalIdSet = new Set<Id>();
            for(case ca :CaseList){
                for(caseman__CasePlan__c casePlan1 : ca.Case_Plans__r){
                    System.debug('caseman__Goals__r'+casePlan1.caseman__Goals__r);
                    for(caseman__Goal__c goal : casePlan1.caseman__Goals__r){
                        
                        System.debug('goal - ' + goal);
                        goalIdSet.add(goal.Id);
                    }
                    
                    Map<id,List<caseman__ActionItem__c>> actionItemMap = new Map<id,List<caseman__ActionItem__c>>();
                    List<caseman__ActionItem__c> actionItemList = [Select Id,Name,caseman__Goal__c,caseman__Status__c
                                                                   from caseman__ActionItem__c where caseman__Goal__c =: goalIdSet];
                    System.debug('actionItemList'+actionItemList);
                    for(caseman__ActionItem__c item : actionItemList){
                        if(actionItemMap.containsKey(item.caseman__Goal__c))
                        {   
                            actionItemMap.get(item.caseman__Goal__c).add(item);
                            
                        }
                        else 
                        {   
                            actionItemMap.put(item.caseman__Goal__c,new list<caseman__ActionItem__c>{item}); 
                        }
                    }        
                    String casePlanStatus = '';
                        String caseGoalStatus = '';
                        if(iterCase.Case_Plans__r.size() > 0) {
                            casePlanStatus = '<br/>'+iterCase.Case_Plans__r[0].caseman__Status__c+'<br/>';
                            System.debug('casePlanStatus'+casePlanStatus);
                            System.debug('casePlanData - ' + casePlanData);
                            if(casePlanData.size() > 0){
                              //  System.debug('casePlanData - ' + casePlanData.get('caseman__Status__c'));
                                  caseGoalStatus = '<br/>'+casePlanData[1]+'<br/>';
                                System.debug('caseman__Goal__c.caseman__Status__c'+caseman__Goal__c.caseman__Status__c);
                                 System.debug('caseGoalStatus'+caseGoalStatus);
                            }
                        }
}
}



 
write a batch class in which the contacts of all the accounts should be only 2.if more than 2 then it bocomes 2, or if less then it becomes2???????
getting account & there related contact through soql queary in the salesforce???
If i create project in salesforce, it should get create in jira 

global with sharing class Jiraproject {

global static void createproject(string Name) {
       
       JSONGenerator gen = JSON.createGenerator(true);

        gen.writeStartObject();
        gen.writeStringField('Name', Name);
        //gen.writeStringField('Id',Id);
        //gen.writeStringField('status__c',status__c);
        gen.writeEndObject();   
    String jsonString = gen.getAsString();
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('url');
request.setMethod('POST');

String username = 'kh@abc.com ';
String password = ' PcuTBIDoQ96784';
       Blob headerValue = Blob.valueOf(username + ':' + password);
    String authorizationHeader = 'Basic ' +
     EncodingUtil.base64Encode(headerValue);
     request.setHeader('Authorization', authorizationHeader);

request.setHeader('Content-Type','application/json;charset=UTF-8');
 // Set the body as a JSON object
 request.setBody (jsonString);

HttpResponse response = http.send(request);

// If the request is successful, parse the JSON response.
if(response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
} else {
    System.debug(response.getBody());
}
    
}
 
}
 can anyone guideme? Thanks in advance
how can i code for call this custom metadata in the apex class???User-added image
   fireSearchBox : function(component,event,helper){
        var searchBox;
        console.log('enter123456');
      
            //var value = searchBox.getSource().get("v.value");
        
        var action = component.get("c.search");
     action.setParams({"searchBox" :searchBox});
        action.setCallback(this,function(response){
            var state= response.getState();
            console.log('state',state);
            if (state=== "SUCCESS"){
                var response= response.getReturnValue();
                console.log('response',response);
                component.set("v.searchBoxs",response.getReturnValue());
            } 
            // component.set("v.productWrapper", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
    
The user creates the "Revenue" record and enters the Start Date, End Date, Price and Quantity.

If the total run time (End Date - Start Date) spans across more than one calendar month,
then Child Monthly Revenue will automatically be created.
Each Child will be broken out by calendar month and the Quantity will be divided
evenly by the number of days in each month.
Upon Save - the Total Amount gets calculated: (Quality*Price) Also, the system will
automatically create child Monthly Revenue records based on the following:

1. NO. of children would: no. of the month from Start Date to End Date.
2. The amount would be calculated as: (Total No. of Days in Current Month * Total Amount on
parent Revenue)/Total no of days from Start Date to End date on Revenue.
3. Start Date on Monthly Revenue: Start Date of the Current Month
4. End Date on Monthly Revenue: Last Date of the current Month ex. 31 for Jan, 28/29 For Feb
5. Revenue: Lookup of Revenue record
EXAMPLE:
The user enters the following data onto the Revenue record:
Start Date: 01/Oct/2018
End Date: 31/Dec/2018
Quantity: 100000
Price = 20
Monthly records would be created as:
# Total no. of Monthly records 3 (Oct, Nov, Dec), and total no of days: 92
1.
Oct 2018 (31 days)
Quantity = (31*100000)/92
Price = 20
Amount = Quantity*Price
Start Date = 01/Oct/2018
End Date = 31/Oct/2018

2.
Nov 2018 (30 days)
Quantity = (30*100000)/92
Price = 20
Amount = Quantity*Price
Start Date = 01/Nov/2018
End Date = 30/Nov/2018

3.
Dec 2018 (31 days)
Quantity = (31*100000)/92
Price = 20
Amount = Quantity*Price
Start Date = 01/Dec/2018
End Date = 31/Dec/2018
In the Visit__c object, if more than 2 visit are made in the name of the same owner, then the error is given that you can't create more than 2 visit  by the same owner ????by trigger
I have developed a vfpage which is rendering as PDF. but issue is it is not previewing in Salesforce mobile app rather it is redirecting to my mobile browser or asking Salesforce app? So how can I achieve it and can able to download in salesforce mobile app itself?Thanks in advance!
Hi Team,


Write a batch class for to delete all contacts of accounts where Account field : active__c="yes" ?


Please give me the reply to above scenario....

Regards
Lakshmi
Hi All ,
            I have a Requirement to Download the Visualforce Page as PDF When click on CommandButton


Here I have 2 - Visualforce Pages i have placed a Command Button in One of the Visualforce page when i click on this button the other visualforce page will Download as a PDF without pageredirection


Plese give me a Solution and Thanks in advance...
  • September 09, 2014
  • Like
  • 0