• Ram Chand Heerekar
  • NEWBIE
  • 89 Points
  • Member since 2019

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 28
    Replies
I had tried all ossible ways but not working any suggestion?
i wrote seperate method and call that in construtor even though I cant get the values
 
Hi Friends,
Is it possible for APEX to refer formula fields for example refering to a roll-up summary field.

Please let me know your answers.

Thanks,
JG
Hi There 

I'm Facing Below Error

Challenge Not yet complete... here's what's wrong:
The Fulfillment Creation process does not appear to be working properly. Please check that your task was created with all of the field values set appropriately.

User-added imageUser-added image
Assigned to ID - reference- [OpportunityLineItem].Opportunity.OwnerId
Related to ID - reference -[OpportunityLineItem].Opportunity.Id

Please Help me Out if provided suggestion works the answer will be marked as BEST.
I have a Scenario Where i have two fields as Status and description status is picklist and has Three Values as "One" ,"Two","Three" Now the scenario is if i select "one" then  the description  field should be editable(it should be visible but not be able to enter value for it) if i select "two" or "three" i should be able to edit that description 

Thanks in Adv
Hi There 

I'm Facing Below Error

Challenge Not yet complete... here's what's wrong:
The Fulfillment Creation process does not appear to be working properly. Please check that your task was created with all of the field values set appropriately.

User-added imageUser-added image
Assigned to ID - reference- [OpportunityLineItem].Opportunity.OwnerId
Related to ID - reference -[OpportunityLineItem].Opportunity.Id

Please Help me Out if provided suggestion works the answer will be marked as BEST.
I have created data table, as below. I am getting selectedRows is [object Object] in console when i select any row.

i supposed to get array of selected row.I guess i have done some  mistake in declaration of attributes (columns, data).Please clarify asap.



Component:::


<aura:component controller="ContactTopTen" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="columns" type="List" />
    <aura:attribute name="data" type="Object"  />
     <aura:handler name="init" value="{! this }" action="{! c.init }"/>
    <lightning:datatable aura:id="contactTable"
                         keyField="id"
                         data="{!v.data}"
                         columns="{!v.columns}"
                         hideCheckboxColumn="false"
                         onrowselection="{!c.doSelect}" />
                         
</aura:component>

Controller:
({
    init : function(component, event, helper) {
         component.set('v.columns',[
            {label: 'Account Name', fieldName: 'Name', type: 'text', sortable: true},
              {label: 'Rating', fieldName: 'Rating', type: 'text', sortable: true},
             ]);
             var action=component.get('c.getCon');
             action.setCallback(this, function(response){
             var state=response.getState();
             if(state==='SUCCESS' || state==='DRAFT')
             {
             var responseValue=response.getReturnValue();
             component.set('v.data', responseValue);
             }
             
             });
             $A.enqueueAction(action,false);            
        
    },
             doSelect:function(component, event, helper) {
             alert('Success');
             var selectedRows=event.getParam('selectedRows');
             console.log('selectedRows is : ' +selectedRows);
             }
})

Apex class:
public class ContactTopTen {

    @AuraEnabled
    public static List<Account> getCon(){
        
        List<Account> con=[select Name,Id, Rating from Account Limit 5];
        return con;
    }
}

 
VfPafe:
==========================
<apex:page controller="AssignmentEmail" >
    <apex:form >
        <apex:pageblock title="Send Email">
            <apex:pagemessages id="Showmsg"  />
            <apex:pageBlockSection columns="1">
                <apex:inputText label="To Address:" value="{!toEmail}" />
                <apex:inputText label="Subject:" value="{!Subject}"  />
                <apex:inputTextarea richtext="true" rows="20" value="{!Body}"/>
            </apex:pageBlockSection>
            <apex:pageblockbuttons >
                <apex:commandButton value="Send Email" action="{!SendEmailMain}" rerender="Showmsg"/>
            </apex:pageblockbuttons>
        </apex:pageblock>
    </apex:form>
</apex:page>
=======================================
apex class:
==============================
public class AssignmentEmail 
{    
    public string toEmail{get;set;}   
    public string Subject{get;set;}
    public string Body{get;set;}
    Public Boolean RequiredFieldcheck;
    
    public AssignmentEmail()
    {
        RequiredFieldcheck=true;
    }    
    Public void SendEmailMain()
    {
        If(toEmail=='')
        {
            ApexPages.addmessage ( new ApexPages.Message(ApexPages.Severity.Error,'Enter the Email address'));
            RequiredFieldcheck=false;
        }
        if(RequiredFieldcheck==true)
        {    
            SendEmail() ;  
        }
    }  
    
