• KRavi
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 7
    Replies
We have a requirement to create VF page as below
User-added image
 
Similarly., Answers can be of any data type from text box to radio button.
 
Data in the object looks like this:
 
User-added image
 
Challenge is all Answers are stored in Longtext field with semicolon separator.
We have to parse this string into desired datatype based on RecordType.Name field and display it in exact data type (editable format) on VF page.
 
Thanks in advance
  • August 23, 2018
  • Like
  • 0
We have a requirement to create VF page as below
User-added image
 
Similarly., Answers can be of any data type from text box to radio button.
 
Data in the object looks like this:
 
data in object
 
Challenge is all Answers are stored in Longtext field with semicolon separator.
We have to parse this string into desired datatype based on RecordType.Name field and display it in exact data type (editable format) on VF page.

I tried repeator to create multiple Pageblocktables for each row., unfortunately I didn't hit the right spot (no ideal solution ) yet!!...
any help would greatly appreciated!!
  • August 23, 2018
  • Like
  • 0
I thought I’d share a logical complication am dealing with, as figuring this is kind of crushing me.
I have the below data in a map…..
while creating invoice for 120 quantity
First 100 qty should be charged for $20 each
Next 20 qty should be charged for $15 each
Invoice Total = (100 X 20) + (20 X 15) = $2300.
 
ItemDescriptionBilling UnitPrice Frequency of ThresholdStart Date of CalculationExpiration Date of Threshold  MinThreshold Max
Chem01LandDropDrum$20.00Yearly01/01/1712/31/171100
Chem01LandDropDrum$15.00 Yearly01/01/1712/31/17101150
Chem01LandDropDrum$10.00 Yearly01/01/1712/31/17151200
 
 
But Inside trigger, I couldn’t get the exact price ($15) for next 20 qty, as I do not have a proper unique key on Map…..couldn’t think of decent logic to get there. any thoughts would be appreciated.

Thanks
Kishore
  • October 28, 2017
  • Like
  • 0

I have requirement to display cross object fields (related through LOOKUP) in a Visual force Email template 
I created a VFpage, VF Component and controller as below:

public  class WasteProfileApprovalTemplt
{
    public  List<Approved_Destination__c> lstDest { get;set;}
    public Id WPId {get;set;}
    
    public WasteProfileApprovalTemplt(){
        lstDest= [SELECT Name,Facility__c,Facility__r.name,Facility_Code__c,Primary_Process_Code__c,Primary_Process_Code__r.name,CreatedDate,CreatedById 
        FROM    Approved_Destination__c  WHERE Waste_Profile__c =: WPId];
    }
     public List<Approved_Destination__c> lstGetAppDests(){
          system.debug('lstDest:' + lstDest);
     return lstDest;

     }

    /* public String lstDest { get; set; }
    public Id WPId {get;set;}
    public List<Approved_Destination__c> lstGetAppDests()
    {
        List<Approved_Destination__c> lstDest;
        lstDest= [SELECT Name,Facility__c,Facility__r.name,Facility_Code__c,Primary_Process_Code__c,Primary_Process_Code__r.name,CreatedDate,CreatedById 
        FROM    Approved_Destination__c  WHERE Waste_Profile__c =: WPId];
        return lstDest;
    } */
}

--VF COmponent

<apex:component controller="WasteProfileApprovalTemplt" access="global">
<apex:attribute name="WProfId" type="Id" description="Id of the WasteProfile" assignTo="{!WPId}"/>
<table border = "2" cellspacing = "5">
<tr>
<td>Approved Waste Destination ID</td>
<td>Facility Common Name</td>
<td>Facility Code</td>
<td>Primary Process Code</td>
<td>Created Date</td>
</tr>
<apex:repeat value="{!lstDest}" var="wp">
<tr>
<td>{!wp.Name}</td>
<td>{!wp.Facility__r.name}</td>
<td>{!wp.Facility_Code__c}</td>
<td>{!wp.Primary_Process_Code__r.Name}</td>
<td>{!wp.CreatedDate}</td>
</tr>
</apex:repeat>
</table> </apex:component>

--VF Page

<messaging:emailTemplate subject="Waste Profile Approval Notification" recipientType="User" relatedToType="Profile__c">
<messaging:htmlEmailBody >

