• Gauravendra
  • SMARTIE
  • 680 Points
  • Member since 2018
  • Salesforce Developer
  • https://graspsalesforce.blogspot.com/


  • Chatter
    Feed
  • 21
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 104
    Replies
Hello guys,
I am connecting to Salesforce in Apache NiFi using Reliersoft JDBC driver.
But I cannot connect because of this issue: "Cannot create PoolableConnectionFactory (Login to "login.salesforce.com" failed: Invalid username, password, security token; or user locked out.)".

I created connection string based on their documentation and it looks this way: 
jdbc:sforce://login.salesforce.com?user="my_username"&password="my_password"&token="my_token"&api=50.0
Here is database driver class name: 
com.reliersoft.sforce.jdbc.Driver

Also I tried to use combination password+token but the error remains.
The username, password and token are 100% correct. The user is not locked out.
Moreover, when I am using CData JDBC driver, everything works fine.

Please let me know what else can be an issue except incorrect username/password/token?
  • February 03, 2021
  • Like
  • 0
Hello,
I want to get the value of the fields in a complex type through a SOQL query.
for(SearchLayout l : [
    SELECT FieldsDisplayed from SearchLayout 
    WHERE EntityDefinition.QualifiedApiName='Contact' AND LayoutType='Lookup']) {
  System.debug(l.FieldsDisplayed);
}
FieldsDisplay is a complex type containing the fields string property.
How can I read this value?
Thanks for your help!
  • February 02, 2021
  • Like
  • 0
Hi folks,
Below logic for 
When Deal Team records created, then same records created into Opp Team member records .
But , i required Logic AS :
If already records available in Opp Team Member , Then we can skip and create only new records
can any one helpme how to write logic for this :

global class BatchClass implements Database.Batchable<sobject>{
    
   Set<Id> dealIds = new Set<Id>();
   String sQuery;
   map<id, opportunity> mapOppIdRec = new map<id, opportunity>();
    // Start Method
    global Database.Querylocator start (Database.BatchableContext BC) {
        String sQuery;
       List<Deal_Team__c> listDealIds = [SELECT Name, Description, Deal__c FROM Deal_Team__c WHERE createdDate = yesterday];
       if (listDealIds.size()>0){
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c'; 
        }else {
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c where id=null';
        }
        return Database.getQueryLocator(sQuery);
    }
    
    // Execute method
    global void execute (Database.BatchableContext bc , List<Deal_Team__c> records){
        if (records.size()>0){
            List<OpportunityTeamMember> listToBeInserted = new List<OpportunityTeamMember>();           
            for (Deal_Team__c dealTeams : records){ 
            OpportunityTeamMember newOtm = new OpportunityTeamMember();
            newOtm.OpportunityId = dealTeams.Deal__c;
            //newOtm.CreatedBy = 'OpportunityTeamMember is created by' +userInfo.getUserId();
            listToBeInserted.add(newOtm);
            }         
            upsert listToBeInserted;     
        }
    }
 
    // Finish Method
    global void finish(Database.BatchableContext BC) {}
}
  • February 01, 2021
  • Like
  • 0
help me with trigger code.
An object has FirstName and LastName field, if we try to create a record with same FristName and LastName, record should not create(throws error).
 
I have created an Aura component which is a table.
I wish to visualize it in the page of each contact, for example in the Details tab.
How can I do that?

Thanks
-we are currently sending all the Invoices from the Platform to Salesforce (via the famous web-service)
-by having those invoices in SF, we can create reports
-but could we report on those invoice by simply doing an “api call” or something similar to the Platform instead of storing the data in SF (ie instead of duplicating in SF the data that is in the Platform)?
I would like to keep track of the instance names of orgs I am the administrator for without having to manually handle instance refreshes. Periodically querying those orgs would allow me to access a reletively up-to-date list of clients that are affected by issues listed on trust.salesforce.com.

Is this possible?
Hello,
i dont see the option to manuallu share the lead to a user, how can i do it.
thansk for suggestion
HI Wondering if anyone can help a newbie here in trouble !  

I'm trying to write a test class for this class which uses an ivokable method callled by process builder. I'm getting the following error on the test class can anyone direct me as to where i'm going wrong ? 
: Compile Error: Method does not exist or incorrect signature: void invokeapexcallout(List<String>, List<Id>) from the type MakeApexCallout at line 29 column 28

