• jojoforce
  • NEWBIE
  • 182 Points
  • Member since 2010

  • Chatter
    Feed
  • 7
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 66
    Questions
  • 47
    Replies
We have a custom object MyEvent__c with the following datetime fields StartDateTime__c and EndDateTime__c.

I am trying to get all of the current events and upcoming events.
 
For example, today is 9/14/2020   12:23 PM
 
Start Date/TimeEnd Date/TimeResults
9/14/20 1:00 PM9/14/20 2:00 PMInclude
9/14/20 9:00 AM9/14/20 1:00 PMInclude
9/14/20 8:00 AM9/14/20 8:30 AMDo Not Display
9/14/20 1:00 PM9/16/20 7:00 PMInclude
9/14/20 9:00 AM9/16/20 7:00 PMInclude
9/16/20 9:00 AM9/16/20 7:00 PMDo Not Display


Here is my query so far, but its not returning the correct results.
SELECT Id, Name FROM MyEvent__c WHERE StartDate__c = TODAY OR (StartDate__c >=TODAY AND EndDate__c <= TODAY)



 
How do yo navigate to the Calendar tab or to the Event list in Salesforce Mobile? Do we use the force:navigateToComponent? or lightning:navigation?  Any example is greatly appreciated.
I have the following code snippet, and for some reason, when the method returns no data, the lightning component aura framework is throwing an error. In desktop, there's no console error message. But in salesforce mobile, the attched error callback getTasks "undefined is not an object evaluating".The other thing to note, in desktop/web, it is not getting to console.log('loadData : c.getTasks AFTER');



Apex Controller
@AuraEnabled
    public static list<Task> getTasks(String selectedFilter){


        Id currentUserId = userinfo.getUserId();
        set<Id> teamMemberIDs = new set<Id>();

        list<Task> tasks = new list<Task> ();

        teamMemberIDs.add(currentUserId);
        for(User u : [SELECT Id,ManagerId FROM User WHERE ManagerId = :currentUserId]){
            teamMemberIDs.add(u.Id);
        }

        String strQuery = ' SELECT Id, Who.Name, What.Name, AccountId,Account.Name,Subject,Status,Priority,OwnerId,Owner.Name ';
        strQuery += ' FROM Task ';
        strQuery += ' WHERE IsClosed = FALSE ';

        if(selectedFilter == 'TodayTasks'){
            strQuery += ' AND ActivityDate = TODAY ';
            strQuery += ' AND OwnerId = \'' + currentUserId + '\'';

        } else if (selectedFilter == 'AllOverdueTasks') {
            strQuery += ' AND ActivityDate < TODAY ';
            strQuery += ' AND OwnerId = \'' + currentUserId + '\'';
        } else if (selectedFilter == 'TomorrowsTask') {
            strQuery += ' AND ActivityDate = TOMORROW ';
            strQuery += ' AND OwnerId = \'' + currentUserId + '\'';

        } else if (selectedFilter == 'MyTeamsTasks') {            
            strQuery += ' AND ActivityDate = TODAY ';
            strQuery += ' AND  OwnerId IN :teamMemberIDs ';            
        }

        strQuery += ' ORDER BY Subject ASC, What.Name ASC ';
        //strQuery += ' LIMIT 6 ';

        System.debug('JOSEPH DEBUG: getTasks selectedFilter ' + selectedFilter);
        System.debug('JOSEPH DEBUG: getTasks strQuery : ' + strQuery);

        tasks = Database.query(strQuery); 
        return tasks;
    }
Aura Bundle Javascript Controller
({
    callServer : function(component,method,callback,params) {
        var action = component.get(method);
        if (params) {
            action.setParams(params);
        }      
        action.setCallback(this,function(response) {
            var state = response.getState();
            if (state === "SUCCESS") { 
                // pass returned value to callback function
                callback.call(this,response.getReturnValue());   
            } else if (state === "ERROR") {
                // generic error handler
                var errors = response.getError();
                if (errors) {
                    console.log("Errors", errors);
                    if (errors[0] && errors[0].message) {
                        throw new Error("Error" + errors[0].message);
                    }
                } else {
                    throw new Error("Unknown Error");
                }
            }
        });
        $A.enqueueAction(action);
    },
    loadData : function(component) {
        console.log('loadData : ' +  component.get("v.selectedFilter"));
    
        //Get Task Records
        this.callServer(component,"c.getTasks",function(response){
            console.log('loadData : c.getTasks BEFORE');
            component.set("v.tasksCount", response.length);   
            console.log('loadData : v.tasksCount response.length ' + response.length);
            if(response.length > 0){
                component.set("v.isThereTasks",true);
                component.set("v.tasks", response);  
    
            } else {
                component.set("v.isThereTasks",false);
            }
            console.log('loadData : c.getTasks AFTER');

        },{
            selectedFilter: component.get("v.selectedFilter")               
        }); 
    }
    
});
Aura Bundle Component
<aura:attribute name="tasks" type="Task[]"/>

 
Essentially, the task subject or the Account Name should be truncated when its too long but here is what is happening in my component. Any advice on how to use the sdls-truncate css?
 
