• Lukesh Karmore
  • NEWBIE
  • 85 Points
  • Member since 2020

  • Chatter
    Feed
  • 2
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 70
    Questions
  • 84
    Replies
Hi guys, When i am starting to connect my org and visualforce, i am getting the below error.

Starting SFDX: Authorize an Org
22:50:06.500 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
22:50:06.501 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
 ended with error spawn C:\WINDOWS\system32\cmd.exe ENOENT



I am following this document for setup. please help
Hi,
I need to send email to the Opportunity owner with the list of Products (added in the Opportunity) when the Opportunity is Closed Won. I am unable to write the logic for iterating over the products.
Thanks.
Hii,
I send email using email alert in flow builder, but receive output as None.
not receive any email even if condition is trueyou can see Output: NOneThank You
I  have  2 levels of approval process ,Team 1 And Team 2. I need to restrict Team 2, Team 2 not able to approve the Opportunity  on certain condition . I mention criteria in  2 level  of approval process but it not works. is there any another way to restrict it.
can we use code to restrict it.
Thank You
I created record trigger flow which fires when checkbox is checked which is updated by Approval process ,but flow does not fire it does not catch the checkbox which is updated by approval process
I dont know what is the issue.
I use the trigger to update the checkbox from approval process

Thank you
I am using
finalBody+='<b>'+'Link : '+'</b>'+URL.getSalesforceBaseUrl().toExternalForm() + '/' +cl.id;
It is working on Android but not in Iphone.
Is there any way that links is works on both Android and iphone
Via setHtmlBody in  Messaging.SingleEmailMessage.



Thank you
hii can we use CSS in setHtmlBody  in Messaging.singleEmailMessage
I  am tryingh it but when send mail Css is not working
thank you
How to Fetch product releted Entitlement Process . Let say I have one Entitlement process called 'Premium support ' . I added it to product via Entitlement template . so i need to fetch it . any one have idea , i need product id  and Entitlement process Id .



Thank you
I have  Entitlement Template Releted list on product . I need to fetch Product With entitlement ,How can i do that .
Thank you
How to implement  Entitlement with Contract , It is available with service Contract but what about contract . Any one have idea how to implement with contract.


Thank you
I need Labels on Line charts ,How can i Add this labels my code is :

 <apex:chart height="400" width="700" data="{!ChartData}" animate="true" >
          <apex:axis type="Numeric" position="left" fields="data1" 
            title="Opportunities Closed" grid="false" gridFill="true"/>
          <apex:axis type="Category" position="bottom" fields="name" 
            title="Month of the Year">
        </apex:axis>
        <apex:lineSeries  tips="true" axis="left" fill="true" xField="name" yField="data1"
                         markerType="cross" markerSize="4" markerFill="#FF0000"  showInLegend="true" highlight="true" fillColor="blue">
         <apex:chartTips height="25" width="150"/>
                       <apex:chartLabel field="data1" display="outside" font="bold 14px Helvetica"  />
 </apex:lineSeries>
        
   </apex:chart>
Please relevent ans only,dont wase my question
Thank you 
This is my code :
String JSONStr = res.getbody();
System.debug('Json String '+res.getbody());
if(res.getstatusCode() == 200 && res.getbody() != null){
List<Object> fmap = (List<Object>)JSON.deserializeUntyped(JSONStr);
System.debug('First Json Map' + fmap);
for(Object o : fmap){
System.debug('Each Object '+ o);


}

}
debug shows duplicate id values but json contain unique Ids
how to store it. 
Thank you
User-added image
Hii Forum ,I have json as follow