Here is my class : 

public class MakeApexCallout {

  @InvocableMethod(label='callout')
   public static void invokeapexcallout(list<Account> acc) {
     Futureapexcallout.apexcallout(acc[0].Siret_Number__c,acc[0].Id);
   }
}


My Test Class 

@IsTest

public Class MakeApexCalloutTest {

static testMethod void CallOutTest() {

   

// Create Account
          
        Account acc = new Account();

        acc.Name = 'test Account';

        acc.Siret_Number__c = '42097142600035';
        
        insert acc;
            
           List<Id> AccountIds = new List<Id>(); 
           AccountIds.add(acc.Id);
           List<String> SiretNumbers= new List<String>();
          
          SiretNumbers.add(acc.Siret_Number__c);


            Test.startTest();

         
           MakeApexCallout.invokeapexcallout(SiretNumbers, AccountIds);
            Test.stopTest();

}}


 
Hi All,
      i want to develope a batch for my requirement is to Fetch All opportunities which  has recordtype =time rack , 
       and check if their name STARTS with  thier Related account's name then update name of opportunity  Should be in this format - {!Account.Name} : Opportunity Name and populate Opportunity's field Customer Type = 'End User' on opportunity.

Ex:  Opportunity name is ABC 1234 and account name is ABC  Than after running the batch OppName would become- ABC: 1234 and its customer type should become -'End User'
Im not sure how to get started unit test this method below.
private static double setAfterSave(Opportunity deal) { 
        double returnValue;
        if(deal.Restaurant__c) {            
          returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        } else {
           returnValue = deal.HVAC__c == null ? 0 : deal.HVAC__c;
        }
        return returnValue;
    }
  • March 05, 2019
  • Like
  • 0
var action = component.get("c.fetchData");
   action.setCallback(this, function(response) {
                        var state = response.getState();
                        console.log("State " + state);
                        if (state === "SUCCESS") {
                            var storeResponse = response.getReturnValue();
                            component.set("v.Customer", storeResponse);
                            var Credit = storeResponse.field__c;
                            console.log("Credit  "+Credit);
                        } });
                    $A.enqueueAction(action);
                }

Not able to access "response.getReturnValue();" outside of setcallback, How to do that ?
  • June 08, 2018
  • Like
  • 0
Hi Guys - I have written a controller which is being used in an vf component. My issue is I need to display adresses comma seperated.
pls suggest 

controller
------------
public with sharing class DisplayList{ 
    public List<Address__c> Records {get; set;} 
    
    public DisplayList(){ 
    Records = [SELECT Name 
               FROM Address__c
               WHERE Billing_Account__c = :ApexPages.currentPage().getParameters().get('Id')];
    system.debug('record-->'+Records); 
    } 
 }
vf component snippet
=----------------------------
 </apex:repeat>
        <apex:repeat value="{!Records}" var="Record">
         <div><span>Service Addresses:</span><span><apex:outputText value="{!Record.Name}" escape="false"/></span></div>
    </apex:repeat>
 
Hi,
I am trying to display the opportunitycontactroles list on an object (Deal_Desk_Request__c) related to the opportunity.  I am not getting errors when saving the code, but nothing is appearing in the visualforce page other than the headers.  I am new to apex/visualforce development and not sure what I am doing wrong.  Can someone please help?

Here is the visualforce page:
<apex:page standardcontroller="deal_desk_request__c" extensions="dealdeskcontactrole" >
  <apex:pageblock >
      <apex:pageblocktable value="{!roles}" var="role">
          <apex:column headervalue="Contact" >
                      <apex:outputfield value="{!role.contactid}"/>
                      </apex:column>     
          <apex:column headervalue="Role" >
                      <apex:outputfield value="{!role.role}"/>
                      </apex:column>           
          <apex:column headervalue="Primary" >
                      <apex:outputfield value="{!role.isprimary}"/>
                      </apex:column>           


      </apex:pageblocktable>
  </apex:pageblock>
</apex:page>