    public void SendEmail()
    {
        Messaging.SingleEmailMessage email= new Messaging.SingleEmailMessage(); 
        email.setSubject(Subject);
        email.setPlainTextBody(Body);
        List <string> Address = new List <string>();
        Address.add(toEmail);
        email.setToAddresses(Address);
        //Messaging.sendEmail(new messaging.SingleEmailMessage[] {email});
        List <messaging.SingleEmailMessage> mail = new List <messaging.SingleEmailMessage>();
        mail.add(email);
        messaging.sendEmail(mail);
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Email Sent successfully!'+' '+toEmail+ ': '+Address +' '+'With Subject : '+Subject));
    }   
}
 
Aura Components Basics - Connect to Salesforce with Server-Side Controllers
Getting below error in Save and Load Records with a Server-Side Controller

The Apex controller CampingListController doesn't have a 'getItems()' or 'saveItem(Camping_Item__c item)' method.
Hi All,

Account assosciated contact object need to create only one Record when status is Lead Source = web and other picklist values  can allow create records in contact object. How to write validation  for this?Please suggest me on this.

Thanks
KMK
  • May 18, 2020
  • Like
  • 0
I have a request to create a visualforce page to be used as a sub tab to display field values from a related object. I am using the code below but received the error "System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Equipment__c.Leasing_Company__c"

What am I missing in my extension or vf page? I'm not sure if this is the best way to accomplish what I'm trying to do so any suggestions would be helpful.
 
<apex:page standardController="Equipment__c" extensions="AgreementExtV2" lightningStylesheets="true"> 
       
 <apex:pageBlock id="agrDetails" title="Agreement Details">
     
      <apex:repeat value="{!$ObjectType.Agreements__c.FieldSets.Lease_Agreement}" var="f">
      <option value="{!$ObjectType.Agreements__c.Fields[f].localname}">{!$ObjectType.Agreements__c.Fields[f].label}</option>     
      <apex:outputField value="{!Equipment__c[f]}"/>      
     </apex:repeat>
     
  
  </apex:pageBlock>                
</apex:page>


public class AgreementExtV2 { 
public List<Agreements__c> agreement{get; set;} 
public List<Equipment__c> currentRecord{get; set;}