<html>
    <body>
        <p>*** Stericycle Waste Profile Approval Notification***</p>
        <p>The following Stericycle Waste Profile has been conditionally approved pending generator signature and return of</p>
        <p>the attached profile document:</p>
        <p>Profile #: {!relatedTo.PreviewID__c}</p>
        <p>Waste Description: {!relatedTo.WasteDescription__c}</p>
        <p>Account: {!relatedTo.Account__c}</p>
        <p>Queue: {!relatedTo.Queue__c}</p>
          

        <p>Approval Submission Date: {!relatedTo.Approval_Submission_Date__c}</p>
        <p>Submission Priority: {!relatedTo.Submission_Priority__c}</p>
        
        <c:WasteProfileApprovalTemplt WProfId="{!relatedTo.Id}" /><br/><br/>
        
        <p/>
        <p>Acceptance Statement: In accordance with 40 CFR 264.12(b), the following Stericycle, Inc. facilities have the 
           appropriate federal and state permits for, and will accept the waste the generator is shipping as described in this 
           profile. Additional facilities may be evaluated and added on an as needed basis. </p>
        <p/>

        <p> https://cs24.salesforce.com/{!relatedTo.Id}</p>

    </body>
</html>

</messaging:htmlEmailBody>
</messaging:emailTemplate>

In the email, I couldnt get the values from the Object in Controller.
DId i miss something.
Thank you
  • May 31, 2016
  • Like
  • 0
I have requirement to display cross object fields (related through LOOKUP)
i created a VFpage, VF Component and controller

public  class WasteProfileApprovalTemplt
{
    public  List<Approved_Destination__c> lstDest { get;set;}
    public Id WPId {get;set;}
    
    public WasteProfileApprovalTemplt(){
        lstDest= [SELECT Name,Facility__c,Facility__r.name,Facility_Code__c,Primary_Process_Code__c,Primary_Process_Code__r.name,CreatedDate,CreatedById 
        FROM    Approved_Destination__c  WHERE Waste_Profile__c =: WPId];
    }
     public List<Approved_Destination__c> lstGetAppDests(){
          system.debug('lstDest:' + lstDest);
     return lstDest;

     }

    /* public String lstDest { get; set; }
    public Id WPId {get;set;}
    public List<Approved_Destination__c> lstGetAppDests()
    {
        List<Approved_Destination__c> lstDest;
        lstDest= [SELECT Name,Facility__c,Facility__r.name,Facility_Code__c,Primary_Process_Code__c,Primary_Process_Code__r.name,CreatedDate,CreatedById 
        FROM    Approved_Destination__c  WHERE Waste_Profile__c =: WPId];
        return lstDest;
    } */
}

--VF COmponent

<apex:component controller="WasteProfileApprovalTemplt" access="global">
<apex:attribute name="WProfId" type="Id" description="Id of the WasteProfile" assignTo="{!WPId}"/>
<table border = "2" cellspacing = "5">
<tr>
<td>Approved Waste Destination ID</td>
<td>Facility Common Name</td>
<td>Facility Code</td>
<td>Primary Process Code</td>
<td>Created Date</td>
</tr>
<apex:repeat value="{!lstDest}" var="wp">
<tr>
<td>{!wp.Name}</td>
<td>{!wp.Facility__r.name}</td>
<td>{!wp.Facility_Code__c}</td>
<td>{!wp.Primary_Process_Code__r.Name}</td>
<td>{!wp.CreatedDate}</td>
</tr>
</apex:repeat>
</table> </apex:component>

--VF Page

<messaging:emailTemplate subject="Waste Profile Approval Notification" recipientType="User" relatedToType="Profile__c">
<messaging:htmlEmailBody >

