• Ajay K Dubedi
  • SMARTIE
  • 1709 Points
  • Member since 2015
  • Ajay Dubedi


  • Chatter
    Feed
  • 51
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 1
    Questions
  • 439
    Replies
1<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
2  <apex:pageBlock >
3    <apex:pageBlockTable value="{!accounts}" var="a">
4      <apex:column value="{!a.name}"/>
5    </apex:pageBlockTable>
6  </apex:pageBlock>
7</apex:page>
in above example recordset variable sets varible with name accounts and agian why we have create a new variable with the name "a"?
can any on explain please
Have two custom objects Book__c and Order__c. They have a lookup relationship between them. Created a new field 'Quantity' on Book__c. Want to write a trigger to update Quantity value on Order__c. I know this can be done via process builder. Any help?
Hi All,

I'm trying to create a validation rule based on 3 checkbox fields and a rollup field below are the details:
Checbox field A
Checkbox field B
Checkbox field C
Rollup field 

If "rollup field" = 2 but only 1 of the checkbox fields is check then throw error stating they need to also check Checkbox field B or C. I tried the following but get an error message stating "Incorrect number of parameters for function 'VALUE()'. Expected 1, received 6." Any help is much appreciated.

AND
    (Checkbox_A__c && Checkbox_B__c,
VALUE(
     Rollup_field__c, 2)

Thanks in advance!
  • November 27, 2017
  • Like
  • 0
Hello all, 
i have inputText and InputTextArea field on vf and i want to give label to them. how can i do that? 
<apex:pageblockSection> 
<apex:inputText title="Name" value="{!n}" />
<apex:inputTextarea title="Address" value="{!a}"/>
 </apex:pageblockSection> 
Hello All, 
 I just need some help in implementing this by using validation rules ., there are five picklist values with  field names Master, Picklist A,Picklist B,Picklist C,Picklist D containing the values "Alpha", "Beta" and "Charlie" in all five ... 
if the Master field value is changed from "Alpha" to "Beta" ...picklist A and picklist B should be made mandatory..........
 
 
 
I have two object EProduct__C and EOrder__C. lookup filed on EOrder__C is EP_Del__C. and there are anather two field
Quantity__C on EProduct__C and
OQuantity__C on  EOrder__C 
I want to update Quantity on EProduct when on updation in Quantity of EOrder. update parent quantity when child quantity is updated
Hi All,

Can anyone, please help on the same..
not a code required, can u please share the logic.. so that i can work on same as i am new and learning triggers.

Thanks & Regards
Pranav Shah
Hi,
I created a trigger before delete.
The objective is to block the deletion and update the record (event) to set the status to 'Cancelled'.
I don't have error but the update don't take effect.
Can you help me to find what's wrong ?
Here my trigger :
trigger EventBeforeDelete on Event (before delete) {
	system.debug('## EventBeforeDelete');	
	User curUser = [Select Id, BYPASSVALIDATIONRULE__c From USER Where Id = :UserInfo.getUserId()];
	
	List<Event>EventToCancels = new List<Event>();
	List<Event>EventToUpdate = new List<Event>();
	
	for(Event e :trigger.old)
	{
		if(e.Type__c == 'Call' /*&& UserInfo.getProfileId() != Label.AdminProfileId*/ && curUser.BYPASSVALIDATIONRULE__c == false)
		{
			EventToCancels.add(e);
			EventToUpdate.add(new Event(Id=e.Id,Status__c='Cancelled',ReasonForCancellation__c='Created By Mistake'));
			
		}
	}

	if(EventToUpdate.size()>0)
	{
		update EventToUpdate;
	}



	for(Event e :EventToCancels)
	{
		e.adderror('Call can\'t be removed, it was cancelled.');
	}
	
}
Thanks for your help !
 
I think I tried every developer community post regarding my query still didn't find any solution, thats why posting new question. Hoping that I will get any solution.
So query is:
User-added image
What I want is to add background image inside that pageblocksection.
and here is the code:

VF Page:
<div class="main-right" style="width:98%;">
        <apex:pageBlock >
            <apex:pageBlockSection collapsible="false" columns="5" >
                 <div class="bg-image"></div>
            </apex:pageBlockSection>
        </apex:pageBlock>
</div>
Internal CSS:
 
.bg-image {
    margin : 0px;
    background-image: url(https://i.imgur.com/40jNzOy.png);
    background-position : center 0;
    background-size : auto auto;
    background-attachment : scroll;
    background-repeat : no-repeat;
    overflow :hidden; 
}
Thanks in advance.
public class sample1
{
    public String state {get;set;}
    public String city {get;set;}
    public String Village {get;set;}
  // public String city {get;set;}

    public List<SelectOption> getStates()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('None','--- None ---'));        
        options.add(new SelectOption('TN','Tamil Nadu'));
        options.add(new SelectOption('KL','Kerala'));
         options.add(new SelectOption('KA','Karnataka'));
          options.add(new SelectOption('AP','Andhrapradesh'));
                 
        return options;
    } 
                     
    public List<SelectOption> getCities()
    
    {
        List<SelectOption> options = new List<SelectOption>();
        if(state == 'TN')
        {       
            options.add(new SelectOption('CHE','Chennai'));
            options.add(new SelectOption('CBE','Coimbatore'));
        }
        else if(state == 'AP')
        {       
            options.add(new SelectOption('KUR','Kurnool'));
            options.add(new SelectOption('KDP','Kadapa'));
        }
        
        else if(state == 'KL')
        {       
            options.add(new SelectOption('COA','Coachin'));
            options.add(new SelectOption('MVL','Mavelikara'));
        }
        
        
        else if(state == 'KA')
        {       
            options.add(new SelectOption('BAN','Bangalore'));
            options.add(new SelectOption('My','Mysure'));
        }
        
        else
        {
            options.add(new SelectOption('None','--- None ---'));
        }      
        return options;
    }       
   
   
      public List<SelectOption> getvillages()
    {
            
   system.debug('city '+city );
    List<SelectOption> options = new List<SelectOption>();
          
          
        // options.add(new SelectOption('None','--- None ---')); 
          //List<SelectOption> options = new List<SelectOption>();
          
        if(City == 'KUR')
        {       
            options.add(new SelectOption('AL','ALur'));
            options.add(new SelectOption('AD','Adoni'));
        }
          
           else if(City == 'KDP')
        {       
            options.add(new SelectOption('A','a1'));
            options.add(new SelectOption('B','b1'));
        }
        
         else if(City == 'CHE')
        {       
            options.add(new SelectOption('c','c1'));
            options.add(new SelectOption('d','d1'));
        }
        
         else if(City == 'CBE')
        {       
            options.add(new SelectOption('e','e1'));
            options.add(new SelectOption('f','f1'));
        }
        
         else if(City == 'COA')
        {       
            options.add(new SelectOption('g','g1'));
            options.add(new SelectOption('h','h1'));
        }
        
         else if(City == 'MVL')
        {       
            options.add(new SelectOption('i','i1'));
            options.add(new SelectOption('j','j1'));
        }
        
         else if(City == 'BAN')
        {       
            options.add(new SelectOption('k','k1'));
            options.add(new SelectOption('l','l1'));
        }
        
         else if(City == 'My')
        {       
            options.add(new SelectOption('m','m1'));
            options.add(new SelectOption('n','n1'));
        }
        
          else
        {
            options.add(new SelectOption('None','--- None ---'));
        } 
          
     return options;  
    } 
}


