• Hitendar Singh 9
  • NEWBIE
  • 175 Points
  • Member since 2015

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 31
    Replies
Hello,

I'm new to VF & Apex and have been able to get by with most things doing my own research. I'm currently doing a project where I automate an order confirmation page using fields on the order object. 

I know this may be somewhat of a simple problem, but the only roadblock I've come into, is being able to sort the items in my VF table by the unit price. I know of using controller extension SELECT... FROM... ORDER BY... but it doesn't seem to be working. Below is my extension & snippet of the VF table. Could someone please help me out or point me in the right direction for a solution? Thank you so much!

Controller Extension:
public class OrderProductExtension{ 
     public List<OrderItem> getproducts(){
               return products;
     }    
    public OrderProductExtension(ApexPages.StandardController stdController){}
     List<OrderItem> products = 
        [SELECT Quantity, PricebookEntry.Product2.Name, UnitPrice, TotalPrice FROM OrderItem 
         ORDER BY UnitPrice DESC];
}

VF Page Table: 
<apex:pageBlock title="Line Items" >
        <apex:pageBlockTable value="{!Order.OrderItems}" var="oi" >
            <apex:column value="{!oi.Quantity}"/>
            <apex:column value="{!oi.PricebookEntry.Product2.Name}"/>
            <apex:column value="{!oi.UnitPrice}"/>
            <apex:column value="{!oi.TotalPrice}"/>
        </apex:pageBlockTable>
       </apex:pageBlock>

Hello,

       This is the validation rule:

ISPICKVAL( $ObjectType.Agreement__c.Fields.Agreement_Motive__c ,'Location Changed').  Where Agreement_Motive__c is a picklist. I am currently working on Opportunity object. Unfortunately, I am faced with this error:

 Error: Incorrect parameter type for function 'ISPICKVAL()'. Expected Picklist, received Object.

Could you, please, help me with this issue?

I thank you.

Regards, 
Vijay.

I am not able to delete a custom app as it is set to default for userprofile "Authentiated website". There is no option in the authenticated website profile for custom app settings so that i can change from there.
Getting a strange error on some test cases when comparing two decimal values together. Error occurs on line 27 and would probably occur again on line 32. 

 
@isTest 
/*
Author: --
Test for Trigger: PR2PO_ExchangeRateTest
*/
public class PR2PO_ExchangeRateTest {
	static testMethod void validateExchangeTrigger() {
//Logic: 
        Vendor__c vendor=new Vendor__c();
        vendor.Name='Test';
        vendor.Billing_Contact_Email__c='test@puppetlabs.com';
        insert vendor; 
        Vendor__c vendorInserted = [SELECT Id FROM Vendor__c WHERE Billing_Contact_Email__c = 'test@puppetlabs.com' ];
        Purchase_Order__c order = new Purchase_Order__c();
        order.Vendor__c = vendorInserted.Id;
        order.Name = 'PO-99999-Test';
        order.Terms__c  = 'Net 30';
        order.Currency__c= 'GBP';
        order.Currency_Base__c='GBP';
        string newCurrencyCode=order.Currency_Base__c;
        order.Total__c=100.50;
        test.startTest();
        date startOfMonth = date.today().toStartofMonth().addMonths(-1);
        insert order;    
		system.assertEquals(startOfMonth , date.today().toStartofMonth().addMonths(-1));
        Exchange_Rate__c exchangeRate = [SELECT ConversionRate__c FROM Exchange_Rate__c WHERE StartDate__c <= today AND StartDate__c >= :startOfMonth AND IsoCode__c = :newCurrencyCode ORDER BY StartDate__c DESC LIMIT 1];
        system.assertEquals(order.ExchRate_to_USD__c = exchangeRate.ConversionRate__c);        
        order.Currency__c= 'EUR';
        order.Currency_Base__c='EUR';      
        update order;
        system.assertEquals(startOfMonth , date.today().toStartofMonth().addMonths(-1));
        Exchange_Rate__c exchangeRate2 = [SELECT ConversionRate__c FROM Exchange_Rate__c WHERE StartDate__c <= today AND StartDate__c >= :startOfMonth AND IsoCode__c = :newCurrencyCode ORDER BY StartDate__c DESC LIMIT 1];
        system.assertEquals(order.ExchRate_to_USD__c = exchangeRate2.ConversionRate__c);        
        order.Currency__c= 'USD';
        order.Currency_Base__c='USD'; 
        update order;
		system.assertEquals(order.ExchRate_to_USD__c = 1.0); 
        test.stopTest();  
    }
}

 
Setting up business hours, when I uncheck 24-hour check boxes for Saturday and Sunday it keeps reverting back to 24 hours. To try to resolve it, I have created a holiday for Weekend and associated it to the group Business hours but I would rather have the weekend showing as 0 hours. Solutions please.
Hi all