<html>
    <body>
        <p>*** Stericycle Waste Profile Approval Notification***</p>
        <p>The following Stericycle Waste Profile has been conditionally approved pending generator signature and return of</p>
        <p>the attached profile document:</p>
        <p>Profile #: {!relatedTo.PreviewID__c}</p>
        <p>Waste Description: {!relatedTo.WasteDescription__c}</p>
        <p>Account: {!relatedTo.Account__c}</p>
        <p>Queue: {!relatedTo.Queue__c}</p>
          

        <p>Approval Submission Date: {!relatedTo.Approval_Submission_Date__c}</p>
        <p>Submission Priority: {!relatedTo.Submission_Priority__c}</p>
        
        <c:WasteProfileApprovalTemplt WProfId="{!relatedTo.Id}" /><br/><br/>
        
        <p/>
        <p>Acceptance Statement: In accordance with 40 CFR 264.12(b), the following Stericycle, Inc. facilities have the 
           appropriate federal and state permits for, and will accept the waste the generator is shipping as described in this 
           profile. Additional facilities may be evaluated and added on an as needed basis. </p>
        <p/>

        <p> https://cs24.salesforce.com/{!relatedTo.Id}</p>

    </body>
</html>

</messaging:htmlEmailBody>
</messaging:emailTemplate>

In the email, I couldnt get the values from the Object in Controller.
DId i miss something.
appreciate your help in advance.
 
  • May 29, 2016
  • Like
  • 0
Hi ExpertsInvoice sample dashboard

I have a requirement where I need to show Invoice status on dashboard with Invoice staus on X-Axis and Invoice age on Y-Axis.
age to be calculated from standard [create date] to [today] like 10 days, 20 days, 30 days, 40 days and so.
how do I calcualte the age from create date, coz i cannot acheive that using formual field on report builder and on Y-Axis it doesnt allow me to  select any column except Record Count.
 
any workarounds would be helpful

Thank you
Benn
  • February 02, 2016
  • Like
  • 0
I've to create a function which can calcuate sum(POtotal) from PODetail object and EMail the result to provided EMail ID
calculateTotalPO(string ToEmail, string Fieldname,string objname)

this function should handle more than 100,000 records
how do i achieve this, bcoz in a SOQL query i cannot retrieve more than 50,000 records at a time.
but in our object we have moer than 200,0000 records

do assist me in creating this function to handle more than 200,000 records and send an Email 
 
  • December 23, 2015
  • Like
  • 0
Hi Experts,

recently when i tried to create APEX Trigger and Class, I've got Indexing isssue and I raised a ticket to salesforce to convert few fields into external ID and then apex trigger/class went well.

Now same fields were throwing same (below) error in Test Class
error: 
------------------------------------Error---------------------------------------------------------
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, assignLocationToAccount: execution of BeforeInsert

caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

Trigger.AddToAccount: line 40, column 1: []

------------------------------------Error---------------------------------------------------------


here is the Line 40 code in trigger: 

List<Account> accdet = New List<Account>([SELECT ShippingCountry,shippingstate,Shippingstatecode FROM Account where Shippingstatecode IN : statecode limit 1000]);

This field [Shippingstatecode] is indexed recently

Here is my Test Class

@isTest(SeeAllData=true)
Private class Test_AddSvmxLocation{
/**
Test Method : test_trigger
Description : This method covers both Insert and Update Events of Apex trigger "AddSvmxLocation"
          
**/
static testmethod void test_LocinsertTrigger(){
Account AccRec =[select id, name,ShippingStreet,ShippingCity,ShippingState,ShippingCountry 
                from Account where Type='Generator' limit 1];
    system.debug('---TestAccRec---'+AccRec);
Account acc = new Account();
acc=AccRec.clone();
acc.type='Generator';
 
 insert acc;
acc.name = 'LocTest99';
update acc;
SVMXC__Site__c[] siteList = [SELECT Id, SVMXC__Account__c from SVMXC__Site__c limit 1];
string testAssert='test';
system.assertEquals(testAssert,'test'); 
}
}


The same test class gives me 100% code coverage in another sandbox with less data.

I guess the issue here is again due to Indexing....... but these fields are already indexed,
do i need to do something again for test classes, if so i have no clue in  that regard

Any help would be highly appreciated

Thank you
Kishore



 
  • September 28, 2015
  • Like
  • 0
Hi Experts, 

am trying to read values from few fields (text and dropdown fields)in a before insert Account trigger.
but to my surprise, when am trying to read values from drop down fields am getting null values while inserting a record. but inserted record has valid values in drop down lists.
but while updating a record it looks fine

