• a sangeetha 5
  • NEWBIE
  • 55 Points
  • Member since 2016

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 14
    Replies
Hi,

I need some guidance on to what im not doing correctly.

Im trying to build a custom controller which gets the number of 3 fields on records that are due to be shipped in the next few days grouped by date. 
 
public class LogisticsQuantity {
//your main class
//
    Date STARTDAY = Date.today();
    Date ENDDAY = STARTDAY.addDays(5);

    public Summary[] Summaries { get; set; }

    public LogisticsQuantity() {
        AggregateResult[] results = [
            SELECT Last_Date_for_Dispatch__c, Count(Id),SUM(Hard_Wired_Dash_Camera__c), SUM(New_Unit_Qty__c), SUM(Service_Unit_Qty__c) FROM Unit_Request__c WHERE Last_Date_for_Dispatch__c >= :STARTDAY AND Last_Date_for_Dispatch__c < :ENDDAY 
            GROUP BY Last_Date_for_Dispatch__c 
        ];
        Summaries = new List<Summary>();
        for (AggregateResult ar : results) {
            Summaries.add(new Summary(ar));
        }
    }

    // wrapper class to hold aggregate data
    public class Summary {
        public Integer NewQuantity { get; set; }
        public Integer SvcQuantity { get; set; }
        public Integer CamQuantity { get; set; }
        public String Name { get; set; }

        public Summary(AggregateResult ar) {
            CamQuantity = (Integer) ar.get('Hard_Wired_Dash_Camera__c');
            NewQuantity = (Integer) ar.get('New_Unit_Qty__c');
            SvcQuantity = (Integer) ar.get('Service_Unit_Qty__c');
            Name = (String) ar.get('Last_Date_for_Dispatch__c');
        }
    }

}
I created a visualforce page to test it out on.
<apex:page controller="LogisticsQuantity">
    <apex:form >
        <apex:repeat value="{!Summaries}" var="summary">
            {!summary.Name}: {!summary.NewQuantity} {!summary.SvcQuantity} {!summary.CamQuantity}<br/>
        </apex:repeat>
    </apex:form>
    

</apex:page>
Its blank when there isnt any records that meet any of the criteria but i get Invalid field field_name__c for AggregateResult. Its happening for all 3 fields that im trying to get SUM of.

All these fields are number formula fields with no decimal points. And display as 0 as default value if there is no number in fields it pulls from. Ive never done Aggregate results.


 
Hello Guys,

I need help in writing a test class for the below trigger.

trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                  
            }
        }
    }  
}

*********************************************************************
My test Class which got 0% code coverage.
***********************************************************************
@isTest
public class AccountNameUpdate {  
  @isTest  static void updateAccount(){
        Account a = new Account();
        a.Name = 'Abhishek Gupta';
        insert a;
        Booking_Link__c bl= new Booking_Link__c();
        bl.Customer_Number__c = a.Customer_Number__pc;
        bl.T2G__c =True;
        bl.Account__c = a.Id;
        bl.OwnerId = a.OwnerId;
        update bl;
    }

}

*************************************************
Help me out from this...
Azar Khasim.
Hi,
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: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []

Im getting the above error. Please someone help me to fix.
Hi,

I need some guidance on to what im not doing correctly.

Im trying to build a custom controller which gets the number of 3 fields on records that are due to be shipped in the next few days grouped by date. 
 
public class LogisticsQuantity {
//your main class
//
    Date STARTDAY = Date.today();
    Date ENDDAY = STARTDAY.addDays(5);

    public Summary[] Summaries { get; set; }

    public LogisticsQuantity() {
        AggregateResult[] results = [
            SELECT Last_Date_for_Dispatch__c, Count(Id),SUM(Hard_Wired_Dash_Camera__c), SUM(New_Unit_Qty__c), SUM(Service_Unit_Qty__c) FROM Unit_Request__c WHERE Last_Date_for_Dispatch__c >= :STARTDAY AND Last_Date_for_Dispatch__c < :ENDDAY 
            GROUP BY Last_Date_for_Dispatch__c 
        ];
        Summaries = new List<Summary>();
        for (AggregateResult ar : results) {
            Summaries.add(new Summary(ar));
        }
    }

    // wrapper class to hold aggregate data
    public class Summary {
        public Integer NewQuantity { get; set; }
        public Integer SvcQuantity { get; set; }
        public Integer CamQuantity { get; set; }
        public String Name { get; set; }

        public Summary(AggregateResult ar) {
            CamQuantity = (Integer) ar.get('Hard_Wired_Dash_Camera__c');
            NewQuantity = (Integer) ar.get('New_Unit_Qty__c');
            SvcQuantity = (Integer) ar.get('Service_Unit_Qty__c');
            Name = (String) ar.get('Last_Date_for_Dispatch__c');
        }
    }

}
I created a visualforce page to test it out on.
<apex:page controller="LogisticsQuantity">
    <apex:form >
        <apex:repeat value="{!Summaries}" var="summary">
            {!summary.Name}: {!summary.NewQuantity} {!summary.SvcQuantity} {!summary.CamQuantity}<br/>
        </apex:repeat>
    </apex:form>
    