Here is the extension class:
public with sharing class dealdeskcontactrole {
list<opportunitycontactrole> roles;
 public final Deal_Desk_Request__c DDR;
    public dealdeskcontactrole(ApexPages.StandardController controller) {
   
        this.DDR = (Deal_Desk_Request__c)controller.getRecord();
    }

    public list<opportunitycontactrole> getroles() {
        try{
        list<opportunitycontactrole> roles = [select id, contactID, Role, Isprimary from opportunitycontactrole where Opportunityid =: DDR.Opportunity__r.id];
         return roles;
        }
        catch(system.exception e){
        return null;
        }     
    }
   }

 
Hi Team,

I have amount__c in both contact and account . if account has many contacts  and i need to update highest amount of contacts and update that into account amount field ?

Ex : ABC account   Amount__c  =

       Contact1 :  T -- Amount__c = 500$
       Contact2 :  A -- Amount__c = 700$
       Contact3 :  B -- Amount__c =300$

now account amount__c need to update with 700$ . how can i acheive it using trigger
I have a requirement for PAN Number field should include 5 text, 4 Number and 1 Text characters should include for that i wrote validation rule.
Rule passed succesfully, but record is not saving in any formates. Can you please let me know the my mistake.

NOT(AND( 
(REGEX( PAN_Number__c , "[A-Z][a-z]{5}[0-9]{4}[A-Z][a-z]{1}") ), 
LEN( PAN_Number__c) <> 10))

User-added image
Thanks in Advance!
SyamReddy.
Hi Guys,

I have a requirement ..i  need to create a visualforce page which will display all account names in custom picklist.
Please help me on this.

Thanks in Advance.
Smitha
Hi, 
I want to develop a page which has two radio button as options : radio1  and radio2 . on click of radio1 a form of account should be avaialble and on click of radio2 a form of contact should be available. 

I have my code but on click of both radio button it is redirecting to contact page only. can u help me to solve my issue

<apex:page controller="AccController">
 <apex:form >
 <apex:pageBlock id="pgblk"> 
 <apex:selectRadio id="radioid" layout="pageDirection">
 <apex:selectOption  itemLabel="radio1" itemValue="1"></apex:selectOption>
 <apex:actionSupport event="onclick" action="{!AccForm}">
 </apex:actionSupport>
 
 <apex:selectOption itemLabel="radio2" itemValue="2"></apex:selectOption>
 <apex:actionSupport event="onclick" action="{!ContForm}">
 </apex:actionSupport>
 </apex:selectRadio>
 
 </apex:pageBlock>
 </apex:form>
</apex:page>

Here is my controller
public class AccController 
{
 public PageReference AccForm()
 {
 PageReference Page = new PageReference('/apex/CreateAcc');
 Page.setRedirect(true);
 return Page;
 }
 
 public PageReference ContForm()
 {
 PageReference Page = new PageReference('/apex/CreateContact');
 Page.setRedirect(true);
 return Page;
 }
}
while saving 11th  record it should show an error while saving that limit had exceeded

I am trying to display a selectList in a visualforce page using a custom controller i built.

I get an "List has no rows for assignment to SObject" error when trying to preview the page, but running the query in the developer console, returns the rows.

here is my page:
 

<apex:page Controller="BpmIcountPayment">
    <apex:param name="first_name" value="Account.FirstName"/>
    <apex:param name="last_name" value="Account.LastName"/>
    <apex:param name="id" value="Account.idnumber__c"/>
    <apex:param name="address" value="Account.Address"/>
    <apex:form >
        <apex:selectList value="{!productsTitle}" multiselect="false">
            <apex:selectOptions value="{!ProductsLov}"></apex:selectOptions>
        </apex:selectList>
        </apex:form>
</apex:page>

and my controller:

public class BpmIcountPayment{

    private final Account account;

    public String productsTitle {
      get { return 'products for sale'; }
      set;
    }
 