    public AgreementExtV2(ApexPages.StandardController controller) {
     currentRecord = [SELECT Id FROM Equipment__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')];  
	 agreement = [SELECT Id, Leasing_Company__c, Lease_ID__c, Lease_Exp_Date__c, Lease_Type__c, Leased_Amount__c, Lease_Rate__c, Lease_Term__c, Lease_Payment__c, Equipment__c FROM Agreements__c Where Equipment__c = :currentRecord]; 
	} 
}



 
Hello,

I have the following code that is being executed After Update:
public static void updatecasestatics(Opportunity opp, Opportunity oldOpp) {
        if (opp != oldOpp) {
            List<Case> cases = [SELECT ID, Opportunity_Name_Static__c, Opportunity_Type_Static__c, Opportunity_Unit_of_Measure_Static__c, Opportunity_Volume_Static__c, 
                                Opportunity_Comments_Static__c, Estimated_Volume_Start_Date_Static__c from Case
                                where Opportunity_Name__c = :opp.Id AND recordtype.developername='R_D_Innovation_Request'];
            if(cases != null){
                for(Case c : cases){
                    c.Opportunity_Name_Static__c = opp.Name;
                    c.Opportunity_Type_Static__c = opp.Type;
                    c.Opportunity_Unit_of_Measure_Static__c = opp.Unit_of_Measure__c;
                    c.Opportunity_Comments_Static__c = opp.Opportunity_Comments__c;
                    c.Estimated_Volume_Start_Date_Static__c = opp.Estimated_Volume_Start_Date__c;
                    c.Opportunity_Volume_Static__c = opp.Total_Primary_Opportunity_Volume__c;
                    c.Static_Fields_Changed_by_Code__c = true;
                }
                update cases;
                for(Case c : cases){
                    c.Static_Fields_Changed_by_Code__c = false;
                }
                update cases;
            }
            
        }
        
    }
When I'm updating via Data Loader 200 records in a batch I'm getting a Too Many SOQL error due to the Select that I'm doing, to try to fix it I have modified it to the following code but now I'm getting "OpportunityTrigger: System.LimitException: Apex CPU time limit exceeded"
public static void updatecasestatics(Opportunity oppo, Opportunity oldOpp) {
        
        List<Case> cases = [SELECT ID, Opportunity_Name_Static__c, Opportunity_Type_Static__c, Opportunity_Unit_of_Measure_Static__c, Opportunity_Volume_Static__c, 
                                Opportunity_Comments_Static__c, Estimated_Volume_Start_Date_Static__c, Opportunity_Name__c  from Case
                                where recordtype.developername='R_D_Innovation_Request' AND Opportunity_Name__c != null];
                                
        List<Case> casesUpdate = new List<Case>();

        for(Opportunity opp :(List<Opportunity>) Trigger.New){
            
            if(cases != null){
                for(Case c : cases){
                    if((opp.Id == c.Opportunity_Name__c) && !Approval.isLocked(c.Id)){
                        c.Opportunity_Name_Static__c = opp.Name;
                        c.Opportunity_Type_Static__c = opp.Type;
                        c.Opportunity_Unit_of_Measure_Static__c = opp.Unit_of_Measure__c;
                        c.Opportunity_Comments_Static__c = opp.Opportunity_Comments__c;
                        c.Estimated_Volume_Start_Date_Static__c = opp.Estimated_Volume_Start_Date__c;
                        c.Opportunity_Volume_Static__c = opp.Total_Primary_Opportunity_Volume__c;
                        c.Static_Fields_Changed_by_Code__c = true;
                        
                        casesUpdate.add(c);
                    }
                }
                //update cases;
                update casesUpdate;
                casesUpdate.clear();
                
                for(Case c : cases){
                    if((opp.Id == c.Opportunity_Name__c) && !Approval.isLocked(c.Id)){                    
                        c.Static_Fields_Changed_by_Code__c = false;
                        casesUpdate.add(c);
                    }
                }
               //update cases;
               update casesUpdate;
            }
            
        }
        
    }
Could you please help me? I just need to avoid the Too Many SOQL error.

Thanks, Iván.


 
I am getting NullPointerException for the below code. At second line(highlighted) the code is giving me exception.
Can anyone please suggest if there is any other way around or if I am missing anything. I can post the further code if required.

------------------------------------------------------------------------------------


public List<objectHistoryLine> getObjectHistory(){
    Id myObjectId = String.valueOf(myObject.get('Id'));
    //String myObjectIdString = String.valueOf(myObject.get('Id'));
    String myObjectAPIName;
    //String contactIdPrefix = Contact.SObjectType.getDescribe().getKeyPrefix();
    Schema.DescribeSObjectResult objectDescription = myObject.getSObjectType().getDescribe();
    
    myObjectFieldMap = objectDescription.fields.getMap();
    objectLabel = String.valueOf(objectDescription.getLabel());

-------------------------------------------------------------------------------------------   
    
Thanks in advance.
I am getting this as output when I am trying to run SFDX: Authorize an org in VS code.
Help me in resolving the issue.
Starting SFDX: Authorize an Org
13:02:46.506 sfdx force:auth:web:login --setalias VSCode --instanceurl https://login.salesforce.com --setdefaultusername
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=e75f878c347c^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=vIvnJJR396aRXdnc9JSWmxIOvv08N_gsT4ryB2VOsLg' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=e75f878c347c^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=vIvnJJR396aRXdnc9JSWmxIOvv08N_gsT4ryB2VOsLg' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=e75f878c347c^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=vIvnJJR396aRXdnc9JSWmxIOvv08N_gsT4ryB2VOsLg' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=e75f878c347c^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=vIvnJJR396aRXdnc9JSWmxIOvv08N_gsT4ryB2VOsLg' ] }
 
I had tried all ossible ways but not working any suggestion?
i wrote seperate method and call that in construtor even though I cant get the values
 

i want to update the field of the object and send mail with attachment  in which the updated field is mentioned I have to do these on a button click but because both are doing on one button click mail is sent and fields are get updated but the update field is not updated in the attached pdf of mail.

Can anyone help its urgent

Hi Every one,

I need to disable keyboard functionalites in salesforce lightning how can we do that ? 
Like  key E functionaliy while clicking E it's opening Edit details.. 
 If any one know please  help me .
 
Thanks
Surender reddy
Hi Friends,
Is it possible for APEX to refer formula fields for example refering to a roll-up summary field.

Please let me know your answers.

Thanks,
JG