I am using <lightning:navigation>component and page reference to navigate the user from one component to another component. Basically I am displaying a list of items in first component and the detail in second component. Now if I click on first item, it navigates to second component and displays the details. It works fine for the first time. When the user clicks the another item the second time, the detail of first item is displayed as the second component's INIT METHOD NOT EXECUTED. 

Did anyone has faced similar issue? Please let me know if you have any solution.

Thanks
Hi 

Have anyone integrated multiple active directories with single salesforce org using single sign on.

Is it possible?
Hello,

I'm new to VF & Apex and have been able to get by with most things doing my own research. I'm currently doing a project where I automate an order confirmation page using fields on the order object. 

I know this may be somewhat of a simple problem, but the only roadblock I've come into, is being able to sort the items in my VF table by the unit price. I know of using controller extension SELECT... FROM... ORDER BY... but it doesn't seem to be working. Below is my extension & snippet of the VF table. Could someone please help me out or point me in the right direction for a solution? Thank you so much!

Controller Extension:
public class OrderProductExtension{ 
     public List<OrderItem> getproducts(){
               return products;
     }    
    public OrderProductExtension(ApexPages.StandardController stdController){}
     List<OrderItem> products = 
        [SELECT Quantity, PricebookEntry.Product2.Name, UnitPrice, TotalPrice FROM OrderItem 
         ORDER BY UnitPrice DESC];
}

VF Page Table: 
<apex:pageBlock title="Line Items" >
        <apex:pageBlockTable value="{!Order.OrderItems}" var="oi" >
            <apex:column value="{!oi.Quantity}"/>
            <apex:column value="{!oi.PricebookEntry.Product2.Name}"/>
            <apex:column value="{!oi.UnitPrice}"/>
            <apex:column value="{!oi.TotalPrice}"/>
        </apex:pageBlockTable>
       </apex:pageBlock>
Hi there,

I am a new admin at my organization and need some assistance with created custom objects. My team is looking for a page layout that resembles as close as possible to the image below. The highlighted sections are all custom objects and are seen on the detail page off to the right hand side. 

Is this something that is developed as part of Visualforce? I cannot locate anything in general Page Layouts that would provide for this solution.
Image displays separate sections on right hand side of the screen with information related to related custom objects.
Any help is appreciated.
Hi all

I am using <lightning:navigation>component and page reference to navigate the user from one component to another component. Basically I am displaying a list of items in first component and the detail in second component. Now if I click on first item, it navigates to second component and displays the details. It works fine for the first time. When the user clicks the another item the second time, the detail of first item is displayed as the second component's INIT METHOD NOT EXECUTED. 

Did anyone has faced similar issue? Please let me know if you have any solution.

Thanks
My controller:
public class LensPageController {
 public string username{get;set;}
    public List<Order> MyOrder {get;set;}
    public string err{get;set;}
    private final Order oderitem;
    public LensPageController(ApexPages.StandardController stdController)
    {
        this.oderitem = (Order)stdController.getRecord();
             Cookie ck=ApexPages.currentPage().getCookies().get('username');
             if(ck !=null)
             username=ck.getValue();           
        
            
    }
 
}

My visualforce page:
<apex:page  standardController="Order" extensions="LensPageController" showHeader="false" sidebar="false" >

But still can't select in page layout:
No Visualforce pages available
I create a profile: User License=Identity
I want allow this profile can read data of some Standard Object ( Orders, Products)
User-added image

