• Pradeep Singh
  • 1146 Points
  • Member since 2014
  • Salesforce Developer
  • Axtria India Pvt Ltd

  • Chatter
  • 35
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 212
Hi All,

I had a query regarding user level access.
One field has read write access on profile level and permission set is associated with one user having read access.what will be the final level of access given to the user?
Also, if OWD is private and above 2, what will be the access level to the user?
We are planning to build external app which will be intergrated in Salesforce Tab.
Is it possible to add Canvas App into the Salesforce Tab?

   I got this question in some interview, where I tried to solve but unsuccessful. Please help me out.

trigger to rollup opportunity amount on Account field where opportunity
record type is "Revenue Type"
Opportunity field: Opty_Amount_C
Account field: Total_Opty_Amount_C

Dear All,

I am doing the first module - 'Prepare Your Org'

I have created a picklist field named 'Approval_Status__c' and its value as 'Approved' and 'Rejected' yet I am getting the exception and not able to complete the challenge.Please let me know what is wrong here.


HI All. The query is on a junction object called Project_Contact_Role__c which links the Project__c object to the Contact object. The org has another junction object called datapm__OptinmOptin__c, which links the same two objects (Project__c and Contact). What I want the query to do is find Project_Contact_Role__c records that do not have a corresponding record in the other junction table. 

So, I've written this query, but it doesn't work quite right. It works if there are no records in datapm__OptinmOptin__c with either same contact id or project id, but if there is a datapm__OptinmOptin__c with same project id and a different contact id or vice versa then it fails. 
select Id, 
  from Project_Contact_Role__c
  where Id IN :pcrs
  and Contact__c NOT IN (select datapm__Contact__c from datapm__OptinmOptin__c)
  and Project__c NOT IN (select Project__c from datapm__OptinmOptin__c)

The only thing I can think of doing is adding a lookup from datapm__OptinmOptin__c to Project_Contact_Role__c. And then I can change the query to this:
select Id, 
  from Project_Contact_Role__c
  where Id IN :pcrs
  and Id NOT IN (select Project_Contact_Role__c from datapm__OptinmOptin__c)

Just want to see if there is anyone that can see a way to fix the first query. Thanks!!
SelectList put in table or repeat visualforce elements causes all controller methods to break. No errors are shown, however, the debug statements for methods that are called from the page are not showing. No javascript errors either.

When select list is substituted with any other element the row is successfuly added to the table, but when SelectList is there and it is not blank the new row is not added as well as other butons do not work on the page.

<apex:page controller="Test_Ctr">
    <apex:form id="theForm">
        <apex:pageBlock title="Filters">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton action="{!newFilter}" value="New Filter" rerender="theForm"/>
                <apex:commandButton action="{!testValues}" value="Test Values" rerender="theForm"/>
            <apex:pageBlockTable value="{!ftsWrap}" var="row">
                    <!--apex:selectList value="{!row.fieldvar}" size="1">
                        <apex:selectOptions value="{!listOptions}"/>
                    <apex:selectList value="{!row.fieldvar}" size="1" >
                        <apex:actionSupport event="onchange" reRender="theForm"/>
                        <apex:selectOptions value="{!listOptions}"></apex:selectOptions>