</apex:page>
Its blank when there isnt any records that meet any of the criteria but i get Invalid field field_name__c for AggregateResult. Its happening for all 3 fields that im trying to get SUM of.

All these fields are number formula fields with no decimal points. And display as 0 as default value if there is no number in fields it pulls from. Ive never done Aggregate results.


 
I have a field in Account that is a type of User, called Customer_Support_User__c. I would like to query Accounts and get all of the "Name" field for all Customer_Support_User__c. I've tried the following:
- SELECT Customer_Support_User__c.Name from Account
- SELECT (SELECT Name FROM Customer_Support_User__c) FROM Account

The Customer_Support_User__c is the Parent of Account, so based on what I've read, the second query I tried should work. Any ideas?
Dear Team ,

Greetings !!! 

I have created Lightning page . I am unable to call this Lightning Page in any Lightning App. Plz suggest some solution.

Thanks & Regards
Sachin BhaleraoLightning Page Image
Hello Guys,

I need help in writing a test class for the below trigger.

trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                  
            }
        }
    }  
}

*********************************************************************
My test Class which got 0% code coverage.
***********************************************************************
@isTest
public class AccountNameUpdate {  
  @isTest  static void updateAccount(){
        Account a = new Account();
        a.Name = 'Abhishek Gupta';
        insert a;
        Booking_Link__c bl= new Booking_Link__c();
        bl.Customer_Number__c = a.Customer_Number__pc;
        bl.T2G__c =True;
        bl.Account__c = a.Id;
        bl.OwnerId = a.OwnerId;
        update bl;
    }

}

*************************************************
Help me out from this...
Azar Khasim.
Hello All,

I have custom object named order and order product when I trying to insert record into related list i. order product object, record is inserted but when i refresh the page after insert operation or any dml operation showing below error.

Looks like there's a problem.
Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.
No such column 'Name' on entity 'VLSF_Order_Product__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
User-added image

Hi,
I'm struggle to access a custom field throught the PHP SDK.
The field exist:
User-added image
I can access the basic fields, but when i try to add the custom field to the query, always return the same error.

$query = "SELECT Id, FirstName, LastName, Phone, NumOrdem__c FROM Contact";
Error: "No such column 'NumOrdem__c' on entity 'Contact'. "

I've generate already the WSDL several times, but without success.

Can someone help and point me to the right direction?
I really appreciate.

Regards,Nuno

Hi All,
Here my situation is, in Opportunity object we are having a field closed date and in product level their is a field Date field 
my requriment is when we will change opportunity closed date field by 3 days then in product level date field should be added by 3 days.
for example: Opportunity closed date is 6/1/2017 i will change it to 6/3/2017 then in opportunity product if it is 5/31/2017 it should become 6/2/2017.
 we can achieve it by trigger but we need workflow because some other reqiurment are their based on this change in the UI
I need a help to write a workflow formula

Thanks in advance

Regards,
satya
 
How to create a custom column field in CaseUser-added image
Hi,
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: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.: []

Im getting the above error. Please someone help me to fix.
I have searched all the answers, but have yet to find the error I am getting. Can someone please explain to me what this means.

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: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process was found.:
The challenge as follows:

For purposes of local regulation new customers must be approved by the legal team.

When an Account has the value of 'Prospect' in the Type field, a user will click the 'Submit for Approval' button to launch an approval process. The process will only happen if Type is 'Prospect' and there are more than 500 employees. Upon entry of the process, Type will become 'Pending' and be locked. If approved, Type will be set to 'Customer' and be unlocked. If not approved, Type will be set back to 'Prospect' and will be unlocked.

The Account object's Type field must have the following picklist values: Prospect, Customer, Pending. Before creating the approval process, verify the values in your Account object setup
The approval process name must be 'Approve New Account'.
When user click 'Submit for Approval', the approval must be processed if the Type field is set to 'Prospect' and the value of Employees is greater than 500.
Upon entering the approval process, set the Type field to 'Pending' and lock the record.
Normally the approver would be someone else. In this instance, assign yourself to be the approver.
If approved, set the Type field to 'Customer' and unlock the record.
If not approved, set the Type field back to 'Prospect', and unlock the record.

I am getting error message: 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: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [nextApproverIds]: [nextApproverIds]

This are the steps I did:

Created approval process called Approve New Account
Criteria Account Type field equals Prospect and Account Employees field greater than 500
Final Approval Actions - Update Type field to Customer
Final Rejection Actions - Update Type field to Prospect

What am I missing that I received the error message?  Please help.

Thanks.