-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
2Replies
Mapping event relations to events
Looking for guidance on setting up maps to map event relations to their events in salesforce. Right now I have all events, I loop through them all to create custom events with modified data I need from them. I then check if they are group events, If they are, I query for event relation relationIds, then query for names for those relationIds, this quickly goes past the 100 soql query limit...
I am not fully seeing how you can avoid the event relation per group event query.... Any help would be appreciated.
This is in apex controller.
I am not fully seeing how you can avoid the event relation per group event query.... Any help would be appreciated.
This is in apex controller.
- Tyler Dahle
- February 16, 2017
- Like
- 0
Using external javascript library objects in lightning component (Kendo UI)
I am trying to use kendo UI in a lightning component to get a scheduler to be a custom lightning component. My component is:
and controller is:
which is just the kendo UI scheduler demo example on their website, just trying to see if I can get it to show up at all. However, I cannot doing it like this. My application is simply:
but when I preview, I just get a forever loading sign with no errors popping up on the screen or chrome dev tools console. The console.log in the controller is not being hit and printed on the console at all...
Does anyone have experience using kendo or any kind of outside objects in lightning components and can help me by showing me how to call them? I assume I cannot set 'type' of te attribute to 'kendoScheduler'... but then I don't know how to call the scheduler function to initialize it. I tried doing aura:method after the scheduler div in the component, but that didn't work either.
Thank you for any help!
<aura:component > <ltng:require styles="{!join(',', $Resource.kendoUI + '/kendo-ui/styles/kendo.silver.min.css', $Resource.kendoUI + '/kendo-ui/styles/kendo.default.mobile.min', $Resource.kendoUI + '/kendo-ui/styles/kendo.default.min')}" scripts="{!join(',', $Resource.kendoUI + '/kendo-ui/js/jquery.min.js', $Resource.kendoUI + '/kendo-ui/js/kendo.all.min.js', $Resource.kendoUI + '/kendo-ui/js/kendo.timezones.min.js')}"/> <aura:attribute name="scheduler" type="Object"/> <aura:handler name="init" value="{!this}" action="{!c.schedulerInit}"/> <div aura:id="{!v.scheduler}"></div> </aura:component>
and controller is:
({ schedulerInit : function(component, event, helper) { var scheduler = component.find("scheduler"); console.log(scheduler); scheduler.kendoScheduler({ date: new Date("2013/6/13"), startTime: new Date("2013/6/13 07:00 AM"), height: 600, views: [ "day", { type: "workWeek", selected: true }, "week", "month", "agenda", { type: "timeline", eventHeight: 50} ], timezone: "Etc/UTC", dataSource: { batch: true, transport: { read: { url: "https://demos.telerik.com/kendo-ui/service/tasks", dataType: "jsonp" }, update: { url: "https://demos.telerik.com/kendo-ui/service/tasks/update", dataType: "jsonp" }, create: { url: "https://demos.telerik.com/kendo-ui/service/tasks/create", dataType: "jsonp" }, destroy: { url: "https://demos.telerik.com/kendo-ui/service/tasks/destroy", dataType: "jsonp" }, parameterMap: function(options, operation) { if (operation !== "read" && options.models) { return {models: kendo.stringify(options.models)}; } } }, schema: { model: { id: "taskId", fields: { taskId: { from: "TaskID", type: "number" }, title: { from: "Title", defaultValue: "No title", validation: { required: true } }, start: { type: "date", from: "Start" }, end: { type: "date", from: "End" }, startTimezone: { from: "StartTimezone" }, endTimezone: { from: "EndTimezone" }, description: { from: "Description" }, recurrenceId: { from: "RecurrenceID" }, recurrenceRule: { from: "RecurrenceRule" }, recurrenceException: { from: "RecurrenceException" }, ownerId: { from: "OwnerID", defaultValue: 1 }, isAllDay: { type: "boolean", from: "IsAllDay" } } } }, filter: { logic: "or", filters: [ { field: "ownerId", operator: "eq", value: 1 }, { field: "ownerId", operator: "eq", value: 2 } ] } }, resources: [ { field: "ownerId", title: "Owner", dataSource: [ { text: "Alex", value: 1, color: "#f8a398" }, { text: "Bob", value: 2, color: "#51a0ed" }, { text: "Charlie", value: 3, color: "#56ca85" } ] } ] }); } })
which is just the kendo UI scheduler demo example on their website, just trying to see if I can get it to show up at all. However, I cannot doing it like this. My application is simply:
<aura:application access="GLOBAL" extends="ltng:outApp"> <c:kendo_test /> </aura:application>
but when I preview, I just get a forever loading sign with no errors popping up on the screen or chrome dev tools console. The console.log in the controller is not being hit and printed on the console at all...
Does anyone have experience using kendo or any kind of outside objects in lightning components and can help me by showing me how to call them? I assume I cannot set 'type' of te attribute to 'kendoScheduler'... but then I don't know how to call the scheduler function to initialize it. I tried doing aura:method after the scheduler div in the component, but that didn't work either.
Thank you for any help!
- Tyler Dahle
- February 13, 2017
- Like
- 0
Embed html template into lightning component?
I have my component like this:
However, I have a visualForce page that is displaying this component. In my visualforce page, I have html templates. I am wondering if it is possible to simply take those templates and throw them into the tab content instead of the <lightning:select> dropdown and <lightning:input> checkbox.
I am having trouble finding information taking components in a visualforce page (like my html templates) and using them in the lightning component. The visualforce page is populating the components in the templates with all their data with its controller, so it would be super convenient if I could just throw the templates into my lightning component.
Thank you for any help!
<aura:component > <aura:attribute name="opts" type="List" default="['Tyler Dahle','Molly Demouser','Penny Demouser', 'Ted Demouser']"/> <div class="slds-tabs--scoped"> <ul aura:id="tabBar" class="slds-tabs--scoped__nav" role="tablist"> <li aura:id="ownerTab_item" class="slds-tabs--scoped__item" title="ownerTab" role="presentation" onclick="{!c.ownerTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="ownerTabContent" id="ownerTab"><lightning:icon iconName="utility:groups"/></a></li> <li aura:id="locationTab_item" class="slds-tabs--scoped__item" title="locationTab" role="presentation" onclick="{!c.locationTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="locationTabContent" id="locationTab"><lightning:icon iconName="utility:location"/></a></li> <li aura:id="descriptionTab_item" class="slds-tabs--scoped__item" title="descriptionTab" role="presentation" onclick="{!c.descriptionTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="descriptionTabContent" id="descriptionTab"><lightning:icon iconName="utility:description"/></a></li> <li aura:id="typeTab_item" class="slds-tabs--scoped__item" title="typeTab" role="presentation" onclick="{!c.typeTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="typeTabContent" id="typeTab"><lightning:icon iconName="utility:picklist"/></a></li> <li aura:id="customTab_item" class="slds-tabs--scoped__item" title="customTab" role="presentation" onclick="{!c.customTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="customTabContent" id="customTab"><lightning:icon iconName="utility:apps"/></a></li> <li aura:id="settingsTab_item" class="slds-tabs--scoped__item" title="settingsTab" role="presentation" onclick="{!c.settingsTabSelect}"><a class="slds-tabs--scoped__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="true" aria-controls="settingsTabContent" id="settingsTab"><lightning:icon iconName="utility:settings"/></a></li> </ul> <div aura:id="ownerTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="ownerTab"> <lightning:select name="users" label="Select Users/Groups/Resources:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> <div aura:id="locationTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="locationTab"> <lightning:select name="users" label="Select Locations:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> <div aura:id="descriptionTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="descriptionTab"> <lightning:select name="users" label="Enter Description:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> <div aura:id="typeTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="typeTab"> <lightning:select name="users" label="Select Event Type:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> <div aura:id="customTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="settingsTab"> <lightning:select name="users" label="Custom Filters:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> <div aura:id="settingsTabContent" class="slds-tabs--scoped__content slds-hide" role="tabpanel" aria-labelledby="settingsTab"> <lightning:select name="users" label="User Settings:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> </div> </div> </aura:component>
However, I have a visualForce page that is displaying this component. In my visualforce page, I have html templates. I am wondering if it is possible to simply take those templates and throw them into the tab content instead of the <lightning:select> dropdown and <lightning:input> checkbox.
I am having trouble finding information taking components in a visualforce page (like my html templates) and using them in the lightning component. The visualforce page is populating the components in the templates with all their data with its controller, so it would be super convenient if I could just throw the templates into my lightning component.
Thank you for any help!
- Tyler Dahle
- February 10, 2017
- Like
- 0
Expanding and collapsing lightning:tab content?
<aura:component > <aura:attribute name="opts" type="List" default="['Tyler Dahle','Molly Demouser','Penny Demouser', 'Ted Demouser']"/> <lightning:tabset aura:id="tabBar" variant="scoped" selectedTabId="none"> <lightning:tab aura:id="ownerTab"> <aura:set attribute="label"> <lightning:icon iconName="utility:groups"/> </aura:set> <div aura:id="userTabWrapper"> <lightning:select name="users" label="Select Users/Groups/Resources:"> <aura:iteration items="{!v.opts}" var="option"> <option>{!option}</option> </aura:iteration> </lightning:select> <lightning:input type="checkbox" label="Enable" name="Enable User Filter" checked="true"/> <lightning:button class="closeUser" variant="base" iconName="utility:close" onclick="{!c.closeTabContent}"/> </div> </lightning:tab> </lightning:tabset> </aura:component>Above is my general tabset structure (I have multiple tabs that look exactly the same with same information). I am just trying to get the content to be expandable and collapsible right now. It comes out of the box where content expands when you click the tab, but after you click you can't hide the content... I am having trouble grabbing the entire content box and hiding it. My controller for the close button is:
({ closeTabContent : function(component, event, helper) { var tab_bar = component.find('tabBar'); var tab = component.find("userTabWrapper"); $A.util.removeClass(tab, "slds-is-expanded"); $A.util.addClass(tab, "slds-is-collapsed"); } })
All this ends up doing is hiding the elements inside the content, which sounds good, but it still leaves the content box up, albeit smaller.... How do I go about collapsing the ENTIRE content box of the lightning:tab?
Thank you for any help!
- Tyler Dahle
- February 10, 2017
- Like
- 0
visualforce/apex issue with checkbox
Hi All,
I am having an issue with a checkbox that I added to a VF page and the corresponding Apex controller. No matter if I check the checkbox or not, the controller is getting null passed back to it as the value instead of true/false.
Here is the VF page: (The lines that I added are marked with "// SN 403714")
and here is the controller:
Thanks,
Steve A.
I am having an issue with a checkbox that I added to a VF page and the corresponding Apex controller. No matter if I check the checkbox or not, the controller is getting null passed back to it as the value instead of true/false.
Here is the VF page: (The lines that I added are marked with "// SN 403714")
<apex:component controller="VSD_Inc_New_CompetitionReportController"> <!-- SN 403714 Steve Arnold 12/9/2016 --> <!-- Don't use default headings for existing incentives --> <!-- --> <!-- SN 403714 Steve Arnold 1/13/2017 --> <!-- Add delete checkbox to detail lines --> <style> .cellHeader { color: #59a13f; font-family: "HelveticaNeueLTStdRoman"; } .resultTable td { vertical-align:middle; padding: .5em 1em .5em 1em; } .styledInput{ min-width: 175px; } </style> <div id="incentive_container"> <table class="filterTable filterTableHeader"> <tr> <th>Received By <span class="required-indicator">*</span></th> <th>Provided By <span class="required-indicator">*</span></th> <th>Received Date <span class="required-indicator">*</span></th> </tr> <tr id="filter_row"> <td><input id="f_receivedBy" type="text" class="styledInput" /> </td> <td><input id="f_progvidedBy" type="text" class="styledInput" /> </td> <td> <div class="data-subcell"> <input id="rec_date" type="date" class="styledInput futureDateInput" html-data-field="date" /> </div> </td> </tr> </table> </div> <div id="incentive_table_container"> <table class="resultTable"> <thead> <tr> <!-- <th>Product</th> --> <th>Competitive Brand</th> <th>Competitive Product</th> <th>Invoice Price</th> <th>Discount %</th> <th>Delete</th> // SN 403714 1/13/2017 </tr> </thead> <tbody id="competitiveReportTable"> </tbody> </table> </div> <div class="footer" align="right"> <div id="VSD:setRequestInfo:VSD_SetRequestHeaderInfo:requestDetailForm:j_id616" onclick="VSD_Inc_New_CompetitiveReport.setIncentives();" class="button greenButton" style="margin-top: 10px;"> <span class="buttonText">Next : Set Incentives</span> <span class="icon-white-arrow-right"></span> </div> </div> <script> var VSD_Inc_New_CompetitiveReport = new Object(); if((VSD_Inc_NewCustomer_Store.currentIncentive == null || VSD_Inc_NewCustomer_Store.currentIncentive =='') && VSD_Inc_Store.isNew_Save){ // SN 403714 12/9/2016 VSD_Inc_Store.setHeaderTitle(VSD_Inc_Store.CONSTANTS.PAGENAME.NEWINCENTIVE_VIEW.header); VSD_Inc_Store.setSubHeaderTitle(VSD_Inc_Store.CONSTANTS.PAGENAME.NEWINCENTIVE_VIEW.subHeader_competitive_report); } VSD_Inc_Store.clearHeaderButtons(); if(VSD_Inc_Store.isNew_Save) VSD_Inc_Store.setHeaderButtonHTML_Blue_Right('Cancel', '_CancelCompetitive_Btn'); j$(function() { VSD_Inc_New_CompetitiveReport.fetchCompetitiveInfoData(); VSD_Inc_Store.setDatePicker(); VSD_Inc_Store.current_PageName = _currentPageName; }); VSD_Inc_New_CompetitiveReport.fetchCompetitiveInfoData = function() { VSD_Inc_Store.showLoader(); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.VSD_Inc_New_CompetitionReportController.fetchCompetitiveInfo}', VSD_Inc_Store.currentIncentive, function(result, event) { if (event.status) { VSD_Inc_New_CompetitiveReport.createCompetitiveInfoTable(JSON.parse(result)); } else { VSD_Inc_Store.showRemoteActionError(event); } VSD_Inc_Store.hideLoader(); }, { escape: false } ); } VSD_Inc_New_CompetitiveReport.createCompetitiveInfoTable = function(_competitiveData) { j$('#f_receivedBy').val(_competitiveData.receivedBy); j$('#f_progvidedBy').val(_competitiveData.providedBy); j$('#rec_date').val(VSD_Inc_Store.setPickerDate(_competitiveData.receivedDate)); var tableBody = j$("#incentive_table_container table tbody"); tableBody.empty(); var tableRow; var competitiveBrandlist = ''; competitiveBrandlist += '<option>Select a Brand</option>'; j$.each(_competitiveData.competitiveBrandPicklist, function(index, value) { competitiveBrandlist += '<option value="'+value.Id+'">'+value.Name+'</option>'; }); var listSize = 0; j$.each(_competitiveData.competitiveInfo, function(index, value) { ++listSize; tableRow = j$("<tr class=\"competitionReportInfo\"></tr>"); var temp = ''; tableRow.append("<input id=\"f_id\" value='" + value.id + "' type=\"hidden\" class=\"styledInput hiddenId\" />"); temp = value.competitiveProduct !=null ? value.competitiveProduct : '' tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><select id='comp_" + index + "' value='" + value.competitiveBrand + "' class=\"competBrand\">" + competitiveBrandlist + "</select><span id='Span_Comp_" + index + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span> </div></td>"); tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><input id=\"f_compProduct\" value='" + temp + "' type=\"text\" class=\"styledInput product\" /><span id='Span_Prod_" + index + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span> </div></td> "); temp = value.invoicePrice !=null ? value.invoicePrice : '' tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><span class=\"cellHeader\">$</span><input id=\"f_invoice\" value='" + temp + "' type=\"text\" class=\"styledInput invoice\" /> <span id='Span_Inv_" + index + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span> </div></td> "); temp = value.discountPercent !=null ? value.discountPercent : '' tableRow.append("<td class=\"competitiveRepoData\" ><div style=\"white-space: nowrap;\"><input id=\"f_discount\" value='" + temp + "' type=\"text\" class=\"styledInput discount\" /> <span id='Span_Disc_" + index + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span> </div></td> "); temp = value.deleteLine !=null ? value.deleteLine : "false" // SN 403714 tableRow.append("<td class=\"competitiveRepoData\" ><div style=\"white-space: nowrap;\"vertical-align: middle;\"><input id=\"f_delete\" value=" + temp + " type=\"checkbox\" /></div></td> "); // SN 403714 tableBody.append(tableRow); j$("#comp_"+index).val(value.competitiveBrand); if(index != 0){ j$("#Span_Comp_"+index).removeClass('required-indicator'); j$("#Span_Comp_"+index).html(''); j$("#Span_Inv_"+index).removeClass('required-indicator'); j$("#Span_Inv_"+index).html(''); j$("#Span_Prod_"+index).removeClass('required-indicator'); j$("#Span_Prod_"+index).html(''); j$("#Span_Disc_"+index).removeClass('required-indicator'); j$("#Span_Disc_"+index).html(''); } }); var initVar; for ( initVar = listSize; initVar < 6; initVar++) { tableRow = j$("<tr class=\"competitionReportInfo\"></tr>"); tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><select id=\"f_compBrand\" class=\"competBrand\">" + competitiveBrandlist + "</select><span id='Span_Comp_N" + initVar + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span></div></td>"); tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><input id=\"f_compProduct\" type=\"text\" class=\"styledInput product\" /><span id='Span_Prod_N" + initVar + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span></div></td>"); tableRow.append("<td class=\"competitiveRepoData\"><div style=\"white-space: nowrap;\"><span class=\"cellHeader\">$</span><input id=\"f_invoice\" type=\"text\" class=\"styledInput invoice\" /><span id='Span_Inv_N" + initVar + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span></div></td>"); tableRow.append("<td class=\"competitiveRepoData\" ><div style=\"white-space: nowrap;\"><input id=\"f_discount\" type=\"text\" class=\"styledInput discount\" /><span id='Span_Disc_N" + initVar + "' class=\"required-indicator\" style=\"vertical-align: middle;\">*</span></div></td>"); tableBody.append(tableRow); if(initVar != 0){ j$("#Span_Comp_N"+initVar).removeClass('required-indicator'); j$("#Span_Comp_N"+initVar).html(''); j$("#Span_Inv_N"+initVar).removeClass('required-indicator'); j$("#Span_Inv_N"+initVar).html(''); j$("#Span_Prod_N"+initVar).removeClass('required-indicator'); j$("#Span_Prod_N"+initVar).html(''); j$("#Span_Disc_N"+initVar).removeClass('required-indicator'); j$("#Span_Disc_N"+initVar).html(''); } } } VSD_Inc_New_CompetitiveReport.getIncentiveProdList = function(){ //TODO : retrieve updated incentive products } VSD_Inc_New_CompetitiveReport.isPageValid = 'true'; VSD_Inc_New_CompetitiveReport.validatePage = function( CompetitionReportDataList ) { var recordCounter = 0 ; j$.each(CompetitionReportDataList, function(index, value) { //VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; if(recordCounter < 1){ ++recordCounter; if(value.competitiveBrand == 'Select a Brand'){ alert('Please fill all required fields'); VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; return false; }else{ VSD_Inc_New_CompetitiveReport.isPageValid = 'true'; } if(value.competitiveProduct == ''){ alert('Please fill all required fields'); VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; return false; }else{ VSD_Inc_New_CompetitiveReport.isPageValid = 'true'; } if(value.invoicePrice == '' && value.discountPercent == ''){ alert('Please fill all required fields'); VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; return false; } else{ VSD_Inc_New_CompetitiveReport.isPageValid = 'true'; } }else{ //return true; } }); } VSD_Inc_New_CompetitiveReport.validateCurrentIncentive = function(_currentIncentive){ if(_currentIncentive.providedBy == '' || _currentIncentive.receivedDate == ''){ alert('Please fill all required fields'); VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; }else{ VSD_Inc_New_CompetitiveReport.isPageValid = 'true' } } VSD_Inc_New_CompetitiveReport.setIncentives = function() { var incentiveProductString = {}; var currentIncentiveInfo = {}; VSD_Inc_New_CompetitiveReport.CompetitionReportDataList = []; VSD_Inc_New_CompetitiveReport.currentIncentive = {}; VSD_Inc_New_CompetitiveReport.currentIncentive.receivedBy = j$("#f_receivedBy").val(); VSD_Inc_New_CompetitiveReport.currentIncentive.providedBy = j$("#f_progvidedBy").val(); VSD_Inc_New_CompetitiveReport.currentIncentive.receivedDate = VSD_Inc_Store.getPickerDate(j$("#rec_date").val()); this.validateCurrentIncentive(VSD_Inc_New_CompetitiveReport.currentIncentive); if(VSD_Inc_New_CompetitiveReport.isPageValid == 'false') return false; var recordCounter = 0; j$( "tr.competitionReportInfo" ).each(function(index,value){ var isValidRow = true; var CompetitionReportData = {}; CompetitionReportData.competitiveBrand = j$(this).find("select.competBrand").val(); CompetitionReportData.competitiveProduct = j$(this).find("input.styledInput.product").val(); CompetitionReportData.invoicePrice = j$(this).find("input.styledInput.invoice").val(); CompetitionReportData.deleteLine = j$(this).find("input.delete").val(); // SN 403714 if (CompetitionReportData.invoicePrice!=null){ CompetitionReportData.invoicePrice = cleanCurrencyValue(CompetitionReportData.invoicePrice); } CompetitionReportData.discountPercent = j$(this).find("input.styledInput.discount").val(); CompetitionReportData.id = j$(this).find("input.styledInput.hiddenId").val(); if(CompetitionReportData.competitiveProduct == ''){ isValidRow = false; } if(CompetitionReportData.invoicePrice == '' && CompetitionReportData.discountPercent == ''){ isValidRow = false; } if(CompetitionReportData.competitiveBrand == 'Select a Brand'){ isValidRow = false; } if(isValidRow){ VSD_Inc_New_CompetitiveReport.CompetitionReportDataList.push(CompetitionReportData); } }); if( this.CompetitionReportDataList.length < 1 ){ VSD_Inc_New_CompetitiveReport.isPageValid = 'false'; alert('Please fill all required fields'); }else{ VSD_Inc_New_CompetitiveReport.validatePage( this.CompetitionReportDataList ); } currentIncentiveInfo = JSON.stringify(VSD_Inc_New_CompetitiveReport.currentIncentive); incentiveProductString = JSON.stringify(VSD_Inc_New_CompetitiveReport.CompetitionReportDataList); if(VSD_Inc_New_CompetitiveReport.isPageValid != 'false'){ Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.VSD_Inc_New_CompetitionReportController.setIncentiveProducts}', incentiveProductString, VSD_Inc_Store.currentIncentive, currentIncentiveInfo, function(result, event) { if (event.status) { loadView(VSD_Inc_Store.CONSTANTS.ROUTER.NEW_INCENTIVE_SET_INCENTIVE); //TODO: Redirect to Set Incentives Screen } else { VSD_Inc_Store.showRemoteActionError(event); } VSD_Inc_Store.hideLoader(); }, { escape: false } ); } } j$(function() { j$('#startCancelRequestDialog').dialog({ autoOpen: false, width: "auto", height: "auto", modal: true }); }); j$("#_CancelCompetitive_Btn").click(function() { VSD_Inc_Store.cancelAction(); }); </script> </apex:component>
and here is the controller:
/* * Controller for VF Component : VSD_Inc_New_CompetitionReportView * - store remote actions to provide data for the interface. * * @author Deepak */ // // SN 403714 Steve Arnold 12/19/2016 // - Allow deletion of competitive data // - Fix pre-fill of Received By Field // public with sharing class VSD_Inc_New_CompetitionReportController { //Get a JSON of list of incentive data wrapper // //@return // String : JSON of structure Incentive Product @RemoteAction public static String fetchCompetitiveInfo(String incentiveId) { CompetitionReportInfo competitiveinfo = new CompetitionReportInfo(); // get incentive products to display in Competitive info section /* String queryString = ' SELECT Competitive_Brand__c,Competitive_Discount_Percent__c,Competitive_Invoice_Price__c,Competitive_Product__c,Id,Incentive__c,Name '+ ' FROM Incentive_Product__c WHERE Id = :currentIncentiveId '; for(Incentive_Product__c incetiveprod : Database.query(queryString)){ CompetitionReportData competitiveData = new CompetitionReportData(); if(competitiveinfo.competitiveInfo == null) competitiveinfo.competitiveInfo = new List<CompetitionReportData>(); competitiveData.product = incetiveprod.Name; competitiveinfo.competitiveInfo.add(competitiveData); } */ // get received by default value | Current User's -> 'FirstName' + 'LastName' User usr = [SELECT FirstName, LastName FROM User WHERE Id = :UserInfo.getUserId()]; competitiveinfo.receivedBy = (usr.FirstName != null ? usr.FirstName : '')+' '+(usr.LastName != null ? usr.LastName : '') ; Incentive__c incentive; if(incentiveId != null){ incentive = [SELECT Competitive_Info_Received_By__c, Competitive_Info_Provided_By__c, Competitive_Info_Date_Received__c FROM Incentive__c WHERE Id = :incentiveId]; } competitiveinfo.providedBy = incentive.Competitive_Info_Provided_By__c; competitiveinfo.receivedBy = incentive.Competitive_Info_Received_By__c; // SN 403714 if( incentive.Competitive_Info_Date_Received__c != null){ competitiveinfo.receivedDate = String.valueOf(incentive.Competitive_Info_Date_Received__c); }else{ competitiveinfo.receivedDate = String.valueOf(date.today()); } // fetch list of competitive brand values from Competitive_Brand__c Object for(Competitive_Brand__c compbrand : [SELECT Id, Name FROM Competitive_Brand__c WHERE VSD_Process__c includes ('Incentive') ]){ if(competitiveinfo.competitiveBrandPicklist == null) competitiveinfo.competitiveBrandPicklist = new List<Competitive_Brand__c>(); competitiveinfo.competitiveBrandPicklist.add(compbrand); } // fetch list of Incentive Competitive Info values from Incentive_Competitive_Info__c Object CompetitionReportData reportData; for(Incentive_Competitive_Info__c incCompInfo : [SELECT Id, Name, Incentive__c, Competitive_Brand__c, Competitive_Product__c, Competitive_Discount_Percent__c, Competitive_Invoice_Price__c ,DeleteLine__c // SN 403714 FROM Incentive_Competitive_Info__c WHERE Incentive__c = :incentiveId]){ if(competitiveinfo.competitiveInfo == null) competitiveinfo.competitiveInfo = new List<CompetitionReportData>(); //Competitive_Brand__c brand = [SELECT Name FROM Competitive_Brand__c WHERE Id =: incCompInfo.Competitive_Brand__c ]; reportData = new CompetitionReportData(incCompInfo); //reportData.competitiveBrand = brand.Name; competitiveinfo.competitiveInfo.add(reportData); } return JSON.serialize(competitiveinfo); } // Creates set of Incentive Competitive Info records // //@param // String : JSON of structure Incentives competitive report @RemoteAction public static void setIncentiveProducts(String competitiveInfoJsonString, String incentiveId, String currentIncentiveData){ Incentive__c incentive; if(incentiveId != null){ incentive = [SELECT Competitive_Info_Received_By__c, Competitive_Info_Provided_By__c, Competitive_Info_Date_Received__c FROM Incentive__c WHERE Id = :incentiveId]; } List<Incentive_Competitive_Info__c> competitiveInfo = new List<Incentive_Competitive_Info__c>(); List<Incentive_Competitive_Info__c> DelCompetitiveInfo = new List<Incentive_Competitive_Info__c>(); // SN 403714 List<VSD_Inc_New_CompetitionReportController.CompetitionReportData> compReportDataList = (List<VSD_Inc_New_CompetitionReportController.CompetitionReportData>)JSON.deserializeStrict(competitiveInfoJsonString, List<VSD_Inc_New_CompetitionReportController.CompetitionReportData>.class); VSD_Inc_New_CompetitionReportController.CompetitionReportInfo incentiveData = (VSD_Inc_New_CompetitionReportController.CompetitionReportInfo)JSON.deserializeStrict(currentIncentiveData, VSD_Inc_New_CompetitionReportController.CompetitionReportInfo.class); incentive.Competitive_Info_Received_By__c = incentiveData.receivedBy; incentive.Competitive_Info_Provided_By__c = incentiveData.providedBy; if(String.isNotBlank(incentiveData.receivedDate)) incentive.Competitive_Info_Date_Received__c = Date.valueOf(incentiveData.receivedDate + ' ' + '00:00:00'); for(VSD_Inc_New_CompetitionReportController.CompetitionReportData compData : compReportDataList){ Incentive_Competitive_Info__c incentiveInfo = new Incentive_Competitive_Info__c(); incentiveInfo.Incentive__c = String.valueOf(incentiveId); incentiveInfo.Competitive_Brand__c = compData.competitiveBrand; incentiveInfo.Competitive_Product__c = compData.competitiveProduct; if(String.isNotBlank(compData.invoicePrice)) incentiveInfo.Competitive_Invoice_Price__c = Decimal.valueOf(compData.invoicePrice); incentiveInfo.Competitive_Discount_Percent__c = compData.discountPercent; incentiveInfo.DeleteLine__c = compData.deleteLine; // SN 403714 incentiveInfo.Id = compData.id; system.debug('********************************************** compData.DeleteLine = ' + compData.DeleteLine); system.debug('********************************************** incentiveInfo.DeleteLine__c = ' + incentiveInfo.DeleteLine__c); if(IncentiveInfo.DeleteLine__c == true) // SN 403714 DelCompetitiveInfo.add(incentiveInfo); // SN 403714 else // SN 403714 CompetitiveInfo.add(incentiveInfo); } // SN 403714 //>>> system.debug('********************************************** DelCompetitiveInfo = ' + DelCompetitiveInfo); //>>> system.debug('********************************************** CompetitiveInfo = ' + CompetitiveInfo); try{ upsert competitiveInfo; delete DelCompetitiveInfo; // SN 403714 update incentive; }catch(Exception e){ System.debug('Caught DML exception on Incentive Competititve Info / Incentive object'); } } public class CompetitionReportInfo { public String receivedBy; public String providedBy; public String receivedDate; public List<Competitive_Brand__c> competitiveBrandPicklist; public List<CompetitionReportData> competitiveInfo; } public class CompetitionReportData { public CompetitionReportData(Incentive_Competitive_Info__c info){ competitiveBrand = info.Competitive_Brand__c; competitiveProduct = info.Competitive_Product__c; invoicePrice = String.valueOf(info.Competitive_Invoice_Price__c); discountPercent = info.Competitive_Discount_Percent__c; deleteLine = info.DeleteLine__c; // SN 403714 id = info.Id; } //public String product; public String id; public String competitiveBrand; public String competitiveProduct; public String invoicePrice; public String discountPercent; public Boolean deleteLine; // SN 403714 } }Can anybody help me?
Thanks,
Steve A.
- CTIT Siding
- February 10, 2017
- Like
- 0
Date.today() returning yesterday's date.
I have a scheduler that runs every day @9am PST that sends out birthday emails. However, when it ran this morning, it sent out emails to people who had birthdays yesterday. I'm using Date.today() to grab the date, and the debug log shows that this returned yesterday's date.
09:00:01.0 (19039191)|VARIABLE_ASSIGNMENT|[10]|this|{"listDay":"0x638eaffe","monthDayCount":"0x38f524b0","startDate":"0001-12-30T00:00:00.000Z","todaysDate":"2017-02-09T00:00:00.000Z"}|0x3f7a5e67
Anyone have a clue why? I checked my org's timezone settings as well as my user's settings, but everything is correctly set to 'Los Angeles'. Am I missing something?
09:00:01.0 (19039191)|VARIABLE_ASSIGNMENT|[10]|this|{"listDay":"0x638eaffe","monthDayCount":"0x38f524b0","startDate":"0001-12-30T00:00:00.000Z","todaysDate":"2017-02-09T00:00:00.000Z"}|0x3f7a5e67
Anyone have a clue why? I checked my org's timezone settings as well as my user's settings, but everything is correctly set to 'Los Angeles'. Am I missing something?
- EulogioGallo
- February 10, 2017
- Like
- 0