below is the code, 
trigger assignLocation on Account (before Insert, before Update) {
 for (Account account : Trigger.new) {
        street.add(account.ShippingStreet);
        city.add(account.ShippingCity);
        state.add(account.ShippingState);
        zipCode.add(account.ShippingPostalCode);
        country.add(account.ShippingCountry);
     } 
}
     
     System.debug('--streetstreet --: ' + street ); // am getting desired value
     System.debug('--citycity --: ' + city ); // am getting desired  value
     System.debug('--statestate --: ' + state ); // this is drop down field, in trigger it shows null while inserting a record.
      System.debug('--zipCode --: ' + zipCode ); // am getting desired  value
     System.debug('--countrycountry --: ' + country ); // this is drop down field, in trigger it shows null while inserting a record.



I have to use BEFORE INSERT/UPDATE TRIGGER, as i have to update a field before inserting.

Thank you
  • September 17, 2015
  • Like
  • 0
hi experts,

i mi got a trigger that handles bulk insert 
hence I just got single insert statement to insert multiple records at once 
insert list 

now I have a requirement to update a field in another object with ID of re odd just created

for that I need IDs list of records just created in this transaction 

I guess, if am inserting a single record, then I can get ID as below
insert acc
acc.id

but in my case, am inserting a list of records in a single insert statement 
can we use keyset() to achieve this 

any suggestions to achieve this is highly appreciated 

thank you 
 
  • September 15, 2015
  • Like
  • 0
I Have a report in [Summary report format] in Salesforce that accepts 2 parameters.
how to display this report in visual force page, this VF page is in Community portal.

I tried several ways over formus, none of them were useful for me :(

Is it possible to display report in community portal vf page?

any help would be appreciated

Thank you
  • July 06, 2015
  • Like
  • 0
Hi everyone, 

Point and click Admin here. Hoping someone can help me with a visual force template. 

We've got a custom object called Case MS which is a child of Case.

I am trying to create a template that can be sent from the Case that lists all associated Case MS records. Fields needed:
Master_Shipment__c (This field is an External Lookup)
MS_Invoice_Link__c

I tried following the example provided on this link, but got lost. 
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_templates_creating.htm

Any help is greatly appreciated! Thank you!!
Hi Experts, 

am trying to read values from few fields (text and dropdown fields)in a before insert Account trigger.
but to my surprise, when am trying to read values from drop down fields am getting null values while inserting a record. but inserted record has valid values in drop down lists.
but while updating a record it looks fine

below is the code, 
trigger assignLocation on Account (before Insert, before Update) {
 for (Account account : Trigger.new) {
        street.add(account.ShippingStreet);
        city.add(account.ShippingCity);
        state.add(account.ShippingState);
        zipCode.add(account.ShippingPostalCode);
        country.add(account.ShippingCountry);
     } 
}
     
     System.debug('--streetstreet --: ' + street ); // am getting desired value
     System.debug('--citycity --: ' + city ); // am getting desired  value
     System.debug('--statestate --: ' + state ); // this is drop down field, in trigger it shows null while inserting a record.
      System.debug('--zipCode --: ' + zipCode ); // am getting desired  value
     System.debug('--countrycountry --: ' + country ); // this is drop down field, in trigger it shows null while inserting a record.



I have to use BEFORE INSERT/UPDATE TRIGGER, as i have to update a field before inserting.

Thank you
  • September 17, 2015
  • Like
  • 0
hi experts,

i mi got a trigger that handles bulk insert 
hence I just got single insert statement to insert multiple records at once 
insert list 

now I have a requirement to update a field in another object with ID of re odd just created

for that I need IDs list of records just created in this transaction 

I guess, if am inserting a single record, then I can get ID as below
insert acc
acc.id

but in my case, am inserting a list of records in a single insert statement 
can we use keyset() to achieve this 

any suggestions to achieve this is highly appreciated 

thank you 
 
  • September 15, 2015
  • Like
  • 0
I Have a report in [Summary report format] in Salesforce that accepts 2 parameters.
how to display this report in visual force page, this VF page is in Community portal.

I tried several ways over formus, none of them were useful for me :(

Is it possible to display report in community portal vf page?

any help would be appreciated

Thank you
  • July 06, 2015
  • Like
  • 0