    public BpmIcountPayment() {
        account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public List<SelectOption> getProductsLov() {
        List<SelectOption> products = new List<SelectOption>();
        List<Product2> productsList = [SELECT Id, Name, Family 
                                      FROM Product2 
                                      WHERE (Family = 'ShopProduct') 
                                      OR (Family = 'CourseParent') 
                                      OR (Family = 'SFCourseProgram')];

        system.debug(productsList);
        for (Product2 currProduct : productsList) {
            products.add(new SelectOption(currProduct.Id, currProduct.Name));
        }

        return products;
    }
}
I've two objects(Obj1 & Obj2), i will have to fetch the data in obj1. And based on the fields data in obj1, i've to query the data in Obj2.
global Class batchapex1 implements Database.Batchable<sObject>{
    Public Set<String> passeddata{get; set;}
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator([Select fld1,fld2,fld3 from Obj1 where fld1 in: passeddata]);
    }
    global void execute(Database.BatchableContext BC, List<Obj1> Obj1List){
        
    }
    global void finish(Database.BatchableContext BC){
        
    }
}
But here based on the Obj1 query data, i'will have to fetch the obj2 data like below
Set<String> obj1data= new Set<String>();
for(Objj1 i:Obj1List){
    obj1data.add(i.fld1)
}
if(obj1data.size() > 0){
    Obj2List = [Select fld1,fld2,fld3 from Obj2 where fld1 in: obj1data];
}
//some calculations happen comparing the obj1 data & obj2 data and finally update obj1 data

The concern here is two objects returns large data around 1lakh records each. i would like to have both the queries are returned through querylocator as many no. of records(50M) can be queried through query locator. Please advise
Need DML update details in trigger or apex.
if any field is updated? is there way to find that DML update happened from either manual or Data Loader or some other API.

Requirement:- If I update any field manually, do not want to update the same field from data loader or some other API.
Hello guys,
I am connecting to Salesforce in Apache NiFi using Reliersoft JDBC driver.
But I cannot connect because of this issue: "Cannot create PoolableConnectionFactory (Login to "login.salesforce.com" failed: Invalid username, password, security token; or user locked out.)".

I created connection string based on their documentation and it looks this way: 
jdbc:sforce://login.salesforce.com?user="my_username"&password="my_password"&token="my_token"&api=50.0
Here is database driver class name: 
com.reliersoft.sforce.jdbc.Driver

Also I tried to use combination password+token but the error remains.
The username, password and token are 100% correct. The user is not locked out.
Moreover, when I am using CData JDBC driver, everything works fine.

Please let me know what else can be an issue except incorrect username/password/token?
  • February 03, 2021
  • Like
  • 0
Hello,
We have an Apex that was built by a priavte consultant back on November 2020 that would update the Owner Field on a Custom Object when their related Approval flow is reassigned to someone else. It appeared to be working fine and on January 13th 2020 we rolled the training on the Custom Object and I started reciving these error emails that same day and have every day since.
Error email body recieved daily:
Apex script unhandled exception by user/organization: 0051N000005gh9F/00D1N000002Jn2i

Failed to process batch for class 'SyncOwnerNameWithApproverBatch' for job id '7073l0000EQiAzS'

caused by: System.NullPointerException: Attempt to de-reference a null object


SF Support pointed me to this knowledge article but since I am and Admin and not a developer, I don't know what that all means or how the code would need to be modified. Also the Code Coverage is showing 0% (0/26) and I was told it has to be above 70%.
Knowledge Article: https://help.salesforce.com/articleView?id=000327918&type=1&mode=1

Below is what is in the Apex Code and I am hoping you all can provide some feedback on what needs to be modified as the Develpoer we used has told me we would have to pay him at this point to figure what the issue is and I don't want to go to my manager without any research of my own if we do need to pay someone again to fix this.

Apex Class Body:
/***************************************************************************************************************
* @author: AutomationChampion
* @Description: Batch Job to Sync Bid Approval Owner to be same as the Approver of the Approval Process
* @LastModifiedBy: Automation Champion
* @version 1.0
*
* Version History
* -------------------------------------------------------------------------------------------------------------
* Version  | Date      | Name      | Details of Change
* -------------------------------------------------------------------------------------------------------------
* 1.0.0    | 24-Nov-2020  | AChamp    | Created
* *************************************************************************************************************/