<table class="slds-table slds-no-row-hover">
                    <tbody>
                        <aura:iteration items="{! v.tasks }" var="task">
                            <tr class="slds-hint-parent">
                                <td class="slds-text-align_left" style="width:30px;">
                                    <lightning:input type="checkbox" label="Checkbox Label" variant="label-hidden"></lightning:input>
                                </td>
                                <td class="slds-text-align_left">
                                    <div class="slds-grid slds-truncate_container_33"  >
                                        <span class="slds-truncate" title="{!task.Subject}">
                                            <a target="_blank" class="slds-text-link" href="" onclick="{! c.handleTaskLink }" data-taskid="{!task.Id}">
                                                {!task.Subject}
                                            </a>            
                                        </span>
                                    </div>
                                </td>
                                <td class="slds-text-align_right">
                                    <div class="slds-grid"  >
                                        <span class="slds-truncate" title="{!task.Account.Name}">
                                            <a target="_blank" class="slds-text-link" href="" onclick="{! c.handleAccountLink }" data-accountid="{!task.AccountId}">
                                                {!task.Account.Name}                                    
                                            </a>    
                                        </span>
                                    </div>
                                </td>
                            </tr>
                        
                        </aura:iteration>
    
                    </tbody>
                </table>

User-added image
We are using a Lightning Out and have a simple Input Box with a Button. The button when clicked, retrieves the value of the input box and inserts it in the MyCustom_Object__c.

When the lightning attribute type is of "MyCustom_Object__c" then the Lightning Out does not work, however, if we use the type "Object" it works. Any ideas?
 
<aura:attribute name="MyRecord" type="MyCustom_Object__c" access="GLOBAL"/>
versus
<aura:attribute name="MyRecord" type="Object" access="GLOBAL"/>



**testComponent.cmp**
<aura:component access="GLOBAL" controller="tempLightningOut" 
        <aura:attribute name="MyRecord" type="MyCustom_Object__c" access="GLOBAL"/>
        <p> Lightning Out Testing </p>
        <lightning:input aura:id="inputNameField" label="Name" name="inputNameField" />
        <lightning:button variant="brand" label="Submit" onclick="{! c.handleClick }" />
    </aura:component>



**testComponent.app**
<aura:application extends="ltng:outApp"  implements="ltng:allowGuestAccess" access="GLOBAL" >
    
            <aura:dependency resource="markup://c:tempComponent" type="COMPONENT"/>
    
        
    </aura:application>



**testComponentController.js**
 
handleClick : function(component, event, helper) {
        
        var cmp = component.find('inputNameField');

        var inputValue= cmp.get("v.value");
        

        helper.callServer(component,"c.insertRecord",function(response){
            var cmp = component.find('inputNameField');
            cmp.set('v.value','');
            
                        
            
        },{
            inputValue: inputValue
        });
        
    }



**testComponentHelper.js**
({
        callServer : function(component,method,callback,params) {
            var action = component.get(method);
            if (params) {
                action.setParams(params);
            }
          
            action.setCallback(this,function(response) {
                var state = response.getState();
                if (state === "SUCCESS") { 
                    // pass returned value to callback function
                    callback.call(this,response.getReturnValue());   
                } else if (state === "ERROR") {
                    // generic error handler
                    var errors = response.getError();
                    if (errors) {
                        console.log("Errors", errors);
                        if (errors[0] && errors[0].message) {
                            throw new Error("Error" + errors[0].message);
                        }
                    } else {
                        throw new Error("Unknown Error");
                    }
                }
            });
    
            $A.enqueueAction(action);
        }
    })


**tempLightningOut Apex Controller**
 
public class tempLightningOut {
             @AuraEnabled    
            public static void insertRecord(String inputValue) {
        
                MyCustom_Object__c rec = new MyCustom_Object__c();
                rec.name = inputValue;
                insert rec ;
            }        
        
     }


HTML
 
<!DOCTYPE html>
<html>
<head>

<script src="https://mydomain.cs62.force.com/lightning/lightning.out.js" type="text/javascript"> </script>

<script type="text/javascript">


    $Lightning.use("c:tempApp",    // name of the Lightning app
        function() {                  // Callback once framework and app loaded
            $Lightning.createComponent(
                "c:tempComponent", // top-level component of your app
                { },                  // attributes to set on the component when created
                "lightningLocator",   // the DOM location to insert the component
                function(cmp) {
                    // callback when component is created and active on the page
                }
            );


        },
        'https://mycommunityendpoint.cs62.force.com/communityendpointtest'  // Community endpoint
    );