Thanks In Advance....

 
  • October 06, 2017
  • Like
  • 0
JavaScript Problem
    I have a problem with the following code:
    <apex:page >
        
        <apex:form >
            <apex:commandButton value="Click" onclick="document.getElementById('sp').innerHTML='Hello'" />
    <span id="sp"></span>
        </apex:form>

    </apex:page>

    When I click on the button the value I  am setting in the span tag ('Hello' in span)  appears for 1 second and again disappears, I want the text 'Hello' to remain in span after clicking on the button. Can anyone please help me with this?
when visualforce page is loading i want to insert a record every time automatically is it possible,if possible How?
Thaks in advance.

hey i'm new to salesforce i like to send a single email from my vf page .

help me!

Would it be correct to say - if no Role is assigned to a user, the user shall be able to access only those records which are shared using customised sharing rules or can access public Read object’s records or can access records via public groups?
I am trying to deploy one of my batch classes into my production enviroment but I currnelty was only able to write a batch test class that has 29 percent coverage. I was wondering if you guys could help me get my coverage up to 100% so that I can deploy to production. 

Apex Batch Class
global class UpdateContactsVoter implements Database.Batchable<sObject>{
    global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'Select ID,FirstName,LastName,MailingPostalCode from contact where contact.voter_file_id__c = null';
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext info, List<contact> scope){
        Set<String> set_Str = new Set<string>();
                                Map<String,Voter_File_TX__c> mp_VoterFile;

        for(Voter_File_TX__c VoterFile : [Select ID,First_Name__c, Last_Name__c,Zipcode__c, Contact__c From Voter_File_TX__c] ){
                                                if(mp_VoterFile==null){
                                                                mp_VoterFile = new Map<String,Voter_File_TX__c>();
                                                }
                                                mp_VoterFile.put(VoterFile.First_Name__c +''+VoterFile.Last_Name__c +''+VoterFile.Zipcode__c,VoterFile);
                                }
                                for(Contact ContactList : scope){
                                                if(mp_VoterFile!=null && mp_VoterFile.containsKey(ContactList.FirstName+''+ ContactList.LastName+''+ ContactList.MailingPostalCode))
            
            {
                                                                mp_VoterFile.get(ContactList.FirstName +''+ ContactList.LastName +''+ ContactList.MailingPostalCode).Contact__c = ContactList.id;
                                                }
                                }
                                if(mp_VoterFile!=null && mp_VoterFile.values()!=null){
                                                update mp_VoterFile.values();
                                }
    }
    
    global void finish(Database.BatchableContext info){
        
    }
}