[{"recordType":"cashsale","id":"200724","values":{"tranid":"Memorized","entity":[{"value":"3155","text":"100032 EJ's Pizzeria"}],"trandate":"03/04/2020","postingperiod":[{"value":"90","text":"Mar 2020"}],"amount":"140.00","item.itemid":"300-52-3100-S","item.displayname":"Revention Software Maintenance Monthly Subscription","item.salesdescription":"Revention Software Maintenance Monthly","type":[{"value":"CashSale","text":"Cash Sale"}]}}
VF code :
[15:08] Rahul Manjhi
 <apex:column headerValue="tranid" value="{!wrap.values.tranid}​​​​​​​"/>     <apex:column headerValue="item" value="{​​​​​​​!wrap.values.item.itemid}​​​​​​​"/> 
<apex:column headerValue="item" value="{​​​​​​​!wrap.item.itemid}​​​​​​​"/>          <apex:column headerValue="trandate" value="{​​​​​​​!wrap.values.trandate}​​​​​​​"/>                 
<apex:column headerValue="entity" value="{​​​​​​​!wrap.values.entity}​​​​​​​"/>                values.item.itemid gives null value how to get it any one have idea.
Thank you
Hii , I Integrate with external system   Post Call , With trigger when case status is Closed send CaseID__c (Custom Object) external system . i wrote trigger but found debug like Response---Method Not Allowed. Can any one sloved this problem.

public class SendCaseToNetSuite {
     @future (callout=true) 
    public static void UpdateCaseStatus(set<id>  SendCaseId){
       if(!SendCaseId.isEmpty()){ 
    List<case> caseList=[select id,caseId__c,Status from case where caseId__c != null And Id IN :SendCaseId];
         System.debug('caseList'+caseList);
        for(case c:caseList){ 
          //  JSONGenerator gen = JSON.createGenerator(true);
          // Write data to the JSON string.
         // gen.writeStartObject();
         // gen.writeNumberField('caseId',  c.caseId__c);
         // gen.writeEndObject();
          // Get the JSON string.
         // String pretty = gen.getAsString();
         
           Map<String, Integer> tags = new Map<String, Integer>();
            tags.put('caseId',Integer.valueOf(c.caseId__c));
            string endpoint = 'https://1074624-sb1.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=913&deploy=1&compid=1074624_SB1&h=9a5b4f34527b28b1f43d';
                HttpRequest req = new HttpRequest();
                req.setEndpoint(endpoint);
                req.setMethod('POST');
                req.setHeader('Content-type', 'application/json');
                //req.setBody(pretty);
               req.setbody(JSON.serialize(tags));
                Http http = new Http();
                HttpResponse res=new HttpResponse();
            try{
                res= http.send(req);
                system.debug('Output response:  ' +res.getBody());
            }
            catch(Exception e){
             system.debug('Error......' +e.getMessage());
            }
             
}
}
        
    }


}

Trigger;

trigger SendCaseToNetsuite on Case (before Update) {
    
    if(trigger.isBefore && trigger.isUpdate){
        set<id> SendCaseId=new set<id>();
         for(Case cases:trigger.new){
        if(cases.Status!=null && cases.Status=='Closed'){
            SendCaseId.add(cases.Id);
        }
         }
         if(!SendCaseId.isEmpty()){ 
        SendCaseToNetSuite.UpdateCaseStatus( SendCaseId);
    }
}
    }

Debug is:
Debug
Hi..If we need to get new data from external api and store in a new custom object in salesforce and run batch on daily basis how do we pass the list of data to start method from callout and response and insert?
i have  custom field product type on Opportunity  , when oppolineItem is created  i have to checck productFamily equal to product type  if not  then show error my code is

trigger CheckProductTypeonOppLineItem_whenItIsCreated on OpportunityLineItem (after insert) {
set<id> setIds=new set<id>();
for(OpportunityLineItem opp:Trigger.new){
    setIds.add(opp.Id);

list<OpportunityLineItem> opplist=[select id,opportunity.Product_type__c, Product2.Family from OpportunityLineItem where id In:setIds];
for(OpportunityLineItem o:opplist){
    if(o.Product2.Family != o.opportunity.Product_type__c){
      o.addError('Product family must be same ');
    }
}
}
any other way ot writing above trigger .
Thank you
i am Creating visulaForce page which shows selected opportunity
but my code is not working it not shows  selected opp
iam unable to find out where is the mistake
Help should be appriciated. Thank You
Here is my code :
<apex:page standardController="Opportunity" recordSetVar="Opps"  sidebar="false" showHeader="false" 
                                      extensions="ParamReceive" >
<apex:form>
    <apex:pageBlock>
        <apex:pageBlockSection>
           <apex:pageBlockTable value="{!Opps}" var="o" id="panel">
             <apex:column>
                 <apex:inputCheckbox>
                     <apex:actionSupport event="Onclick" action="{!doActionSupport}"  reRender="block,panel">
                     <apex:param name="names" value="{!o.Id}" assignTo="{!vfParam}" />
</apex:actionSupport>
                 </apex:inputCheckbox>
             </apex:column>
             <apex:column value="{!o.Name}"/>
             <apex:column value="{!o.stageName}"/>
             <apex:column value="{!o.CloseDate}"/>
             <apex:column value="{!o.Amount}"/>
             <apex:column value="{!o.AccountId}"/>
          </apex:pageBlockTable>
          <apex:outputPanel id="block">
          
          Selected Opportunity  : {!vfParam}<br></br>
        </apex:outputPanel>
        
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

Controller:
public  class ParamReceive {
        public String vfParam{get; set;}
        public ParamReceive(ApexPages.StandardSetController controller){
          
        }
        public PageReference doActionSupport(){
          // Do Something...
          System.debug('vfParam : ' + vfParam);
          return null;
        }
    }
      
      
Hello forum,
I want to know when to use Apex:ActionFunction .
we call  the controller method from javascript function using ActionFunction . I read this line in many blogs but why i call  controller method from javascript function, when actually i need it .
can any one explain me thank you in advance.
 
i want to display how many recrds retrive on this page like 10 or 20  as count at the bottom of vf page in custom controller
any one give me example 
Thank You
i am new to visualforce i created a page with customController that shows list of account and i want to update account  field within the list below is my code ,so any one please let me know where is the mistake
its not updating field

public class CustomController {
    list<account> acts;
    
    public list<account> getacts(){
        acts=new list<account>();
       acts=[select name,rating,industry,type from account where rating!=null AND type!=null limit 20];
        return acts;
    }
    public pageReference save(){
        update acts;
        return null;
    }
}

<apex:page  Controller="CustomController">
 <apex:form >
 <apex:pageBlock title="Account Display">
     <apex:pageBlockButtons location="bottom">
     <apex:commandButton value="save" action="{!save}"/>
     </apex:pageBlockButtons>
     <apex:pageMessages />
 <apex:pageBlockSection >
 <apex:pageBlockTable value="{!acts}" var="c">
 <apex:column value="{!c.name}"/>
 <apex:column value="{!c.rating}"/>
 <apex:column value="{!c.Industry}"/>
 <apex:column value="{!c.type}"/>
 </apex:pageBlockTable>
     <apex:inlineEditSupport />
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
</apex:page>
Thank You
i m writing trigger, created custom field  on product object  Total Quantity and Available Quantity .
i have to fill Available Quantity field when opportunityLineItem is Created
code is successfully deployed but not update  Available Quantity field

trigger AvailableQuantityonProductTrigger on OpportunityLineitem (after insert) {
    integer remainingQuantity=0;
    set<id> oliIds=new set<id>();
for(OpportunityLineitem o:Trigger.new){
    if(o.Quantity!=null){
    oliIds.add(o.id);
    }
 }
 list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,
 Product2.Available_Quantity__c FROM OpportunityLineitem WHERE id IN:oliIds];
 for(OpportunityLineitem oli:oliList){
    if(oli.Quantity!=null){
         remainingQuantity=integer.valueOf(oli.Product2.Total_Quantity__c) - integer.valueOf(oli.Quantity);
     }
     else{
         remainingQuantity=0;  
     }
     if(remainingQuantity!=null){
     oli.Product2.Available_Quantity__c=integer.valueOf(remainingQuantity);
     }
}
update oliList;
}
Thank you
i have to write soql query on product2 , means need to fetch products releted to OpportunitylineItem .
 list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,Product2.Available_Quantity__c FROM OpportunityLineitem 
I know  above way to query product. want to know below query that return same
 list<Product> ProductList=[SELECT id,name, Available_Quantity__c FROM Product where -------------
hope u understand my question any one know the answer
Thank you
Can any one explain me what is the use of picklistValueInfo  and EntityParticleId   can't  find any documents or provide me a document
Thank you
my edit commandLink i s not working , when click no response  check the below code  help me to find error:
controller class:
public class contactSaveandEditClass {
    public List<wrapperclass> contactList{get; set;}
    public integer RowIndex{get; set;}
    public wrapperclass objwrapper;
    public  contactSaveandEditClass(){
        list<contact> contacts=[select id,FirstName,LastName,Phone,Title from contact];
        contactList=new list<wrapperclass>();
    for(integer i=0;i<contacts.size(); i++){
        objwrapper=new wrapperclass(); 
        objwrapper.con=contacts[i];
        objwrapper.doEdit=false;
        objwrapper.RowNo=contacts.size();
        contactList.add(objwrapper);
    }
    }
        public PageReference  EditMethod(){
            if(contactList.size()>RowIndex){
                contactList[RowIndex].doEdit=true;
            }
            return null;
        }
         public pageReference SaveMethod(){
            if(contactList.size()>RowIndex){
                contactList[RowIndex].doEdit=false;
            }
            return null;
        }
         public class wrapperclass{
        public contact con{get; set;}
        public boolean doEdit{get; set;}
        public integer RowNo{get; set;}
    }
}

VF class:
<apex:page controller="contactSaveandEditClass">
    <apex:sectionHeader title="Contacts"/>
    <apex:form >
        <apex:pageblock id="acc" title="Contact List">
            <apex:pageBlockSection >
                <apex:pageblocktable value="{!contactList}" var="a">
                    <apex:column headerValue="Action">
                         <apex:commandlink action="{!EditMethod}" value="Edit" reRender="acc"  rendered="{!NOT(a.doEdit)}">
                             <apex:param Name="rowNumber"  Value="{!a.RowNo}"  assignTo="{!RowIndex}"/>
                        </apex:commandlink>
                     <apex:commandlink action="{!SaveMethod}" value="Save" reRender="acc"  rendered="{!(a.doEdit)}">
                             <apex:param Name="rowNumber"  Value="{!a.RowNo}"  assignTo="{!RowIndex}"/>
                        </apex:commandlink>
                    </apex:column>
                    <apex:column headerValue="FirstName" >
                        <apex:outputField value="{!a.con.FirstName}" rendered="{!NOT(a.doEdit)}" />
                        <apex:inputField value="{!a.con.FirstName}" rendered="{!(a.doEdit)}"/>
                     </apex:column>
                     <apex:column headerValue="LastName" >
                    <apex:outputField value="{!a.con.LastName}" rendered="{!NOT(a.doEdit)}" />
                     <apex:inputField value="{!a.con.LastName}" rendered="{!(a.doEdit)}"/>
                     </apex:column>
                    <apex:column headerValue="Phone">
                     <apex:outputField value="{!a.con.Phone}"  rendered="{!NOT(a.doEdit)}"/>
                     <apex:inputField value="{!a.con.Phone}" rendered="{!(a.doEdit)}"/>
                    </apex:column>
                    <apex:column headerValue="Title" > 
                     <apex:outputField value="{!a.con.Title}" rendered="{!NOT(a.doEdit)}"/>
                     <apex:inputField value="{!a.con.Title}"  rendered="{!(a.doEdit)}"/>
                    </apex:column>
                </apex:pageblocktable>
             </apex:pageBlockSection>
         </apex:pageblock>
     </apex:form>
</apex:page>
Thank You

Hello,

We would like to deactivate two apex triggers that are obsolete and are causing issues on our account and preventing us from using the a connector correctly. I went into a Sandbox to create a change set to deactivate these two triggers and made the change set available to production. Unfortunatly when I try to deploy it I am getting errors saying that my coverage is only of 69%. I try to run the fulls tests but am getting errors on things that are completely unrelated. I would really need to deactivate these two apex triggers. How can I proceed? 

 

I noticed the code coverage is at 0% in the sandbox... I don't really understand.

 

PS- I'm not a developper. The developper who coded this apex trigger has left the company.

I have  Entitlement Template Releted list on product . I need to fetch Product With entitlement ,How can i do that .
Thank you
Problem is when case raise along with attachmnet file is uploded but its fileextension is blank because of this im not able to view the file I try with trigger but shhowing error fileextension field is not writable
Hii , I Integrate with external system   Post Call , With trigger when case status is Closed send CaseID__c (Custom Object) external system . i wrote trigger but found debug like Response---Method Not Allowed. Can any one sloved this problem.

public class SendCaseToNetSuite {
     @future (callout=true) 
    public static void UpdateCaseStatus(set<id>  SendCaseId){
       if(!SendCaseId.isEmpty()){ 
    List<case> caseList=[select id,caseId__c,Status from case where caseId__c != null And Id IN :SendCaseId];
         System.debug('caseList'+caseList);
        for(case c:caseList){ 
          //  JSONGenerator gen = JSON.createGenerator(true);
          // Write data to the JSON string.
         // gen.writeStartObject();
         // gen.writeNumberField('caseId',  c.caseId__c);
         // gen.writeEndObject();
          // Get the JSON string.
         // String pretty = gen.getAsString();
         
           Map<String, Integer> tags = new Map<String, Integer>();
            tags.put('caseId',Integer.valueOf(c.caseId__c));
            string endpoint = 'https://1074624-sb1.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=913&deploy=1&compid=1074624_SB1&h=9a5b4f34527b28b1f43d';
                HttpRequest req = new HttpRequest();
                req.setEndpoint(endpoint);
                req.setMethod('POST');
                req.setHeader('Content-type', 'application/json');
                //req.setBody(pretty);
               req.setbody(JSON.serialize(tags));
                Http http = new Http();
                HttpResponse res=new HttpResponse();
            try{
                res= http.send(req);
                system.debug('Output response:  ' +res.getBody());
            }
            catch(Exception e){
             system.debug('Error......' +e.getMessage());
            }
             
}
}
        
    }


}

Trigger;

trigger SendCaseToNetsuite on Case (before Update) {
    
    if(trigger.isBefore && trigger.isUpdate){
        set<id> SendCaseId=new set<id>();
         for(Case cases:trigger.new){
        if(cases.Status!=null && cases.Status=='Closed'){
            SendCaseId.add(cases.Id);
        }
         }
         if(!SendCaseId.isEmpty()){ 
        SendCaseToNetSuite.UpdateCaseStatus( SendCaseId);
    }
}
    }

Debug is:
Debug
Hi all,
I was created the trigger on contentDocument obj for after insert . But when i upoload document from UI in Dev environment the created trigger was not firiing . please help
i have  custom field product type on Opportunity  , when oppolineItem is created  i have to checck productFamily equal to product type  if not  then show error my code is

trigger CheckProductTypeonOppLineItem_whenItIsCreated on OpportunityLineItem (after insert) {
set<id> setIds=new set<id>();
for(OpportunityLineItem opp:Trigger.new){
    setIds.add(opp.Id);

list<OpportunityLineItem> opplist=[select id,opportunity.Product_type__c, Product2.Family from OpportunityLineItem where id In:setIds];
for(OpportunityLineItem o:opplist){
    if(o.Product2.Family != o.opportunity.Product_type__c){
      o.addError('Product family must be same ');
    }
}
}
any other way ot writing above trigger .
Thank you
Hi All,

I was asked this Q in one of the interviews. Eliminate all duplicate values from a string. For Eg. I/P = 'THEMISSISSIPPI'
O/P = 'THEM' (all other values are truncated because they are duplicates)
Can you please help. Appreciate your response.

Thanks.
Hello forum,
I want to know when to use Apex:ActionFunction .
we call  the controller method from javascript function using ActionFunction . I read this line in many blogs but why i call  controller method from javascript function, when actually i need it .
can any one explain me thank you in advance.
 
i am new to visualforce i created a page with customController that shows list of account and i want to update account  field within the list below is my code ,so any one please let me know where is the mistake
its not updating field

public class CustomController {
    list<account> acts;
    
    public list<account> getacts(){
        acts=new list<account>();
       acts=[select name,rating,industry,type from account where rating!=null AND type!=null limit 20];
        return acts;
    }
    public pageReference save(){
        update acts;
        return null;
    }
}

<apex:page  Controller="CustomController">
 <apex:form >
 <apex:pageBlock title="Account Display">
     <apex:pageBlockButtons location="bottom">
     <apex:commandButton value="save" action="{!save}"/>
     </apex:pageBlockButtons>
     <apex:pageMessages />
 <apex:pageBlockSection >
 <apex:pageBlockTable value="{!acts}" var="c">
 <apex:column value="{!c.name}"/>
 <apex:column value="{!c.rating}"/>
 <apex:column value="{!c.Industry}"/>
 <apex:column value="{!c.type}"/>
 </apex:pageBlockTable>
     <apex:inlineEditSupport />
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
</apex:page>
Thank You
Hi All,

I have a pdf attached to files in Order records{PDF has a unique name so have to query based on it's name}. How to query it from the Order record and attach it to Classic Email Template. Please help me here. Thanks in Advance
i m writing trigger, created custom field  on product object  Total Quantity and Available Quantity .
i have to fill Available Quantity field when opportunityLineItem is Created
code is successfully deployed but not update  Available Quantity field

trigger AvailableQuantityonProductTrigger on OpportunityLineitem (after insert) {
    integer remainingQuantity=0;
    set<id> oliIds=new set<id>();
for(OpportunityLineitem o:Trigger.new){
    if(o.Quantity!=null){
    oliIds.add(o.id);
    }
 }
 list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,
 Product2.Available_Quantity__c FROM OpportunityLineitem WHERE id IN:oliIds];
 for(OpportunityLineitem oli:oliList){
    if(oli.Quantity!=null){
         remainingQuantity=integer.valueOf(oli.Product2.Total_Quantity__c) - integer.valueOf(oli.Quantity);
     }
     else{
         remainingQuantity=0;  
     }
     if(remainingQuantity!=null){
     oli.Product2.Available_Quantity__c=integer.valueOf(remainingQuantity);
     }
}
update oliList;
}
Thank you
Hi guys, When i am starting to connect my org and visualforce, i am getting the below error.

Starting SFDX: Authorize an Org
22:50:06.500 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
22:50:06.501 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
 ended with error spawn C:\WINDOWS\system32\cmd.exe ENOENT



I am following this document for setup. please help
so im trying to update all acoounts phone numbers, only when their Parent Account phone number is updated, but its not working, and my loop doesnt even iterate for some reason? whats wrong with code?

trigger UpdatePhoneNum on Account (before update) {

for(Account a : trigger.new)
{
if(String.isNotBlank(a.ParentId)){
Account acc = [SELECT Phone FROM Account WHERE Id = :a.ParentId LIMIT 1];
a.Phone = acc.Phone;
}
}
}
i have to write soql query on product2 , means need to fetch products releted to OpportunitylineItem .
 list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,Product2.Available_Quantity__c FROM OpportunityLineitem 
I know  above way to query product. want to know below query that return same
 list<Product> ProductList=[SELECT id,name, Available_Quantity__c FROM Product where -------------
hope u understand my question any one know the answer
Thank you
Hi,


My Name is Naresh am i hve Done HR Recruitement Project Which has given by Sales force Fundamentals. Now am Planing to DO any other Prject , So if you have any Sampe Project Documentation PDF Please forward me to my Mail. nareshmnk440@gmail.com please mention Subject as SFDC Project....


Thanks& Regards 
Naresh

Hey, is there any WhatsApp group available for salesforce developers? I want to list down it on https://wagrouplink.com

thank you.