</script>
</head>

<body >



		<div id="lightningLocator" style="height:100%;width:100%;"></div>
</body>
</html>


 
Hi everyone!!

I am trying to used lightning dart on a visualforce as you can see in this link https://lightningdart.com/#/desktop, But i dont know how is this working.
On the link, there is a zip package for download, when i get this fiel there is some .dart fiels but i dont know how to use it.
Has anybody work with it?,Is this an static resource?, if this is an static resource, should I call it like .js scripts? and use sources like it says?.

Thanks
I'm getting an error message saying "No repository found at http://media.developerforce.com/force-ide/eclipse42.".

I'm getting this message when updating OR installing the latest Eclipse Force.com IDE. This makes me believe this is an issue with salesforce or developerforce.com as the community.developerforce.com is also not working.

When doing an update on a machine that had force.com ide eclipse working
User-added image
when doing a fresh install
User-added image
Hello, I'm trying to install the Force.com IDE plugin for Eclipse Juno 4.2 on a Windows 8 machine and for some reason I am getting a "could not find repository" error message. For some reason, I think the repository no longer exist because in my old machine where I had Force.com IDE eclipse all my life no longer works either. Any advise or suggestion is greatly appreciated. Thanks

https://developer.salesforce.com/page/Force.com_IDE_Installation

Step #3  "In the Add Repository dialog, set the Name to "Force.com IDE" and the Location to "http://media.developerforce.com/force-ide/eclipse42" and click OK. (Use the same URL for Eclipse 4.3.)"


error


 
Hi..

I created a simple @Future class in one of our DEV sandboxes, and for some reason it's not executing. It is just staying in queued status.

public with sharing class FutureTesting {

    @future
    public static void calculateInventory() {
   
        System.debug('DO SOMETHING');
    }

}


When I execute this, there is no error message but it just stays in queued status. Anybody have experienced this?

If I create 2 visualforce page VF1 and VF2 using the same Controller "MyController" would the "Total number of executed code statements" limit be contained in its own VF page? meaning, if VF1 calls VF2, then does the Script Execution Statements of VF1 count towards the "Total number of executed code statements" of VF2 as well? or are they counted seperately? 

 

 

Hi - is it possible to export a field that is of type "Long Text Area" into a CSV using the Apex Data Loader? I tried that and it seems like Apex Data Loader is not exporting the field. I know we can't filter on a Long Text Area using the WHERE clause, but is there anywhere in the documentation that says it is possible? Thanks for the help.

 

Hi.....

 

I have a Parent object that have two child objects. Its a lookup type of relationship. A parent record may or may not have a record in Child A nor Child B.

 

So basically, in regular SQL I am trying to achieve something like:

 

SELECT count(id)
FROM Parent
WHERE id in (SELECT parentID from ChildA) 
OR    id in (SELECT parentID from ChildB)

 

However, this does not seem possible in SOQL statements. Is there any work around to this dilemna? I'm trying to get the Parent records if they have child records that exists in either Child A or Child B object. A parent record may have records in Child A, but not have records in Child B (and vice-versa). At the same time, a parent record may have both records in Child A and Child B.

 

Thanks for any ideas or inputs in this matter. It seems pretty easy and I'm sure a lot of people had experienced this issue. 

 

 

 

Re-rendering an apex:actionPoller resets the timer clock to zero. Is that just client side? or is that transaction get sent up to the server?

Here's my query:

        SELECT 
              Id
            , Name
            , UserRole.Name
            , Profile.Name
            ,(  SELECT
                     Id
                    ,CRM_Territory_Type__c
                FROM Territories__r 
                WHERE CRM_Inactive__c=false 
            )
        FROM User
WHERE Territories__r.null
        ORDER BY Name

Is there any way to get this query to ONLY return results where the subquery has results?

 

Thanks!

Hello...

 

The StandardSetController that allows VisualForce pages and Apex to paginate through the records has a "Save" method. According to SalesForce documentation:

 

 

Inserts new records or updates existing records that have been changed. After this operation is finished, it returns aPageReference to the original page, if known, or the home page.

 http://www.salesforce.com/us/developer/docs/pages/Content/apex_pages_standardsetcontroller.htm

 

 

The issue that I am facing right now is everytime I make an update to any of the records and use the save method provided by that query, it always returns me to page 1.

 

For example, if I go to page 3, make an update, and perform a "Save" it always returns to the first page. I thought that it should return to the original page (which is the current page you are on). Am I misunderstanding the documentation? 

Is it possible for 1 action call two seperate action status? 

 

for example,

 

<apex:commandButton id="btnID" status="status1,status2" action="{!someAction}" value="Click Me"/>
 
<apex:actionStatus id="status1">
.....
</apex:actionStatus>

 
<apex:actionStatus id="status2">
.......
</apex:actionStatus>

 
 

 