Test Class
@isTest
public class TestClassUpdateContacts
{
static testMethod void testMethod1()
{
List lstContact= new List();
List lstVoterfile = new List();
if(contact.voter_file_id__c == null && voter_file_tx__c.contact__c == null)
{
Contact cont = new Contact();
cont.FirstName ='Test';
cont.LastName = 'Test';
cont.id = 'Test';
cont.MailingPostalCode = 'test';

insert cont;

Voter_File_TX__c vf = new Voter_File_TX__c();
vf.First_Name__c ='Test';
vf.Last_Name__c ='Test';
vf.RNC_ID__c = 'Test';
vf.Zipcode__c = 'Test';
vf.First_Name__c = cont.FirstName ;
vf.Last_Name__c = cont.LastName ;
vf.Zipcode__c = cont.MailingPostalCode ;
vf.Contact__c = cont.Id ;

insert vf;

cont.FirstName = vf.First_Name__c ;
cont.LastName = vf.Last_Name__c ;
cont.MailingPostalCode = vf.Zipcode__c;
cont.RNC_ID__c = vf.RNC_ID__c ;

update cont;
}
else {
contact cont1 = new Contact();
Voter_File_TX__c vf1 = new Voter_File_TX__c();
cont1.Voter_File_ID__c = null;
vf1.Contact__c = null;

}
insert lstContact;
update lstContact;

Test.startTest();

UpdateContactsVoter obj = new UpdateContactsVoter();
DataBase.executeBatch(obj);

Test.stopTest();
}
}

 
I have a Case Trigger that updates a custom number field, Number_of_Related_Cases__c., that I obtained from the Success Community.  Following is the Trigger code:
trigger Case_Count_Related_Cases on Case (after insert, after update, after delete) {

//build list of parent case ids
    Set<Id> ParentIds = new Set<Id>();

  //If insert or update, use trigger.new
  if (trigger.isinsert || trigger.isupdate) {

  //if case has parent, add to set of parentids
  for (Case c: Trigger.New) {

      if(c.ParentId != null) {
      ParentIds.add(c.ParentId);
      }

  //if case previously had parent, but no longer does, also add so we can recalc
  if (trigger.isupdate) {

      if (trigger.oldmap.get(c.id).parentid != null && c.ParentId == null) {
      ParentIds.add(trigger.oldmap.get(c.id).parentid);
      }

     }

  }
  }

  //if delete, make sure we update parent
  else if (trigger.isdelete) {

  for (Case c: Trigger.Old) {

      if(c.ParentId != null) {
      ParentIds.add(c.ParentId);
      }

  }
  }

  //then query for parent cases, and do inner query for related cases
    List<Case> pcount = [Select Id, (Select Id from Cases) From CASE where Id IN :ParentIds];

              //use size of inner cases to set number count
              for (Case pc: pcount) {
              pc.Number_of_Related_Cases__c = pc.cases.size();
              }
     //update parents        
    update pcount;
}

I am not a developer and need to create a Test Class for this trigger.  What would a Test Class for this Trigger look like?
I need to create a table like the one below & place it on our lead page layout.
 
 JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
