• Jon-Michael Murphey
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
Im able to get all the child account's contacts to display on the parent account but i essentially need all contacts related to the parent account to be avaibale to the parent and child accounts.
I have a visualforce page that has an iframe with a prefill url to a third-party form tool, the tool works great on destop however it will not resize to work properly on SF1 app.

<apex:page showHeader="false" sidebar="false" standardStylesheets="false" standardController="Event" docType="html-5.0">

    <apex:iframe src="https://weirtestsurvey.tfaforms.net/30?tfa_215={!Event.OwnerId}&tfa_312={!Event.ID}&tfa_242={!Event.What.name}&tfa_217={!Event.What}&tfa_326={!Event.Subject}&tfa_327={!Event.Event_Start_Date__c}" scrolling="true" id="Iframe"/>

<script>
    // Resize the iframe that contains the Visualforce page
    function resizeIframe() {
        var frameHeight = document.body.scrollHeight;
        var iframeElements = parent.document.getElementsByTagName("iframe");
        for (var i = 0; i < iframeElements.length; i++){
            if (iframeElements[i].title == '{!$CurrentPage.Name}'){
                var iframeElement = parent.document.getElementById(iframeElements[i].id);
                if (iframeElement) {
                    iframeElement.style.height = (frameHeight)+"px";
                }
            }
        }
    }

    if (document.addEventListener) {
        checkIfReady = function() {
            document.removeEventListener("DOMContentLoaded", checkIfReady, false);
            resizeIframe();
        };
    }
    else if (document.attachEvent) {
        checkIfReady = function() {
            if (parent.document.readyState == "complete") {
                parent.document.detachEvent("onreadystatechange", checkIfReady );
                resizeIframe();
            }
        };
    }

    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", checkIfReady, false);
    }
    else if (document.attachEvent) {
        parent.document.attachEvent("onreadystatechange", checkIfReady);
    }
</script>
</apex:page>
Im needing to create a Global Action or button in my lightning experince on a custom object. Once clicked will update the lat/long fields with the users current location
I have a schedule apex that deactivates users after 90 days since last login, the apex failed on run because of an Unexpected token error on the following: First error: unexpected token: 'dt'

Please review the snippit below:

        dateTime dt = date.today()-90;
       public String query = 'SELECT Name, LastLoginDate, Id From User WHERE IsActive = true AND LastLoginDate < +dt  and profile<>"System Adminstrator" ';
Im trying to update a custom field called related_contact__c on opportunity, that will populate with the id of a related contact. This will auto-populate when a contact is related to the opportunity but is not the contact lookup field
The apex class works in the Full sandbox but when deployed to production it doesnt work. Class is active field names/apis match and correct permissions are set. I need help with this. I tried using the DLRS tool from app exchange but its causing an error that no one can find out why so i tried it in Apex. Please help.. Im needing to count the number of Activites (open/closed) on contacts, the DLRS is workiung for the Tasks but not Events. Please help...see code below


public with sharing class ContactActivityCount {

    public static Boolean didRun = false;
    public static String conPrefix =  Contact.sObjectType.getDescribe().getKeyPrefix();

    /*
    * Takes a set of contact IDs, queries those contacts, and updates the activity count if appropriate
    */
    public static void updateContactCounts(Set<ID> conIds) {

        if (didRun == false) { //We only want this operation to run once per transaction.
            didRun = true;

            //Query all the contacts, including the tasks child relationships
            List<Contact> con = [SELECT ID, Event2cnt__c, (SELECT ID FROM Tasks), (SELECT ID FROM Events) FROM Contact WHERE ID IN :conIds];
            List<Contact> updateCons = new List<Contact>();

            for (Contact o : con) {
                Integer count = o.tasks.size() + o.events.size();

                if (o.Event2cnt__c != count) {
                    o.Event2cnt__c = count;
                    updateCons.add(o); //we're only doing updates to cons that have changed...no need to modify the others
                }
            }

            //Update the appropriate contacts
            try {
                update updateCons;
            } catch (Exception e) {
                //This is controversial. Anything could happen when updating the contact..validation rule, security, etc. The key is we don't
                //want the event update to fail...so we put a try catch around the con update to make sure we don't stop that from happening.
            }
        }
    }

   }
Im able to get all the child account's contacts to display on the parent account but i essentially need all contacts related to the parent account to be avaibale to the parent and child accounts.
I have a schedule apex that deactivates users after 90 days since last login, the apex failed on run because of an Unexpected token error on the following: First error: unexpected token: 'dt'

Please review the snippit below:

        dateTime dt = date.today()-90;
       public String query = 'SELECT Name, LastLoginDate, Id From User WHERE IsActive = true AND LastLoginDate < +dt  and profile<>"System Adminstrator" ';
The apex class works in the Full sandbox but when deployed to production it doesnt work. Class is active field names/apis match and correct permissions are set. I need help with this. I tried using the DLRS tool from app exchange but its causing an error that no one can find out why so i tried it in Apex. Please help.. Im needing to count the number of Activites (open/closed) on contacts, the DLRS is workiung for the Tasks but not Events. Please help...see code below


public with sharing class ContactActivityCount {

    public static Boolean didRun = false;
    public static String conPrefix =  Contact.sObjectType.getDescribe().getKeyPrefix();

    /*
    * Takes a set of contact IDs, queries those contacts, and updates the activity count if appropriate
    */
    public static void updateContactCounts(Set<ID> conIds) {

        if (didRun == false) { //We only want this operation to run once per transaction.
            didRun = true;

            //Query all the contacts, including the tasks child relationships
            List<Contact> con = [SELECT ID, Event2cnt__c, (SELECT ID FROM Tasks), (SELECT ID FROM Events) FROM Contact WHERE ID IN :conIds];
            List<Contact> updateCons = new List<Contact>();

            for (Contact o : con) {
                Integer count = o.tasks.size() + o.events.size();

                if (o.Event2cnt__c != count) {
                    o.Event2cnt__c = count;
                    updateCons.add(o); //we're only doing updates to cons that have changed...no need to modify the others
                }
            }

            //Update the appropriate contacts
            try {
                update updateCons;
            } catch (Exception e) {
                //This is controversial. Anything could happen when updating the contact..validation rule, security, etc. The key is we don't
                //want the event update to fail...so we put a try catch around the con update to make sure we don't stop that from happening.
            }
        }
    }

   }