global class SyncOwnerNameWithApproverBatch implements Database.Batchable<sObject> {
    
    //Variable to hold the Object Prefix of the Bid Approval Object.
    global String keyPrefix = '';
    
    /*************************************************************************************
     * @author: AutomationChampion
     * @Description: Constructor to set the Object Prefix from Scheduleable class
     * @return: void
     * 
     * Change History
     * -----------------------------------------------------------------------------------
     * Date      | Name      | Details of Change
     * -----------------------------------------------------------------------------------
     * 24-Nov-2020  | AChamp    | Created
     * ***********************************************************************************/
    global SyncOwnerNameWithApproverBatch(String keyPrefix) {
        this.keyPrefix = keyPrefix;
        System.debug('@@ KeyPrefix from Scheduler @@ ' + keyPrefix);
    }
    
    /*************************************************************************************
     * @author: AutomationChampion
     * @Description: Start Method of the batch Class
     * @return: QueryLocator
     * 
     * Change History
     * -----------------------------------------------------------------------------------
     * Date      | Name      | Details of Change
     * -----------------------------------------------------------------------------------
     * 24-Nov-2020  | AChamp    | Created
     * ***********************************************************************************/
    global Database.QueryLocator start(Database.BatchableContext bc) {
       String objStartId = '';
       String query = 'SELECT Id, ProcessInstanceId, ProcessInstance.TargetObjectId, Actor.Name FROM ProcessInstanceWorkItem WHERE ProcessInstance.SystemModStamp > = LAST_N_DAYS:1';

        if(String.isNotBlank(keyPrefix)) {
            objStartId = keyPrefix + '000000000000';
            
            query += ' AND ProcessInstance.TargetObjectId > \'' + objStartId + '\'';
        }
        System.debug('@@ Final Query @@ ' + query);
        return Database.getQueryLocator(query);
    }
    
    /*************************************************************************************
     * @author: AutomationChampion
     * @Description: Execute Method to process the logic to identify which Bid Record 
     * Owners should be updated based on the approval process owners
     * @return: void
     * 
     * Change History
     * -----------------------------------------------------------------------------------
     * Date      | Name      | Details of Change
     * -----------------------------------------------------------------------------------
     * 24-Nov-2020  | AChamp    | Created
     * ***********************************************************************************/
    global void execute(Database.BatchableContext bc, list<sObject> scope) {
        
        //Collect the recordIds in a collection
        Set<Id> recordIds = new Set<Id>();
        
        //List to update the OwnerId
        List<BID_Approval__c> lstUpdateBidApproval = new List<BID_Approval__c>();
        
        //Loop through the records to get the RecordId and ApprovalProcess Ids
        for(sObject record :scope) {
            ProcessInstanceWorkItem approvalWorkItem = (ProcessInstanceWorkItem)record;
            recordIds.add(approvalWorkItem.ProcessInstance.TargetObjectId);
        }
        
        
        //Query the BID APPROVALS object 
        Map<Id, BID_Approval__c> mapBidApproval = new Map<Id, BID_Approval__c>([SELECT Id, OwnerId, Owner.Name FROM BID_Approval__c WHERE Id IN :recordIds]);

        for(sObject record :scope) {
             ProcessInstanceWorkItem approvalWorkItem = (ProcessInstanceWorkItem)record;
            
            //Get the Bid Approval record from the MAP 
            BID_Approval__c objBidApproval = mapBidApproval.get(approvalWorkItem.ProcessInstance.TargetObjectId);
            if(objBidApproval.OwnerId <> approvalWorkItem.ActorId) {
                //Assign the Approval Process owner to the ownerid in bid approval record
                objBidApproval.OwnerId = approvalWorkItem.ActorId;
                lstUpdateBidApproval.add(objBidApproval);
            }
            
        }
        
        //Update the Bid Approval Records
        if(lstUpdateBidApproval != null && lstUpdateBidApproval.size() > 0) {
             System.debug('@@ lstUpdateBidApproval @@ ' + lstUpdateBidApproval);
            update lstUpdateBidApproval;
        }
    }
    
    /*************************************************************************************
     * @author: AutomationChampion
     * @Description: Finish Method of the Batch Class
     * @return: void
     * 
     * Change History
     * -----------------------------------------------------------------------------------
     * Date      | Name      | Details of Change
     * -----------------------------------------------------------------------------------
     * 24-Nov-2020  | AChamp    | Created
     * ***********************************************************************************/
    global void finish (Database.BatchableContext bc) {
        
    }
}

 
Hello,
I want to get the value of the fields in a complex type through a SOQL query.
for(SearchLayout l : [
    SELECT FieldsDisplayed from SearchLayout 
    WHERE EntityDefinition.QualifiedApiName='Contact' AND LayoutType='Lookup']) {
  System.debug(l.FieldsDisplayed);
}
FieldsDisplay is a complex type containing the fields string property.
How can I read this value?
Thanks for your help!
  • February 02, 2021
  • Like
  • 0
