• Sampath Kumar
  • NEWBIE
  • 260 Points
  • Member since 2014
  • Salesforce Consultant
  • Oakton Consulting Services


  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 39
    Replies
Hi all,
I am trying to query all the records in Account and Contact object ,As I have tried Like this
public class hong12
 {
public List<account> acclist{get;set;}
public List<contact> contlist{get;set;}
public hong12()
{
acclist=[select id,Name,phone,Industry,Type,NumberOfEmployees from Account];
contlist=[select id,Name,Email,phone from Contact];
}
}But I am getting Error Like this
Error: Compile Error: The property List<Contact> contlist is referenced by Visualforce Page (newhomepg) in salesforce.com. Remove the usage and try again. at line 4 column 22
 
Hi,
There is a lookup relationship on Lead to a Custom Object "Technician".
I am trying to get the Created date of the latest Lead created on the related Technican Record.
I am writing a trigger on Lead (after insert),

trigger LeadDate on Lead (after insert) {

Set<Id> techIds = new Set<Id>();

for (Lead lead : Trigger.new) {
    techIds.add(lead.Technician__c);
}

techIds.remove(null);

if (!techIds.isEmpty()) {
    List<Technician__c> techsToUpdate = new List<Technician__c>();

    for (Technician__c tech : [
        select LatestLeadDate__c,
            (
                select CreatedDate
                from Lead__r
                order by CreatedDate asc
                limit 1
            )
        from Technician__c
        where Id in :techIds
    ]) {
        if (!tech.Lead__r.isEmpty()) {
            if (tech.LatestLeadDate__c != tech.Lead__r.get(0).CreatedDate) {
                tech.LatestLeadDate__c = tech.Lead__r.get(0).CreatedDate;
                techsToUpdate.add(tech);
            }
        }
    }

    if (!techsToUpdate.isEmpty()) {
        update techsToUpdate;
    }
}

}

Error: Error: Compile Error: Didn't understand relationship 'Lead__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 14 column 31

Thank You.
  • April 02, 2015
  • Like
  • 0
Update failed. First exception on row 1 with id a1IL0000003CZE4MAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, FlatTrigger: execution of AfterUpdate caused by: System.QueryException: sObject type 'Parking_Inventory__c' is not supported. Class.UpdateParkingInventoryStatusHelper.updateParkingInventoryStatus: line 29, column 1 Class.FlatTriggerHandler.onAfterUpdate:
I tried without success to fix this SF's issue. I edited a class that was not longer used (couldn't delete it) to reduce useless code, but SF is showing me the same lines count than before. I know that Salesforce save metadata of apex classes in an object, but we cannot access to that table. I attached a screen showing the issue, I don't know what can I do to fix it. I fear that is affecting my org's apex coverage level:


User-added image

Thanks for the help.

PD: I already tried to delete the class using the IDE, but It gave me an error related to AsyncApexJobs, like there was a job using that class, but really there was not.
public class ctrlJQDatePicker {
  public String dateDefaultValue { get;set; }
}
can any one write a test class for this?
thanks in advance
<apex:pageBlockSection title="Test" columns="{!columns}">

I have columns value coming from controller.

I want to do something like if(displayed In == Salesforce1, 2 columns, Or display "columns"  for desktop)

 

  • March 27, 2015
  • Like
  • 0
Hi,

I have two picklist values as shown below

1st picklist 
<apex:selectOption itemValue="None" itemLabel="--None--" />
<apex:selectOption itemValue="No" itemLabel="No" />
<apex:selectOption itemValue="Yes" itemLabel="Yes"/>

2nd Picklist has values coming from 
None
A
B

Requirements  -

1) I see 'No' as the default value in the 1st picklist. I wanted None to be the default.

2) If 1st picklist value 'Yes' is selected then 2nd Picklist value B should be selected by default. How can we achieve this?

Thanks
Kumar

 
  • March 26, 2015
  • Like
  • 0
Is it possible, in visualforce, to get the label of the current page, instead of the system name?

For example, something like {!$CurrentPage.Label} instead of {!$CurrentPage.Name}

The Page "Label" has spaces in it, the "Name" has underscores... I'd rather show the label to the user rather than the API Name.
Hi All,

Good Day!

I have few scheduled jobs which will run daily. We will get email alert with status when job is finished.
How to send an email alert when job is aborted or failed?.
As per my knowledge finish method will get execute only when the batch job is completed.

Regards
Sampath Kumar Goud
Hello,

I have a Code like below
 