Hi - 

 

I found this really cool gantt chart, but for some reason I'm having problem embedding it into my Visual Force page. The link of the gantt chart is the following:

 

http://dhtmlx.com/docs/products/dhtmlxGantt/index.shtml

 

I was wondering if anyone can help me figure out what's wrong with the below code? I'm not really getting any error message but the inspect element has "Uncaught TypeError: Cannot call method 'addEventListener' of null". 

 

 

<apex:page >

    <apex:stylesheet value="{!URLFOR($Resource.Timeline, 'codebase/dhtmlxgantt.css')}"/>
    <script type="text/javascript" language="JavaScript" src="{!URLFOR($Resource.Timeline, 'codebase/dhtmlxcommon.js')}"></script>
    <script type="text/javascript" language="JavaScript" src="{!URLFOR($Resource.Timeline, 'codebase/dhtmlxgantt.js')}"></script>


    <head>


    <script language="JavaScript" type="text/javascript">
        function createChartControl(htmlDiv1)
        {
            //project 1
            var project1 = new GanttProjectInfo(1, "Applet 11redesign", new Date(2010, 5, 11));
    
            var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, "");
            parentTask1.addChildTask(new GanttTaskInfo(2, "Convert to J#", new Date(2010, 5, 11), 100, 40, ""));
            parentTask1.addChildTask(new GanttTaskInfo(13, "Add new functions", new Date(2010, 5, 12), 80, 90, ""));
    
            var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
            var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
            var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
            parentTask5.addChildTask(parentTask123);
            parentTask2.addChildTask(parentTask5);
            parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
    
            var parentTask4 = new GanttTaskInfo(7, "Unit testing", new Date(2010, 6, 15), 118, 80, "6");
            var parentTask8 = new GanttTaskInfo(8, "core (com)", new Date(2010, 6, 15), 100, 10, "");
            parentTask8.addChildTask(new GanttTaskInfo(55555, "validate uids", new Date(2010, 6, 20), 60, 10, ""));
            parentTask4.addChildTask(parentTask8);
            parentTask4.addChildTask(new GanttTaskInfo(9, "Stress test", new Date(2010, 6, 15), 80, 50, ""));
            parentTask4.addChildTask(new GanttTaskInfo(10, "User interfaces", new Date(2010, 6, 16), 80, 10, ""));
            parentTask2.addChildTask(parentTask4);
    
            parentTask2.addChildTask(new GanttTaskInfo(11, "Testing, QA", new Date(2010, 6, 21), 60, 100, "6"));
            parentTask2.addChildTask(new GanttTaskInfo(12, "Task B (Jim)", new Date(2010, 6, 8), 110, 1, "14"));
            parentTask2.addChildTask(new GanttTaskInfo(14, "Task A", new Date(2010, 6, 7), 8, 10, ""));
            parentTask2.addChildTask(new GanttTaskInfo(15, "Task C", new Date(2010, 6, 9), 110, 90, "14"));
    
            project1.addTask(parentTask1);
            project1.addTask(parentTask2);
    
            //project 2
            var project2 = new GanttProjectInfo(2, "Web Design", new Date(2010, 5, 17));
    
            var parentTask22 = new GanttTaskInfo(62, "Fill HTML pages", new Date(2010, 5, 17), 157, 50, "");
            parentTask22.addChildTask(new GanttTaskInfo(63, "Cut images", new Date(2010, 5, 22), 78, 40, ""));
            parentTask22.addChildTask(new GanttTaskInfo(64, "Manage CSS", null, 90, 90, ""));
            project2.addTask(parentTask22);
    
            var parentTask70 = new GanttTaskInfo(70, "PHP coding", new Date(2010, 5, 18), 120, 10, "");
            parentTask70.addChildTask(new GanttTaskInfo(71, "Purchase D control", new Date(2010, 5, 18), 50, 0, ""));
            project2.addTask(parentTask70);
    
            var ganttChartControl = new GanttChart();
            ganttChartControl.setImagePath("{!URLFOR($Resource.Timeline, 'codebase/imgs/')}");
            
            ganttChartControl.setEditable(true);
            
            ganttChartControl.addProject(project1);
            
            ganttChartControl.create(htmlDiv1);
        }
    </script>
    
    <style>
        body {font-size:12px}
        .{font-family:arial;font-size:12px}
        h1 {cursor:hand;font-size:16px;margin-left:10px;line-height:10px}
        xmp {color:green;font-size:12px;margin:0px;font-family:courier;background-color:#e6e6fa;padding:2px}
        .hdr{
            background-color:lightgrey;
            margin-bottom:10px;
            padding-left:10px;
        }
    </style>

    </head>

    <body onload="createChartControl('GanttDiv');">
        <div style="width:950px;height:620px;position:absolute;" id="GanttDiv"></div>
    </body>



</apex:page>