• Ryan Mason 5
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Can anyone help format a timezone in my VFP? I am newer to visualforce and was assigned this. This is a custom VFP used to customize our related lists. Here is the code for my hover:

                <apex:column styleClass="{!IF(arw.shouldHighlight,'highlight','')}">
                    <apex:facet name="header">Medication<br />Name</apex:facet>
                    <apex:outputLink rel="medDisplayImage"
                        html-data-ndc="{!arw.cm.NDC__c}"
                        html-data-rxnumber="{!arw.cm.Rx_Number__c}"
                        html-data-packsize="{!arw.cm.Pack_Size__c}"
                        html-data-reqresults="{!arw.cm.Refill_Request_Results__c}"
                        html-data-lastescript="{!arw.cm.MD_Last_Escript_Fax_Date__c}"
                        html-data-lastcall="{!arw.cm.MD_Contact_Last_Call_Date__c}"
                        html-data-patcont="{!arw.cm.Patient_Contacted__c}"
                        html-data-rphauth="{!arw.cm.RPH_Authorization_Date__c}"
                        html-data-reqoutcome="{!arw.cm.Refill_Request_Outcome__c}"            
                        value="{!URLFOR($Action.Current_Medication__c.View, arw.cm.Id)}">{!arw.cm.Name}</apex:outputLink>
                </apex:column>


_______________________________________________________________________
j$(document).tooltip({
        items: 'a[rel="medDisplayImage"]',
        container : 'body',
        track: true,
        content: function(callback) {
            var element = jQuery(this);
            var ndc = element.data('ndc');
            var rxNum = element.data('rxnumber');
            var packsize = element.data('packsize');
            var reqresults = element.data('reqresults');
            var lastescript = element.data('lastescript');
            var lastcall = element.data('lastcall');
            var patcont = element.data('patcont')
            var rphauth = element.data('rphauth')
            var reqoutcome = element.data('reqoutcome')

            
            //lastescript = lastescript.format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'');
            

            if(lastcall) {
                lastcall = lastcall.toLocaleString();
            }
let retString = '<img class="medImage" alt="" src="https://example.com/FDB_DrugDrug_Interactions/drugImage.php?drug_ndc='+ndc+'"><br /><div style="text-align:center;font-size:small;"><strong>Pack Size: '+packsize+'</strong></div><br /><div style="text-align:left;font-size:small;"><strong>MD Last Escript Fax Date: </strong>'+lastescript+'</div><br /><div style="text-align:left;font-size:small;"><strong>MD Contact Last Call Date: </strong>' + lastcall + '</div><br /><div style="text-align:left;font-size:small;"><strong>Patient Contacted: </strong>'+patcont+'</div><br /><div style="text-align:left;font-size:small;"><strong>Refill Request Outcome: </strong>' + reqoutcome + '</div><br /><div style="text-align:left;font-size:small;"><strong>Refill Request Results: </strong>' + reqresults + '</div><br /><div style="text-align:left;font-size:small;"><strong>RPH Authorization Date: </strong>' + rphauth + '</div>';


The issue is that my output displays in GMT. I want it to display in org's default (Eastern time) OR I want to remove the time altogether and just display the date. Also, Is there a way I can only display the Field if there is a value stored? See pic for example you'll see the GMT time zones & the last field is NULL.
User-added image
 
I need to take this SOQL query out of my for loop. I've been researching using the Map method but honestly stuck when it comes to applying the logic to what I have:

for (Lead newLead : newLeadList)
        {
            system.debug('here ryan');
            Id referringAccount = newLead.Referring_Account__c;
            Account accountPulls = [SELECT Account_Pulls_Medication_History__c FROM Account WHERE Id =: referringAccount];
                
            system.debug('here ryan'+accountPulls);
            if (accountPulls.Account_Pulls_Medication_History__c)
            {
                system.debug('here ryan2');
                if(newLead.Medication_History_Pull__c == null)
                {
                    newLead.Medication_History_Pull__c = 'Pending';
                    system.debug('here ryan3');
                }
            }
        }


Any help would be much appreciated
 
 
 
I need to take this SOQL query out of my for loop. I've been researching using the Map method but honestly stuck when it comes to applying the logic to what I have:

for (Lead newLead : newLeadList)
        {
            system.debug('here ryan');
            Id referringAccount = newLead.Referring_Account__c;
            Account accountPulls = [SELECT Account_Pulls_Medication_History__c FROM Account WHERE Id =: referringAccount];
                
            system.debug('here ryan'+accountPulls);
            if (accountPulls.Account_Pulls_Medication_History__c)
            {
                system.debug('here ryan2');
                if(newLead.Medication_History_Pull__c == null)
                {
                    newLead.Medication_History_Pull__c = 'Pending';
                    system.debug('here ryan3');
                }
            }
        }


Any help would be much appreciated