Usage            
Cost            

I thought perhaps a visualforce page would be the answer so I created a 'usage' and 'cost' fields for each month like the ones below:
Jan_u__c
Jan_c__c
Feb_u__c
Feb_c__c

But I don't know how to set it up as a vf page. If anyone has any feedback or sample code that can get me started that would be much appreciated.
 
i want to add annual revenue amount in the  account object to opportunities equally  in that account 
help me with program
urgent now
Hi,

I'm trying to get the custom field (Hold_ID__c) on to Visualforce page. I am not getting the value in the page.

Passing account id in the url for the page

Here is my VF page:

<apex:page controller="Questionnaire" sidebar="false" showHeader="false">
    <apex:form >
        <apex:pageblock >
           <apex:pageBlockSection columns="1">
            <apex:inputText value="{!account}" label="Hold Name"/>
            <apex:inputText value="{!holdId}" label="Hold ID"/>
            <apex:inputText id="Survey" value="{!txtSurvey}"/>
            <apex:commandButton action="{!save}" value="save"/>
           </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

Apex code:

public class Questionnaire{

    public String holdId { get; set; }

    public String txtSurvey { get; set; }

    public String account { get; set; }
    
    public Questionnaire() {
    account =  [SELECT Id, Name,Account.Hold_ID__c FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')].Name;
    holdId = [SELECT Id, Name, Hold_ID__c FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')].Hold_ID__c;
    }
    
      public PageReference save() {
         Audit_Questionnaire__c aq = new Audit_Questionnaire__c();
            aq.Name = txtSurvey;
            aq.account__c = apexpages.currentpage().getparameters().get('id');
            insert aq;
            return null;
        }
}
 
  • April 05, 2017
  • Like
  • 0
Hi,

I have inherited a VF page that uses the slds framework and I am trying to get my head around it.
I am fairly new to visual force, but I understand the logic in the site and the controller.
I did ask the developer the following question:

When using this component for example:

<div class="slds-page-header" role="banner">

Where do I find a reference about all the attributes that can be used in the page header class and what values are allowed ?
In other words, how do I know what values are allowed for the 'role'attribute above and are there any other attributes available for 'role' ?
The slds homepage doesn't seem to provide that information, at least I have not found it.

Many thanks

Michael
We need to create a storage location for a userguide(in any format pdf,excel etc) in salesforce and for that we have to give read only permissions to all users and Editable access to admin and selected users.

We have tried these two ways but couldn't find exact solution:

1- We have tried it using by creating a Folder in documents and giving readable access to all users and to give editable access to admin or some selected users we have created a permission set in which under System Permissions we just ticked the Manage public Documents checkbox.So by this all the users which are assigned in the permission set are able to manage all the folders but we want to manage only a particular folder.

2- We have also tried using content libraries.In that we created a library and added the content file in it.Gave permissions of viewing,editing to particular users but in this we are not able to add Chatter Only users so this solutions got breaked,adding to it some more profiles are asked to generate a case to salesforce support to get Salesforce CRM Content User License by this license only they can view or edit content.

Solutions for this is highly appreciable.And if any one can suggest how to modify any of above two ways to get required solution this will be a great help. I have also posted this question on salesforce community and Stack Exchage.

Thanks
1<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
2  <apex:pageBlock >
3    <apex:pageBlockTable value="{!accounts}" var="a">
4      <apex:column value="{!a.name}"/>
5    </apex:pageBlockTable>
6  </apex:pageBlock>
7</apex:page>
in above example recordset variable sets varible with name accounts and agian why we have create a new variable with the name "a"?
can any on explain please
How to create a master detail relationship between account and opportunity using visualforce page.when we click on an account ,related opportunity will display 
if anyone has the answer please mail me on amuraghav14@gmail.com
 
Dear friends, 
Please help me this: 
I have trigger code on Task object ( after insert / after update) which is going to update recent due date of completed F2F activity on opportunity custom date field. And there is also a after update trigger code on opportunity which updates the custom field on account that  is just updated by task trigger. My question is : I am getting attempt to dereference a null object error. How to solve this. Appreciate if any pointers to achieve this requirement.
Hi All,

I want to use visualforce page in login flow. I am to understand how to achive this.

Please help.
Hi All,

Automatically created the 2 child records when parent(Account) record is created? Best approach (Process builder or Apex trigger)?


Thanks,
Malakondaiah
Hi guys, i have one visual force page that i have no idea how to edit. I need to add an additional field called 'Customer Ref' the API name is 'Customer_Ref__c"

The screen shot below shows the location on the page layout where i need to add it 
User-added image
 Below is the visualforce page and the section where i need to add that extra field. I need to add it after the booking type field
User-added image

Any help would be appreciated as i have no idea about visualforce pages. Also is this the only this required to add this to the page?
Hi,

  I want below formula not to run when system administrator logins but this is firing even when system admininstrator logins.  Please suggest me how to fix below issue.
AND ( 
NOT($Profile.Name <> "System Administrator"),
ISBLANK(TEXT(Partner_Information__c)), 
OR(
ISPICKVAL(StageName , "1 - Closed Won"),
ISPICKVAL(StageName , "2 - Contracts"),
ISPICKVAL(StageName , "3 - Proposal")
)
)
Thanks
Sudhir
 
Here the account shouls be a self lookup with account. Need to display related contact and opportunity if I select any accout(lookup) in a VF page. Can anyone help with the code please.
I want to save custom new Event object (like in opportunity -> activities). I haven't found any example. Would be great if someone will provide it

 
public with sharing class customOpportunityEvent {

    public Event event{get;set;}


    public customOpportunityEvent() {
        event = new Event();
    }

    public void fillConferenceInfo() {
        event.Subject = 'some Invitation';
        event.Location = 'location';
        event.Description = 'hi there';
    }

}

 

I need to get something like

User-added image
on my visualforce page.

how can I create such component ?

Hi,
I'm going through "https://trailhead.salesforce.com/trails/force_com_dev_beginner/modules/apex_database/units/apex_database_dml" module and while implementing the challenge, I am getting following 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: Delete failed. First exception on row 0 with id 0017F00000LQrpmQAD; first error: DELETE_FAILED, Your attempt to delete My Test Account could not be completed because it is associated with the following cases.: 00001036 : []

There is no account with name as "My Test Account" & no case with number  as "00001036" visible in my org. Also, I am creating an account record why is it reflecting a message related to deleting of account? Please suggest.

Regards
Hi All,
I am net to Map and need ur help here.

Can anyone help me how to fill value in Map in below example. Can you please help me with the Code?

Map<id,List<Contacts>> CustMap = new Map<Id,List<Contacts>>;

for(Account ac:[SELECT id,name,(SELECT id FROM Contacts) FROM Account])
{
How to fill Map here where Id would be Account Id and Values would be list of Contacts.?
}

Regards,
Varun
 
HI,

I have creatd case manually or through process builder. Need to notify an user after case got created. when user responds back to that email that needs to get assign to case. I know my other 2 things will be solved if we use email to case but  in my org we are not using email to case. Please suggest me if we have an option.

Thanks,
  • November 30, 2017
  • Like
  • 0
Hi,

Cannot save the Controller, please help.

https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components4
Ok, been directed here by support so hoping someone can help.

Basically noticed that our case milestones were violating outside our set business hours.  After a lot of head scratching the only conclusion was that our timezone on the business hours in use by the entitlement processes were set to GMT.  I have changed this to BST (British Summer Time) to prevent more out of hours violations.

I have asked support if having it set to BST would mean that come Autumn salesforce will automatically revert back an hour in line with daylight savings.  They have said this does not occur and you have to manually change the timezone each time daylight savings occurs.

Can anyone confirm if this is true?  Seems like something so basic that I can't believe its not in the system. 
  • April 21, 2016
  • Like
  • 3

Hi, 

This Monday I tried to do the exam but I had technical issues with camera. Kryterion support tried to help me but we couldn't solve the problem. They rescheduled my exam multiple times but they can not do it to a different day.

Please, I have opened cases and called to certification support phone without getting any answer. Could you help me?

Best regards
I want to send emails in user's language dynamically. Two approaches:
1. Use visualforce email template, create labels and use them in the template. Set language attribute in the template and provide translations for the labels using translation workbench.
2. Create multiple versions of each template, each in a separate language and choose the template dynamically.

Advantage of first approach is that no additional efforts are required if a new language is to be supported but creating so many custom labels is cumbersome. 2nd approach is good in that respect but a template needs to be added everytime a new language is supported. 
Is there any other approach? If not, which one of the above should be chosen?