Hi All,

I have a dropdown field (Delivery_Time__c), it has the below options:

Software Electronic License: 2 - 5 days
Dongle: 1 - 2 weeks
Hardware: 4- 8 weeks

I need a seperate field(field not created yet) that when one of the above is selected it will give me a date in the future from the date it was selected. For example:

If the first option is selected then it need to be Today()+5days 
If the second option is selected then it need to be Today()+14days 
If the third option is selected then it need to be Today()+56days 

if you need any additional info let me know and hope the above makes sense... 

thanks!!

 
Hi folks,
Below logic for 
When Deal Team records created, then same records created into Opp Team member records .
But , i required Logic AS :
If already records available in Opp Team Member , Then we can skip and create only new records
can any one helpme how to write logic for this :

global class BatchClass implements Database.Batchable<sobject>{
    
   Set<Id> dealIds = new Set<Id>();
   String sQuery;
   map<id, opportunity> mapOppIdRec = new map<id, opportunity>();
    // Start Method
    global Database.Querylocator start (Database.BatchableContext BC) {
        String sQuery;
       List<Deal_Team__c> listDealIds = [SELECT Name, Description, Deal__c FROM Deal_Team__c WHERE createdDate = yesterday];
       if (listDealIds.size()>0){
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c'; 
        }else {
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c where id=null';
        }
        return Database.getQueryLocator(sQuery);
    }
    
    // Execute method
    global void execute (Database.BatchableContext bc , List<Deal_Team__c> records){
        if (records.size()>0){
            List<OpportunityTeamMember> listToBeInserted = new List<OpportunityTeamMember>();           
            for (Deal_Team__c dealTeams : records){ 
            OpportunityTeamMember newOtm = new OpportunityTeamMember();
            newOtm.OpportunityId = dealTeams.Deal__c;
            //newOtm.CreatedBy = 'OpportunityTeamMember is created by' +userInfo.getUserId();
            listToBeInserted.add(newOtm);
            }         
            upsert listToBeInserted;     
        }
    }
 
    // Finish Method
    global void finish(Database.BatchableContext BC) {}
}
  • February 01, 2021
  • Like
  • 0
Hi,
I have 2 input fields. Once both the values are entered, I need to show its sum on the screen.  I tried but it doesn't work . Please help
My code like this:
</table>  
	<tr>                        
		<td>
		   <apex:inputField value="{eval__c.A}"  />  
		   <apex:actionSupport event="onchange" rerender="sumwrapper"></apex:actionSupport>                             
		</td>
		<td>
		   <apex:inputField value="{eval__c.B}" />  
		   <apex:actionSupport event="onchange" rerender="sumwrapper"></apex:actionSupport>                           
		</td>
	</tr>   

	<tr>
		<td>Total</td>
		<td>
			<apex:outputPanel id="sumwrapper">
				<apex:outputText value="{!SumOfAB}"/> 
			</apex:outputPanel>
		</td>                        
	</tr>      
</table>
 
public Double getSumOfAB(){
if( (eval__c.A!= null)&&(eval__c.B!= null) ) {
	return  = Double.valueOf(!Eval__c.A) + Double.valueOf(!Eval__c.B) ;
}
  return null;
}

 
Hi all ,


new to salesforce development . I need a basic design for school-student management  . We will have 3 different object as 

1. Student --> containing basic info about student like DOB ,name ,standard,StudnetID  etc....StudentID will be unique . 

2. Marksheet --> This object has field like studentID ,name , marks in every subject ,and many more . we need to send report card to parent . mail will be used from Student object .

3. attendance sheet --> montly attendance sheet which need to be send to parent with remarks . Also StudendID and Student name will be here . 

Now student ID is here unique and we need to send marksheet and attendance sheet everymonth . we will upload csv file for marks and attendance at the end of every month . according to that data we want to send a mail to parent .

my question is how I can relate this student object to rest of two object based on studentID and how I can store data for every month (like if someone wants to check  attendance for the current year ,we should be able show them ). 

Thanks 
Hi! I am a new developer in Apex... Could someone help me to solve this error? I can´t understand what I have to do.
 