List<CustomObject1__c> XYZList = new List<CustomObject1__c>();
        
	for(Account c:[SELECT Name, OwnerId, Description, Industry, Type, Website
			FROM Account limit 9999]){
                CustomObject1__c XYZ = new CustomObject1__c();
		
		XYZ.Target_Account_Id__c = c.id;
		
		XYZ.Name = c.Name;
                XYZ.OwnerId = c.OwnerId;

		XYZ.Description__c = c.Description;
                XYZ.Industry__c = c.Industry;
		XYZ.Type__c = c.Type;
		XYZ.Website__c = c.Website;

                
		XYZList.add(XYZ);
         }

        if(XYZList.size()>0){
            insert XYZList;
        }
This gives me below error.

I have added below lines at top of code but in vain
 
Profile objProfile = [Select Id, Name from Profile where Name =: 'System Administrator' limit 1];

	User objeUser = [Select Id, ProfileId from User where Id=: UserInfo.getUserId()];

Line: 38, Column: 1
System.DmlException: Insert failed. First exception on row 71; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user [005b0000000YntB] as owner of 01I8E0000008ks3: []


If i activate the user, it is running Ok, but this is not the solution i seek.

Thank you for suggestions
 
i have created
1.AnimalLocator User-added image



2.AnimalLocatorMock
User-added image

3.AnimalLocatorTest

User-added image


error i am getting

User-added image

please help me

Hello,

I am pretty new to SOQL and I am trying to write a query
List<SObject> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument];
and I get an error:
"sObject type 'QuoteDocument' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

I am trying to build a package and I would like to get the list QuoteDocument if it exists in the Organization and also list should be empty if Quotes are disabled for the organization. How can rewrite the statement to achieve this?

Thank you in advance.

 

