• Nishant Prajapati 10
  • NEWBIE
  • 140 Points
  • Member since 2016

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 26
    Replies
Hi All,

I am attemption to update a field of a child object of a master detail .

Here is the code:

public class SubmitApproval {

public static void createAccountManager(List<SellerAuctionItem__c> triggerNewList){
      
        List<string> AuctionSet = new List<String>();
        for (SellerAuctionItem__c item : triggerNewList) {
            if(item.Auction__c != null){
                AuctionSet.add(item.Auction__r.Name);
                system.debug('Name' +AuctionSet);
            }
        }
        
        Map<String, Auctions__c> mapAuction = new Map<String,Auctions__c>([Select Name , Account_Manager__c From Auctions__c  WHERE Name IN:AuctionSet ]);
        system.debug('Name and account manager' +mapAuction);
        for (SellerAuctionItem__c item : triggerNewList) {
            if(item.Account_Manager__c == Null){
            item.Account_Manager__c = mapAuction.get(item.Auction__c).Account_Manager__c;
            }    }

    }   
}

It is giving null pointer error : Attempt to de-reference a null object

Please help, Thanks
 
I have created a Apex Trigger to create a task on the MVP object when the Last Contacted On date is 30 days old.

Is there anyway i can make it so that the task will only be created on a weekday? (Monday - Friday)



trigger OldMVPTrigger on MVP__c (after insert) {
    
    List<Task> taskListToInsert = new List<task>();
    
    for(MVP__c mvp:Trigger.new)
    {
        if(mvp.Last_Contacted_On__c == Date.Today().addDays(-30)) 
        {
           task t = new Task();
           t.Subject = 'Call [MVP__c].MVP__c.FirstName Today';
           t.OwnerId = '[MVP__c].MVP_Owner__c';
           t.WhatId = mvp.Id;
           taskListToInsert.add(t);
        }
    }
    if(taskListToInsert.size() > 0)
    {
        insert taskListToInsert;
    }
}
Hi everyone,

I am developing a Custom Lightning Component and it suppose to be a dynamic component.

But I do not seems to be able to create additional filter to be used on Lightning App Builder setup page.

I wanted to do something like standard Lightning Components:
User-added image

Anyone have any experience in creating filter for Custom Lightning Component?
I want to merge sobject records in bulk using Apex. So, can you guys help to out how to approach this.
Hi,
Account have self lookup relationship. I have following Hierarchy of Parent child Accounts using self lookup:
A
    A1
        A11
            A111
            A112
        A12
        A13
    A2
        A21
        A22
        A23
            A231
    A3
        A31
        A32
        A33
            A331
I need to roll up a amount field to the top most level of Account in hierarchy, following the hierarchy.
There was an unhandled exception. Please reference ID: HTNVCCJL. Error: Faraday::ClientError. Message: MALFORMED_QUERY: When retrieving results with Metadata or FullName fields, the query qualificatio​ns must specify no more than one row for retrieval. Result size: 4

My Flow looks like: 
User-added image
User-added image
User-added image
User-added image
User-added image
Error:-
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3017F000000gR4k. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []
And in developer console it shows-FLOW_ELEMENT_ERROR The flow failed to access the value for myVariable_current.Account.Type because it hasn't been set or assigned.
<apex:page showHeader="false"  controller="Controller004">
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>
<style>
h1{font-family: 'Oswald', sans-serif; text-decoration:none;}
</style>
<apex:pageBlock >
<apex:pageBlockSection title="Record of avalaible Doctors">
<apex:form >
<apex:pageBlockTable value="{!obj}" var="a">

 <apex:column headerValue="Name">
 <h1><apex:outputField value="{!a.Full_Name__c}" /></h1>
 </apex:column>
 <apex:column headerValue="Fee">
<h1><apex:outputField value="{!a.Fee__c}"/></h1>
</apex:column>
<apex:column headerValue="Schedule">
<h1><apex:outputField value="{!a.schedule__c}"/></h1>
</apex:column>
<apex:column >
<apex:image value="{!a.ImageUpload__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
above is code of VF page
and controller of this page is:
global class Controller004{

public List<Doctor__c> obj{get;set;}
public Controller004(){
obj = [select Full_Name__c, Fee__c, schedule__c, ImageUpload__c from Doctor__c];

}
}


 
I want to create a form which contains attributes about the profile of a Doctor.
I want to add an attribute through which I can upload profile pic of the Doctor
from a folder which is on my local disk. And I also want to display the images of all registered Doctors on other VF page.

I need help on this. 
Error:-
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 3017F000000gR4k. Flow error messages: An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.: []
And in developer console it shows-FLOW_ELEMENT_ERROR The flow failed to access the value for myVariable_current.Account.Type because it hasn't been set or assigned.
I am new to VFP and need to hide a field for certain profiles and not sure how or where to put the restriction.  Below is the field I need to hide.

<apex:pageBlockSectionItem id="AccessSI" >  
                            <apex:outputLabel value="Access" for="Access" />
                            <apex:outputPanel styleClass="requiredInput" layout="block">
                                <apex:outputPanel styleClass="requiredBlock" layout="block"/>
                                <apex:inputField value="{!Call.Access_del__c}" id="access">
                                <apex:actionSupport event="onchange" action="{!outcomecheck}" reRender="koc,kocbar,buttons,kocselect" />
                                </apex:inputField>
                            </apex:outputPanel>
                        </apex:pageBlockSectionItem> 
I have a problem: Unknown Property  'PencilsNBoxesController.Pensil_box__c'