public with sharing class Test_Ctr {
    public List <filtersWrap> ftsWrap {get;set;}
    public List <SelectOption> listOptions {get;set;}
    public Test_Ctr(){
        ftsWrap = new List <filtersWrap> ();
        //filtersWrap fw = new filtersWrap();
        listOptions = objectFieldsGetter();
        System.debug('ftsWrap: '+ftsWrap);
    public List<SelectOption> objectFieldsGetter() 
        String selectedObject = 'Task';
        Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
        Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
        List<SelectOption> fieldNames = new List<SelectOption>();
        for (String fieldName: fieldMap.keySet()) 
            fieldNames.add(new SelectOption(fieldName,fieldName));
        return fieldNames;
    public class filtersWrap{
        public SelectOption fieldvar {get;set;}
        //public List <SelectOption> fields {get;set;}
    public void newFilter(){
        filtersWrap fw = new filtersWrap();
        //fw.fields = objectFieldsGetter();
        System.debug('fw: '+fw);
        System.debug('ftsWrap: '+ftsWrap);
        System.debug('ftsWrap: '+ftsWrap);
    public void testValues(){
        System.debug('ftsWrap: '+ftsWrap);

User-added image
There is an 'invalid' unwarranted error in the last challenge in VF basics:

There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: line 1:47 no viable alternative at character '"

It runs fine:
User-added image

and this is the SQL:
public class NewCaseListController {
    public  List<Case> getNewCases(){
        List<Case> results = Database.query(
            'SELECT Id, CaseNumber ' +
            'FROM Case ' +
            'WHERE status = "New"' +
            'LIMIT 10'
        return results;
I´m using  SelectOption (a kind of picklist) in an Apex page, I need to pass the parameter to other class with a button (a submit)

This is my visual Force Page:
<apex:page lightningStylesheets="true" ><!--extensions="WebServiceController"-->
        <apex:pageBlock title='Employee id'>
                <apex:selectList id="AccountsClients" Title="Accounts ids" size="1">
                     <apex:selectoption itemLabel="Account 1" itemValue="D0000001"></apex:selectoption>
                     <apex:selectoption itemLabel="Account 2" itemValue="D0000002"></apex:selectoption>
                     <apex:selectoption itemLabel="Account 3" itemValue="D0000003"></apex:selectoption>
                     <apex:selectoption itemLabel="Account 4" itemValue="D0000004"></apex:selectoption>
                     <apex:selectoption itemLabel="Account 5" itemValue="D0000005"></apex:selectoption>                               
            <apex:commandButton value="Register" id="SubmitButton" action="{!IdCuentas}"/>

This is the class that needs to receive the parameter 

public class WebserviceClass{
    public HttpResponse WebserviceClss (String numeroCliente){    
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        getClientes__c customSetting= getClientes__c.getValues('saveAccount');
        request.setEndpoint(customSetting.URL__c + numeroCliente);
        HttpResponse response = http.send(request);
        return response;
Hello, I'm a development newbie and I have a custom VF page that i need to add a button to that will redirect me to the Opportunity tab.  Any help would be appreciated.  
HI All,

I have created a batch class below in which CONTACT is parent object and alu_Application__c is a child object the retion field name is Applicant__c, I need to update the value of contact Prefered Name with alu_Application__c Prefered Name. I tried to excutethe same but it's not working.

global class ContactUpdate implements Database.Batchable<sObject>
    global string query;
    global Database.QueryLocator start(Database.BatchableContext BC)
        query = 'SELECT Id,Preferred_Name__c, Applicant__c FROM alu_Application__c';
        return Database.getQueryLocator(query);

    global void execute(Database.BatchableContext BC, List<alu_Application__c> scope)
            List<Contact> appCon = new List<Contact>();
            for (alu_Application__c ap : scope)
                Contact con = new Contact();
                con.Id = ap.Applicant__c;
                con.Preferred_Name__c = ap.Preferred_Name__c;
            if(appCon.size() > 0)
                update appCon;
        catch(Exception e)
            system.debug('Error ');
    global void finish(Database.BatchableContext BC)

Please helip me ASAP, It's really an urgent task for me!

Hi All,
I have cleared Platform Developer exam on  23rd Sept 2017 and one Release Exam on 28th Dec 2017. I am confuse next Release Exam when I have to write. I dint get mail regarding this.
Hello guys, 

this apex class includes one wrapper class (cBoost). With the cBoost object and a visualforce page the user is able to select Finalboost records. After the user selection, the class generates XtraBoostOpp__c records. Now, i want to provide a option for the user to create a integer value for each selected FinalBoost record. In the save methode i want to create the XtraBoostOpp__c records and assign the integer value.

In my opinion, i have to create a new variable in my wrapper class (cBoost.menge) . I have tried different ways but nothing worked....
The api name of the XtraBoostOpp__c field is 'Menge__c' .  
public class CreateMultiExtraBoost {

	public List<cBoost> boostList {get; set;}
    public Id opportunityId {get;set;}
    // Constructor 
    public CreateMultiExtraBoost (){
    	opportunityId =  ApexPages.currentPage().getparameters().get('oppId');

	public List<cBoost> getBoosts() { 
		if(boostList == null) {
			boostList = new List<cBoost>();
			for(FinalBoost__c fb: [select Id, Name from FinalBoost__c ]) {
				boostList.add(new cBoost(fb));

		return boostList;

	public PageReference save() {
		List<FinalBoost__c> selectedBoosts = new List <FinalBoost__c>();
        List<XtraBoostOpp__c> boostItems = new List <XtraBoostOpp__c>(); 
        pagereference oppPage = new pagereference('/' + opportunityId);
		for(cBoost cbInList: getBoosts ()) {
			if(cbInList.selected == true ) {

		System.debug('These are the selected ...');
		for(FinalBoost__c con: selectedBoosts) {
        for (FinalBoost__c fboInList: selectedBoosts) {
            	XtraBoostOpp__c boost = new XtraBoostOpp__c ();
            	boost.FinalBoost__c = fboInList.Id;
            	boost.Opportunity__c = opportunityId;
            	boost.Menge__c = //user input variable 
        insert boostItems;
        return oppPage;
   // WrapperClass
	public class cBoost {
		public FinalBoost__c fbo {get; set;}
		public Boolean selected {get; set;}
        public Integer menge {get; set;} // user input variable 

		//WrapperClass Constructor 
      public cBoost(FinalBoost__c f) {
			this.fbo = f;
			this.selected = false;
          	this.menge = 0;

Thanks for your help guys ! 
Hi All,
I completed the second step of Advanced formula badge "Use Numbers, Currency, and Percentages in Formulas", while validatin the challenge I'm getting the following error:
 REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]
but for this challenge, it's not requested this field, and I can't exit from the loop.

Anyone can help me?
public class AccountContactOppurtunitycon {
        Public list<OpportunityContactRole> contactRole{get;set;}
        set<id> accountid{get; set;}
   public AccountContactOppurtunitycon()
     contactRole=[select ContactId , Contact.Name, opportunityId ,opportunity.Name ,opportunity.Amount, opportunity.Account.Name  from OpportunityContactRole];
I am trying to update a custom number field of a list of custom objects. I keep receiving the error Error: Compile Error: Field is not writeable: jstcl__TG_Timesheet__c.Period__c at line 12 column 22. However, this varible isn't the one being written over, I'm just reading what it's value is on the if statement.

This is what I have so far:
public class CamstimecardEndDateAudit{
public static void auditTimeCards(){
    List<jstcl__TG_Timesheet__c> myList = new List<jstcl__TG_Timesheet__c>();

     myList = [SELECT jstcl__Placement__r.Name, Period__c, TCEndDateAuditB__c
                            FROM jstcl__TG_Timesheet__c 
                            WHERE jstcl__Placement__r.ts2__Status__c IN ('Active') 
                             AND jstcl__Week_Ending__c = LAST_N_DAYS:15
                             AND jstcl__Status__c = 'Pending'];
    for(integer i=0 ; i < myList.size(); i++) {
        if(myList[i].Period__c = 'Weekly Split'){
    myList[i].TCEndDateAuditB__c = myList[i].TCEndDateAuditB__c + 0.5;}
    myList[i].TCEndDateAuditB__c = myList[i].TCEndDateAuditB__c + 1;
  update myList;

Hello, I have a custom object that has a look up to the account object. I've written the trigger below to count the child records and update a field on the Account object. The code also sums the total of the child records and updates a field on the Account.

The trigger works fine if I update one child record but throws a DML error "InvoiceRollUp: System.LimitException: Too many SOQL queries: 101"  when I do a bulk update via dataloader. Thank you in advance for your help!
trigger InvoiceRollUp on Order_Line_Item__c (after insert, after update,after delete,after undelete) {
    set<id> AccountIds = new set<id>();
    if(trigger.isInsert || trigger.isUpdate){
        for(Order_Line_Item__c li : trigger.new){
    //When deleting payments
        for(Order_Line_Item__c li : trigger.old){
   map<Id,Double> AccountMap = new map<Id,Double>();
    for(AggregateResult q : [select Ship_To__c , sum(Line_Item_Total__c) from Order_Line_Item__c where (Ship_To__c IN :AccountIds AND (Invoice_Date__c=Last_N_Months:12)) group by Ship_To__c]){

    List<Account> AccountsToUpdate = new List<Account>();
    for(Account acc : [Select Id, Invoice_Total__c from Account where Id IN :AccountIds]){
        Double PaymentSum = AccountMap.get(acc.Id);
        acc.Invoice_Total__c = PaymentSum;
    for(AggregateResult OC : [select Ship_To__c , count(Id) from Order_Line_Item__c where (Ship_To__c IN :AccountIds) group by Ship_To__c]){
    List<Account> AccountsToCount = new List<Account>();
    for(Account ac : [Select Id, Invoice_Total__c from Account where Id IN :AccountIds]){
        Double counter = AccountMap.get(ac.Id);
        ac.Invoice_Line_Item_Count__c = counter;
  update AccountsToUpdate;
  update AccountsToCount;

Hi - I want to be able to add a custom block of text based on the status of a checkbox for a document. 

I added the following pageblock information in the place in the contract where the I want the text to conditionally appear, but I keep getting an error on the input field. Do I need to add something to controller or header?

Much appreciated 

<apex:page standardController="Contract"
<apex:pageBlock id="theBlock">
   <apex:inputCheckbox value="{!My_Checkox__c}">
      <apex:actionSupport event="onchange" rerender="theBlock"/>
      <apex:inputText value="THE TEXT I WANT TO DISPLAY" rendered="{!(My_Checkox__c == true)}"/>

Error: wrapperExample Compile Error: Constructor not defined: [wrapperExample.Wrapper].<Constructor>(Contact, Lead) at line 15 column 21

Please Help me out

public class wrapperExample{

  public List<Wrapper> wrapContactList{get; set;}

 public wrapperExample(){
  if(wrapContactList== null) {
  wrapContactList= new List<Wrapper>();
  List<lead> ledlist = [select Email from lead];
  for(Contact c: [select Email from contact]) {

          for(lead l: ledlist ){
          if(c.Email == l.Email){

wrapContactList.add(new Wrapper(c,l));

 public class Wrapper{

  public contact con{get; set;}
  public lead  led{get; set;}

 public Wrapper(Lead a,Contact c) {
  led = a;
  con = c;

hi all, 

I have witten a vf code in which it shows "Error in ine 0 " i could not understand whats the error is. Please halp me in sorting out the issue.
Below is my code: 
<apex:page standardController="Account" recordSetVar="accs">
.activetab {background-color : #9ACD32 ; color:white;}
.inactivetab {backgound-color :  #DCDCDC ; color:white;}

<apex:tabpanel switchtype="Client" selectedtab="Accounts" id="tabpanel1"
tabclass="activetab" inactivetabclass="inactivetab">
<apex:tab label="Account Details" name="Accounts" id="1"> 

 <apex:pageblock title="All Accounts"> 
 <apex:pageblocktable value="{!accs}" var="a">
 <apex:column title="Action" >
 <apex:outputLink value="{!URLFOR($Action.Account.Edit,a.id)}">Edit
 <apex:outputlink value="{!URLFOR($Action.Account.Delete,a.id)}">Del</apex:outputlink>
 <apex:column value="{!a.Name}"/>
 <apex:column value="{!a.Phone}"/> 

Error is :

Error in line 0


Hello Masters,

My requirement here is to create a Trigger on Contact which, in case of change of record ownership, populates a field Previously Owned By with name of the previous owner of the record. Please find my code below and reflect some suggestions to make it work correctly.

trigger PreviousOwnerPopulate on Contact (before update) 
Set <ID> PreviousId = new Set<ID>();

for (contact co: trigger.new)
for (Contact con: trigger.old)

if(co.OwnerID != con.OwnerID)


map<id,string> mapforPreviousIdname = new map<id,string> ();

for (User u : [select id, name from User where id in:PreviousId])

for (contact c : trigger.new)

if (mapforPreviousIdname.size() > 0 )
c.Previously_Owned_By__c = mapforPreviousIdname.get(c.OwnerID);

Hi Amazing Trailblazers.

Just wanted to know how the processing is done at the backend for the below scenario:-

I have a update trigger for Object A , in which I am using a SOQL to fetch a record of record B which gets executed for every trigger execution.

I am updating 500 records of Obj A using anonyous block or Apex and Data Loader Bulk API with batch size 2000.

What I found is when the records are updated using Apex/Anonymous Block, the Governor Limits i.e Number Of SOQL increases incrementally. So, here in my case it shows 1 for first 200 records processed in trigger,2 for other 200 and then 3 for remaining 100.

But When I update the same records using Data Loader, it shows 1 for every 3 batches.So it shows 1,1 and 1. Its like Governor Limits are calculated separately OR reset for every execution..!!

Does anyone know about how the records and how Governor Limits are processed  when the records are updated via Data Loader..???
Hi all,
I am getting the below error while performing challenge checking for the superbadge (Lightning Component Framework Specialist)
Challenge Not yet complete... here's what's wrong: 
The "New" button isn't hidden based on whether the event.force:createRecord is supported. The BoatSearchForm component should conditionally render the New button based on the value of a component attribute that is set by its controller.

Below is my code :-

<aura:component controller="BoatSearchResults" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="Boats" type="String[]" default="All Types" />
    <aura:attribute name="showNewButton" type="boolean"/>
    <div class="slds-container_fluid slds-p-around--small">    
        <lightning:layout horizontalAlign="center">
           <lightning:select name="selectItem" label="">
                <option value=" " text="All Types"/>
                <aura:iteration items="{!v.Boats}" var="item">
                    <option value="{!item}" text="{!item}"/>
            <lightning:layoutItem padding="around-medium">
                <lightning:button variant="brand" label="Search" />
                <aura:renderIf isTrue="{!v.showNewButton}">
                    <lightning:button label="New" onclick="{!c.createBoatRecord}" class="{!v.showNewButton ? '' : 'slds-hide'}"/>


    createBoatRecord : function (component, event, helper) {
        var createRecordEvent = $A.get("e.force:createRecord");
            "entityApiName": "Boat__c"
    doInit: function(component){
        var checkCreate = $A.get("e.force:createRecord"); // to check if it is supported by a standalone app
        console.log('---' + checkCreate);
            console.log('--2-' + checkCreate);
           component.set("v.showNewButton", true);        
            component.set("v.showNewButton", false); 
        var action = component.get("c.getBoats");
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.Boats", response.getReturnValue());
I have lightning page i which i load visualforce component in iframe. It is working for me but i have administrator accout. When i try with Standard Platform User account i get access error. How can i give access to visualforce to Standard Platform Users?
Where can I see information on when a trigger / class was removed from my Org and by who?
Hi All,

I had a query regarding user level access.
One field has read write access on profile level and permission set is associated with one user having read access.what will be the final level of access given to the user?
Also, if OWD is private and above 2, what will be the access level to the user?

I have a List Button that executes JS: 

It creates a new offer & prefills 2 fields. I was unsure how to convert this into a Lightning ready button as it works the exact same in classic and lightning.

Many Thanks,
Natasha :)




  In salesforce is there a way to identify who download or exported report Please suggest me. I want to know the contact object audi for report export or download. 

  • August 28, 2018
  • Like
  • 0
Hi All,

I hope everyone is doing good. I turned up here for a valuable advise from all of you experts.

My usecase is as below:

We have 2 objects "Accounts" and "Orders". I need to update one field on account object called as "Upgrade Order Status"(API Name- Upgrade_Order_Status__c) which is a text field with the value of "Order Status" field of only that Order where new Order is being created as Order Type = 'Upgarde Order' or an already existing order with Order type='Upgarde Order' and status is getting changed.

Order type is a picklist field on Order object having multiple values in which "Upgrade Order" is one of among them. Account can have multiple Orders with different Order Type.But my use case is to populate account's "Upgrade Order Status" field with the Order status field value of recently created order having order type= "Upgarde Order' OR there is a change in Order Status field of an already existing Orders of type "Upgrade Order".

Account Name: Account Demo
has 5 Orders with different Order Type
1. Order1 with Order Type= "ABC" with Order Status= "New"
2. Order2-with Order Type= "Upgrade Order" with Order Status="Open"
3. Order3 with Order Type= "XYZ" with Order Status="Open"
4. Order4 with Order Type="Upgrade Order" with Order Status= "New"
5. Order 5 with Order Type="ABCQRS"with Order Status= "Closed"
So we need to populated "Upgrade Order Status" with the status value of recently created/changed Orders's Status where Order Type= "Upgrade Order".So if suppose among 5 above mentioned orders if Order 4 is recently created  orders with Order Type="Upgrade Order" then "Upgrade Order Status" on account should be populated with value "New" because Order 4 is having Order Status= "New".
In case if we modify Order 2 and changed the status from "Open" to "Closed" then "Upgrade Order Status" on account should be populated with value "Closed" because Order 2 is recently modified order with order type=Upgarde Order.

Kindly let me know if any further inputs/clarifications needed on my question.

Any advise/suggestions/help will be greatly appreciated

Many thanks in advance

Thanks & Regards,
So I have a Contract start date on my opportunity site that I want to be shown on the contract site. 

I tried to make a cross reference
By addinge this


and tried this 






Nothing works and its says syntax error

What to do? 

and ofcourse its field and relationships and advanced fomrula. 

Hi Everyone,

I'm trying to create report which shows opporunities with products. I was able to show the multiple product name but how we can show multiple products with their respective sales prices. Is there any way we can achive this? or any workaround?

Thank you in advance for help. 

Here is my screenshot for more and exact information : 

User-added image
I need email sent to ceo on lead conversion

I created work flow rule on lead and email template on lead then email alert on workflow, but i did not receive email
then i created email template on account then when converting lead i got error as work flow rule exists on lead.
selected created or edited criteria?
Please advise how to do this?
Dear All,
I am starting a new project where I would need to access the "Activity History" which is an object accessible from the Account record. I was thinking to create either an APEX class or an Apex Trigger, to be able to access the history and retrieve the information I need. 

Is it possible with Apex to access those objects/records related to the Account record?

Is that the right approach? Is there a quicker way? 

Thank you for your help.

User-added image
We are planning to build external app which will be intergrated in Salesforce Tab.
Is it possible to add Canvas App into the Salesforce Tab?

Here's my Trigger:
trigger SoldCustomer on Opportunity (after update) {
    for (Opportunity opp : Trigger.new) {
        if (opp.Account.Type != 'Customer' && opp.StageName == 'Sold' && opp.Account.Type != null) {
            opp.Account.Type = 'Customer';

Here's my Test Class:
private class SoldCustomerTest {

    @isTest static void CreateOpp() {
        // Create Account
        Account acc = new Account();

        acc.Name = 'Created Account';
        acc.Type = 'Prospect';
        String accId = acc.Id;

        Opportunity opp = new Opportunity();
        opp.StageName = 'Discovery';
        opp.CloseDate = date.parse('12/27/2019');
        opp.Name = 'Sold Customer Test Opp';
        opp.AccountId = accId;

    @isTest static void UpdateOpp() {
        List<Opportunity> records = [
        SELECT Id FROM Opportunity WHERE Name = 'Sold Customer Test Opp'

        for (Opportunity record : records) {
            record.StageName = 'Sold';

        update records;
When I run the test class, it shows no coverage for the trigger. This is my 2nd trigger and I'm really excited about asking my first question. Hopefully, someone can help. Thanks in advance!
   I got this question in some interview, where I tried to solve but unsuccessful. Please help me out.

trigger to rollup opportunity amount on Account field where opportunity
record type is "Revenue Type"
Opportunity field: Opty_Amount_C
Account field: Total_Opty_Amount_C