Hi, I'm new to custom settings.  I have created one, and can put a query in my developer console window which gives my answer - select Name, NumberOfDays__c from DaysToDelete__c.  If I use the very same query in my Apex class, it returns no rows.  Why is this?  I must be doing something wrong.  The custom setting is a list and is public.  I know you don't need to use a query with custom settings so I also have a line in my code, DaysToDelete__c myCS1 = DaysToDelete__c.getValues('DayNumber');   This returns nothing too.  Please help!
How can I create an additional button (additional to the "New Task" and "New Event) in the Open Activities section of an Account Page?
Hi all,
I am trying to query all the records in Account and Contact object ,As I have tried Like this
public class hong12
 {
public List<account> acclist{get;set;}
public List<contact> contlist{get;set;}
public hong12()
{
acclist=[select id,Name,phone,Industry,Type,NumberOfEmployees from Account];
contlist=[select id,Name,Email,phone from Contact];
}
}But I am getting Error Like this
Error: Compile Error: The property List<Contact> contlist is referenced by Visualforce Page (newhomepg) in salesforce.com. Remove the usage and try again. at line 4 column 22
 
Here Parent object is Account,and child object is Certification__c,and the field to be updated in Parent object is Rating
Hi All,

Can any one solve this issue .

trigger defaultpayment on Student__c (after insert) {
    Student__c student = trigger.new();
    Payment__c payment = new Payment(Student__c = student.Name,StudentId=student.Id,Amount = 200);
    
insert payment;
}

Regards,
Suresh.
  • April 02, 2015
  • Like
  • 0
Hi pls help
i ve custom button like 'crete task' on lead, account, contact and opportunity detail page..
in button url, i need to pass all 4 above with respectively click on detail page.
if it is lead page(id Start with '00Q') pass lead id
if it is opportunity page(id Start with '006') pass opportunity id
etc...,
For this i need url with if conditions..

Thanks in advance
Hi any one help me on this "can we move move class from sand box to production withou test class?".
hi, i want create 2 visualforce pages with a controller using custom object.In the first page, i want to select the one record and pass it's id to another visual force page which will show it's details using query string.But i am getting no result in 2nd page ,in the url i am getting the id but it is appending with AAK.

Please review my code.




1st Visualforce page:

<apex:page controller="MytranschController">

<apex:form >

<apex:dataList value="{!myaccounts}" var="tr">

<apex:outputField value="{!tr.Name}"> </apex:outputField><br></br>

<apex:outputLink onclick="accountClicked()"  value="/apex/secondpage" >

<apex:param name="oid" value="{!tr.Id}" assignTo="{!selectedAccount}"/>

View

</apex:outputLink>

</apex:dataList></apex:form>

</apex:page>







2nd Visualforce page:

<apex:page controller="MytranschController">

 <apex:outputPanel id="id1">

<apex:repeat value="{!contactsInformation}" var="t">

<apex:detail subject="{!$CurrentPage.parameters.oid}" relatedList="false" title="false" />

<p> <apex:outputField value="{!t.Name}"/> </p>

<p>

<apex:outputField value="{!t.Transp_Image__c}"> </apex:outputField></p>

</apex:repeat>

</apex:outputPanel>

</apex:page>




Class

public class MytranschController {

//String value = ApexPages.currentPage().getParameters().get(name);

public Id selectedAccount{get; set;}

    public List<Transportation_Mediums__c> contactsInformation{ get; set;}

    public List<Transportation_Mediums__c> getMyAccounts() {

        return [Select Id,Name,Trans_Image__c,Transportaion_Cost__c from Transportation_Mediums__c ];

    }

    public void accountClicked()

    {

    contactsInformation=[Select Name,Transp_Image__c from Transportation_Mediums__c where Id=:selectedAccount];

    }

}
hi, i want create 2 visualforce pages with a controller using custom object.In the first page, i want to select the one record and pass it's id to another visual force page which will show it's details using query string.But i am getting no result in 2nd page ,in the url i am getting the id but it is appending with AAK.

Please review my code.




1st Visualforce page:

<apex:page controller="MytranschController">

<apex:form >

<apex:dataList value="{!myaccounts}" var="tr">

<apex:outputField value="{!tr.Name}"> </apex:outputField><br></br>

<apex:outputLink onclick="accountClicked()"  value="/apex/secondpage" >

<apex:param name="oid" value="{!tr.Id}" assignTo="{!selectedAccount}"/>

View

</apex:outputLink>

</apex:dataList></apex:form>

</apex:page>







2nd Visualforce page:

<apex:page controller="MytranschController">

 <apex:outputPanel id="id1">

<apex:repeat value="{!contactsInformation}" var="t">

<apex:detail subject="{!$CurrentPage.parameters.oid}" relatedList="false" title="false" />

<p> <apex:outputField value="{!t.Name}"/> </p>

<p>

<apex:outputField value="{!t.Transp_Image__c}"> </apex:outputField></p>

</apex:repeat>

</apex:outputPanel>

</apex:page>




Class

public class MytranschController {

//String value = ApexPages.currentPage().getParameters().get(name);

public Id selectedAccount{get; set;}

    public List<Transportation_Mediums__c> contactsInformation{ get; set;}

    public List<Transportation_Mediums__c> getMyAccounts() {

        return [Select Id,Name,Trans_Image__c,Transportaion_Cost__c from Transportation_Mediums__c ];

    }

    public void accountClicked()

    {

    contactsInformation=[Select Name,Transp_Image__c from Transportation_Mediums__c where Id=:selectedAccount];

    }

}
Hi,
There is a lookup relationship on Lead to a Custom Object "Technician".
I am trying to get the Created date of the latest Lead created on the related Technican Record.
I am writing a trigger on Lead (after insert),

trigger LeadDate on Lead (after insert) {

Set<Id> techIds = new Set<Id>();

for (Lead lead : Trigger.new) {
    techIds.add(lead.Technician__c);
}

techIds.remove(null);

if (!techIds.isEmpty()) {
    List<Technician__c> techsToUpdate = new List<Technician__c>();

    for (Technician__c tech : [
        select LatestLeadDate__c,
            (
                select CreatedDate
                from Lead__r
                order by CreatedDate asc
                limit 1
            )
        from Technician__c
        where Id in :techIds
    ]) {
        if (!tech.Lead__r.isEmpty()) {
            if (tech.LatestLeadDate__c != tech.Lead__r.get(0).CreatedDate) {
                tech.LatestLeadDate__c = tech.Lead__r.get(0).CreatedDate;
                techsToUpdate.add(tech);
            }
        }
    }

    if (!techsToUpdate.isEmpty()) {
        update techsToUpdate;
    }
}

}

Error: Error: Compile Error: Didn't understand relationship 'Lead__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 14 column 31

Thank You.
  • April 02, 2015
  • Like
  • 0

Hi,

There is a lookup relationship on Lead to a Custom Object "Technician".

I am trying to get the Created date of the latest Lead created on the related Technican Record.

I am writing a trigger on Lead (after insert), can some one help me with the logic of getting the related techcian id and populate the Created date on technician.

Thank You.

  • April 01, 2015
  • Like
  • 0
I tried without success to fix this SF's issue. I edited a class that was not longer used (couldn't delete it) to reduce useless code, but SF is showing me the same lines count than before. I know that Salesforce save metadata of apex classes in an object, but we cannot access to that table. I attached a screen showing the issue, I don't know what can I do to fix it. I fear that is affecting my org's apex coverage level:


User-added image

Thanks for the help.

PD: I already tried to delete the class using the IDE, but It gave me an error related to AsyncApexJobs, like there was a job using that class, but really there was not.