private static List<Task> queryExistingContractsTasks( List<User> entradaDuenos, List<Contract__c> entradaContratos ){
        return [
            SELECT
                WhoId,
                OwnerId
            FROM
                Task
            WHERE
                OwnerId IN :entradaDuenos
            AND WhoId IN :entradaContratos
            AND Subject LIKE '%Contract%'
            AND CreatedDate = TODAY
        ];
    }

 
We are trying to use the Visual studio code, but having an issue with Java file.
User-added image
Location fo the java file,
C:\Program Files\Java\jdk-11.0.6
What is the best way to create an index on a custom field?

I believe the only way to do this yourself is by creating the custom field as an External Id, this ensures the field has an index.

Is that the best option? Is there any down side to doing this?

Regards
 
  • December 16, 2019
  • Like
  • 0
Hi, while doing Aura input data using forms trail (https://trailhead.salesforce.com/content/learn/modules/lex_dev_lc_basics/lex_dev_lc_basics_forms) challenge, I am getting following error:

   
The campingList JavaScript controller doesn't appear to be checking if form fields are valid.


My code is as follows:

campingList.cmp
<aura:component >
    
	<aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{'sobjectType' : 'Camping_Item__c',
                               'Name': '',
                               'Packed__c': false,
                               'Quantity__c' : 0,
                               'Price__c' : 0}"/>
    <ol>

        <li>Bug Spray</li>

        <li>Bear Repellant</li>

        <li>Goat Food</li>

    </ol>

  <fieldset class="slds-box slds-theme--default slds-container--small">

    <legend id="newCampItemForm" class="slds-text-heading--small 
      slds-p-vertical--medium">
      Add Camping Item
    </legend>

    <form class="slds-form--stacked">

      <lightning:input aura:id="itemform" 
                       label="Name"
                       name="itemname"
                       value="{!v.newItem.Name}"
                       required="true"
      />

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Quantity"
                       name="quantityfield"
                       value="{!v.newItem.Quantity__c}"
                       min="1"
                       required="true"
       />

      <lightning:input type="number" 
                       aura:id="itemform" 
                       label="Price"
                       name="price"
                       value="{!v.newItem.Price__c}"
                       formatter="currency"
                       step="0.1"
      />

      <lightning:input type="checkbox" 
                       aura:id="itemform" 
                       label="Packed?"
                       name="packed"
                       checked="{!v.newItem.Packed__c}"
      />

      <lightning:button label="Create Camping Item"
                        variant="brand"
                        onclick="{!c.clickCreateItem}"
      />

    </form>

  </fieldset>
   <div class ="slds-card slds-p-top--meduim">
      <header class ="slds-card__header">
         <h3 class = "slds-text-heading--small">Items</h3>
       </header>

       <section class ="slds-card__body">
          <div id="list" class = "row">
            	<aura:iteration items="{!v.items}" var="campItem">
                    <c:campingListItem item="{!campItem}"/>
                </aura:iteration>
           </div>
        </section>

    </div>

</aura:component>

campingListItem.cmp
 
<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true"/>        
    
    <p>Name: {!v.item.name}</p>
    <p>Price: <lightning:formattednumber value="{!v.item.Price__c}" 
                                         style="currency" 
                                         currencyCode="USD" />    </p>
    <p>Quantity:<lightning:formattednumber value="{!v.item.Quantity__c}" />
    </p>
    <p>
       <lightning:button label="Packed!" 
                           title="Packed"
                           value="{! v.item.Packed__c }"/>

    </p>
</aura:component>


and  campingListController.js
 
({
    clickCreateItem: function(component, event, helper) {

        // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = quantityField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }

        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }


        if(validItem){            
            var newItem = JSON.parse(JSON.stringify(component.get("v.newItem")));
 
            console.log("Items before 'create': " + JSON.stringify(theItems));
		    theExpenses.push(newItem);
		    component.set("v.expenses", theItems);
		    console.log("Items after 'create': " + JSON.stringify(theItems));
            theItems.push(newItem);
            component.set("v.items", theItems);
        
        }
    }
})


In the above code though I am validating the inputs, getting no idea why still I am getting this error.
help me with trigger code.
An object has FirstName and LastName field, if we try to create a record with same FristName and LastName, record should not create(throws error).