How can add standard object to profile?
public PageReference SaveasPdf(){
 Blob b;
system.debug('CurrentId>>>'+currentid);
 Attachment newAttach = new Attachment();
 PageReference ref = Page.Hydrant_Service_Sheet;

 if(!Test.isRunningTest())  // Error: Compile Error: Method does not exist or incorrect signature: [String].isRunningTest() at line 18 column 6
{
 b = ref.getContentAsPDF();
}
else{
 b = Blob.valueOf('Unit Test Attachment Body');



 newAttach.Name = 'Uplift Request';
 newAttach.ParentId = currentid;
 newAttach.Body = b;
 
 Insert newAttach;
 system.debug('CurrentId>>>'+currentid);
 PageReference pageRef = new PageReference('/'+currentid);
 pageRef.setRedirect(true);
 return pageRef;
}

Error occured in above. But i have check code is correct. if any one konow i do anymistake this rely...........
In our Account is private , So the list views in accounts should show only the users own records for which he/she is the owner of the record. But it is also showing other records for which he/she is not the owner, but an activity is assigned to the user. (A call is logged using Log a call function and assigned to this user earlier) because of which this user is able to see that records too for which he/she is not the owner.

How to hide this record for which he/she is not the owner of the record.?
Hi All,

I want to write a time based trigger on Lead object. I will explain my requirement

If the lead rating is set as "Hot" it should be acted within 1 business day, else will should send an email.. Similarly "Warm" it should be 5days..
 
Hi I am trying to refer an visual force email template (which is having merge fields) in my trigger but when the email is fired I could not see any merge filed data in the email... 

Any help would be great....

Thanks in advance......
  • August 17, 2015
  • Like
  • 0
Hi All,

  Newbie to Apex/VF and am having an issue I was hoping someone would be able to point me in the right direction. I recently inherited a Visualforce page that populates a dropdown from a custom field. When I add a new value to this picklist field it does not appear as an option to select on the Visualforce page, which is the behavior I was expecting. If feels like I must be missing something fairly straightforward, but have spent several hours trying to figure it out with no success.
 
Below is a snippet of the Apex that is bound to that dropdown on the Visualforce page, as well as a screencap of the custom field & the dropdown itself.
 
Thanks in advance for any advice you may be able to provide!

 
<apex:inputField id="Layer" value="{!Layer.Layer__c}" ></apex:inputField>


User-added image

User-added image
I am new to the process builder and want to create a process to evaluate a newly created opportunity.  Then based on the opportunity create date criteria, create an opportunity product line record.  I have debuged and tested the criteria part and it evalutes to true so I have that part right, just can't seem to get it to create the opportunity product line.  Here is a screen shot below of the create a record portion.  I can copy the debug log if that will help.  Any help will be appreciated!!!  This is my first time using the process builder so I could be way off base.  Thank you.
User-added image

Hello,

       This is the validation rule:

ISPICKVAL( $ObjectType.Agreement__c.Fields.Agreement_Motive__c ,'Location Changed').  Where Agreement_Motive__c is a picklist. I am currently working on Opportunity object. Unfortunately, I am faced with this error:

 Error: Incorrect parameter type for function 'ISPICKVAL()'. Expected Picklist, received Object.

Could you, please, help me with this issue?

I thank you.

Regards, 
Vijay.

From trigger i am calling this following class/method, how can write Test class.


global class FutureClass{

 @Future (callout=true)
    public static void SendCaseData(String sCaseNo,String sCaseEmail, String sCaseContact)
    {
       
//WSDL2Apex class     
 SF2ERPCase.SFSendSoap sfsend = new F2ERPCase.SFSendSoap();
          
        String parmXML;
        
        parmXML = '<Root>';
        parmXML += '<CaseNo>' + sCaseNo + '</CaseNo>';
        parmXML += '<CaseEmail>' + sCaseEmail + '</CaseEmail>';
        parmXML += '<CaseContact>' + sCaseContact  + '</CaseContact>';
        parmXML += '</Root>';
        
        sfsend.RecvMsg(parmXML);
       }
}