Here is a code.

<apex:page controller="PencilsNBoxesController">
  <apex:form> 
    <apex:pageBlock title="Pencil List" id="Pencil_Box_list"> 

    <apex:pageBlockTable value="{!Pencil_Box__c}" var="pb"> 
      <apex:column value="{!pb.Name}"/> 
      <apex:column value="{!pb.CreatedBy}"/> 

    </apex:pageBlockTable> 
    </apex:pageBlock> 
  </apex:form> 
</apex:page>

Controller 

public class PencilsNBoxesController {
public class PencilBoxListController {
private String sortOrder = 'CreatedBy'; 
public List<Pencil_Box__c> getPencil() { 
List<Pencil_Box__c> results = Database.query( 
 'SELECT Id, Name, CreatedBy FROM Pencil_Box__c'); 
return results; 

}
}
Hi All,

I am attemption to update a field of a child object of a master detail .

Here is the code:

public class SubmitApproval {

public static void createAccountManager(List<SellerAuctionItem__c> triggerNewList){
      
        List<string> AuctionSet = new List<String>();
        for (SellerAuctionItem__c item : triggerNewList) {
            if(item.Auction__c != null){
                AuctionSet.add(item.Auction__r.Name);
                system.debug('Name' +AuctionSet);
            }
        }
        
        Map<String, Auctions__c> mapAuction = new Map<String,Auctions__c>([Select Name , Account_Manager__c From Auctions__c  WHERE Name IN:AuctionSet ]);
        system.debug('Name and account manager' +mapAuction);
        for (SellerAuctionItem__c item : triggerNewList) {
            if(item.Account_Manager__c == Null){
            item.Account_Manager__c = mapAuction.get(item.Auction__c).Account_Manager__c;
            }    }

    }   
}

It is giving null pointer error : Attempt to de-reference a null object

Please help, Thanks
 
I have created an Apex Trigger to create a Task on the MVP Object but keep getting an error.

I am trying to link the Assigned To (Lookup(user,calender))  on the Task object to the MVP Owner (Lookup(user)). 

Can anyone help correct this error? 


User-added image
User-added image
I have created a Apex Trigger to create a task on the MVP object when the Last Contacted On date is 30 days old.

Is there anyway i can make it so that the task will only be created on a weekday? (Monday - Friday)



trigger OldMVPTrigger on MVP__c (after insert) {
    
    List<Task> taskListToInsert = new List<task>();
    
    for(MVP__c mvp:Trigger.new)
    {
        if(mvp.Last_Contacted_On__c == Date.Today().addDays(-30)) 
        {
           task t = new Task();
           t.Subject = 'Call [MVP__c].MVP__c.FirstName Today';
           t.OwnerId = '[MVP__c].MVP_Owner__c';
           t.WhatId = mvp.Id;
           taskListToInsert.add(t);
        }
    }
    if(taskListToInsert.size() > 0)
    {
        insert taskListToInsert;
    }
}
Hi everyone,

I am developing a Custom Lightning Component and it suppose to be a dynamic component.

But I do not seems to be able to create additional filter to be used on Lightning App Builder setup page.

I wanted to do something like standard Lightning Components:
User-added image

Anyone have any experience in creating filter for Custom Lightning Component?
Hai,
       We have scenario like this when ever new lead is created lead score should be calculated   and inserted in feild name Leadscore__c  using before Trigger.

considering
Email -10 points,
Date of Birth- 10 points
Annual Revevenue 10points
Phone--10  Points
Contact Address - 10 Points
Company -10 points
Position__c- 10 points.

With Regards
Masthan Khan.

I have a <apex:pageBlockTable></apex:pageBlockTable> element that is looping over a variable in the page constructor. I have added `LIMIT 1000` to the end of the SOQL query and have confirmed the List<Asset> variable only has a size of 1000 using System.debug(). I keep getting this error on the actual visualforce page though:

Content cannot be displayed: Collection size 10,336 exceeds maximum size of 10,000.
This is the total number of records in the sObject Asset. I don't know why or how it's pulling all of them when the SOQL query that grabs records for the variable is only grabbing 1000 records. Thanks in advance if you have any ideas what might be the cause of this.
Hi All, I need to query all the profiles that have access to a particular record type called "ABD" . How do I query this data?
  • July 26, 2018
  • Like
  • 0
This trigger isn't firing and I can't figure out why help please

<--Trigger Code--->

trigger LimitLeads on Lead (before update) 
{
    for(Lead ld: Trigger.New)
    {  
        String LeadOwner = ld.OwnerId;
        if(ld.Lead_Source_Type__c == 'Team Lead' &&  (ld.Status == '01-New' && ld.Status == '20-Nurture') && ld.RecordTypeId == '01250000000Mvl2AAC')
        {
            List<Lead> leads = [SELECT Id FROM Lead WHERE OwnerId =: LeadOwner AND Lead_Source_Type__c =: 'Team Lead' AND (Status = '01-New' OR Status = '20-Nurture') AND RecordTypeId = '01250000000Mvl2AAC'];
            List<User> caps  = [SELECT Pipeline_Cap__c FROM User WHERE Id =: LeadOwner];
            Integer numLeads = leads.size();
            Integer cap = (Integer)caps[0].Pipeline_Cap__c;
            Integer remove = leads.size() - cap + 1;
                                              
            If(numLeads > cap) 
            {
                ld.OwnerId.addError('You already have too many Team Leads. Please remove leads before adding a new one.');
            }  
        
        }
    }    
}