• Nimit
  • 10 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 8
I have a custom object namend tpdDatabase. I have an Apex class with the method below to get an instance of this object (by databasename). 

The line "tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);" produces this error:

Not of type Custom Settings

I don't quite understand what goed wrong here. Could anyone point me in the right direction? Many thanks in advance!

    public tpdDatabase__c getByDatabaseName(String databaseName) {
        tpdDatabase__c tpDatabase = tpdDatabase__c.getValues(databaseName);
        if (tpDatabase == null) {
        return null;
        return tpDatabase; 

I am getting "MALFORMED_QUERY : [object Object] : truncated" error in SOQL while querying on EmailMessage object. I am not getting why "MALFORMED_QUERY " and what is truncated?
Please help me out through this ASAP.

SELECT toIds FROM EmailMessage WHERE field1=tempvar AND Status__c NOT IN ('Rejected', 'Queued')
Hi guys,

I have a visualforce page looking like this:
<apex:page standardController="Rapport__c" renderAs="pdf" docType="html-5.0" showHeader="false" applyHtmlTag="false">
    <apex:form >
       <apex:pageBlock >
        <apex:stylesheet value="{!$Resource.pdfStyle2}"/>



Now I want to write some code in apex and connect it to my visualforce page.
How can you do this?

And second, I want to create a function, that activates a checkbox if the user who created the pdf clicks on the custom button to show the visualforce page because clicking the button and opening the visualforce page always means that the user is going to print the page. The boolean function for that should be something like 'vfPageIsPrinted'.

So, quick sum up:

Custom button 'Create_Rapport' clicked by user after creating a record -> checkbox 'IsPrinted?' = true

Custom button 'Create_Rapport_ NOT clicked by user after creating a record -> checkbox 'IsPrinted?' = false

Any ideas how to achieve that? 

Thanks :-)
Hi Guys,
getting variable does not exist when checking the old value is null or not. please suggest

 public static Boolean HasAccess(List<AccountContactRelation> lstNew) {
               for (AccountContactRelation acr : lstNew) {
                    if(string.isNotBlank(acr.Entity__c) || string.isNotBlank(trigger.oldMap.get(acr.Id).External_Entity__c)  ){// getting  error on this line checking oldmap
                        if(acr.External_Entity__c != 'Customer-facing')
                            throw new acrException(System.Label.Cimited);
                  return bReturn;
I have written the following soql query for fetching the last created record.

SELECT id, name,Body,parentID FROM Attachment order by CreatedDate DESC limit 1

But I am getting this error. Please help me. Thanks in advance.

System.QueryException : Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
I am trying to write a trigger that will populate a contact lookup field with a specific contact. I am struggling to figure out how to code the specific contact into the trigger. 

Check out the code and you will see what I mean...

Any help would be MUCH APPRECIATED! Thanks guys! 
trigger CampaignTrigger on Campaign (after insert) {

	for(Campaign camp:Trigger.New){
		if(camp.Project_Manager__c == null)
		camp.Project_Manager__c = WHAT DO I PUT HERE?? THE USERS ID? 


Hello, I have an Object with a list inside of of it. The two values I want to retrieve are 'Label' and 'Link.'  How do I get those values.  The error messages keep telling me I need an SObject.  The Object is not an SObject.  Looks something like this.

I want to get the value of 'Label' and 'Link' 
List<Object> OuterTable = new List<Object>();
OuterTable = response.LTable;
        for (Integer i=0;i<OuterTable.size();i++) { 
            System.debug('OK Until here' + OuterTable.get(i));   
//Don't know how to get the rest
Any help would be appreciated.


I have a main class with the following lines inside of it. I'm unable to cover these if blocks in my test class. Please help out.
if(con.FirstName == null)
       {inputTextErrorMessage='Please enter "First Name"';
       if(con.LastName__c == null)
       {inputTextErrorMessage2='Please enter "Last Name"';
       if(con.Country_Code__c == null || con.ContactPhone__c == null)
       {inputTextErrorMessage4='Please choose "Country Code" & enter "Mobile Number"';
       if(con.Email == null)
       {inputTextErrorMessage5='Please enter "Email"';
       if(con.Nationality__c == 'Nationality*')
       {inputTextErrorMessage6='Please choose "Nationality"';
       if(con.Preferred_Time_to_Call__c == 'Preferred time to Call* (GMT +4)')
       {inputTextErrorMessage7='Please choose "Preferred time to Call"';
       return null;}
con.LastName = con.LastName__c  ;     
string conname = con.FirstName+' '+con.LastName__c;
system.debug('conname====>'+conname );
integer flag =1;
list<contact> conlist = [select name,email from contact ];
for(contact c:conlist){
if(c.name == conname && c.email == con.email){
pba__Request__c r = new pba__Request__c();
r.pba__Contact__c = c.id;
r.status__c = 'Pending';

    list<pba__Request__c> relist = [select id,pba__Contact__c,status__c, createddate from pba__Request__c];
         for(pba__Request__c req:relist)
                if(r.pba__Contact__c == req.pba__Contact__c)
                   if((req.status__c == 'Active' || req.status__c == 'Pending')&& (req.createddate.date().daysbetween(System.today()))<7)
                          pagereference pg = new pagereference('https://c.cs86.visual.force.com/apex/OmniyatErrMsg');
                          return pg;
                          return null;
    catch(DMLException e) 
          return null;
insert r;

insert con;
pba__Request__c r = new pba__Request__c();
r.pba__Contact__c = con.id;
r.status__c = 'Active';
insert r;


/*ApexPages.Message errorMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please verify the captcha');
            return null;*/

pagereference pg = new pagereference('http://omniyat-omniyat.cs86.force.com/thankyou');
return pg;