- Naval Sharma4
- SMARTIE
- 1134 Points
- Member since 2015
- Sn. Salesforce Developer
- Appcino Technologies Pvt. Limited
-
ChatterFeed
-
34Best Answers
-
0Likes Received
-
1Likes Given
-
4Questions
-
345Replies
Test Class for Apex batch job, not covering the execute method in batch: Coverage Missing!!
***********My Batch Class*********** global class CreateMissingentitlementWithSA implements Database.Batchable<sObject> { List<String> Reclist = new List<String>{'Renewal - Booked', 'Renewal'}; List<String> StgVal = new List<String>{'Closed Won'}; public String Query='Select id, OpportunityId,Opportunity.stageName, Name from OpportunityLineItem where OpportunityId Not In (Select Opportunity__c From Entitlement__c)'; global database.querylocator start(Database.BatchableContext BC) { return Database.getQueryLocator(Query); } global void execute(Database.BatchableContext BC, List<sObject> scope) { list<OpportunityLineItem> Opp=new list<OpportunityLineItem>(); set<Id> Opptyids=new set<Id>(); set<Id> OpsId=new set<Id>(); list<opportunitylineItem> listOLIs = new list<opportunitylineItem>(); for(sObject s : scope){ OpportunityLineItem op = (OpportunityLineItem)s; if(op.id!=null){ Opptyids.add(Op.id); } if(op.OpportunityId!=null){ OpsId.add(op.OpportunityId); } } if(!Opptyids.isempty()){ listOLIs = [SELECT OpportunityId, id,Product2id,Number_of_SAT_Hours__c,Number_of_Units__c ,PricebookEntryId FROM OpportunityLineItem where OpportunityId not in (select opportunity__c from entitlement__c) and Product2.family = 'Product Bundle' and Product2.Web_Site_Id__c!='' and id in :Opptyids]; if(listOLIs!=null && listOLIs.size()>0) { ConvertedOLIWorkflows objConvertedOLIWorkflows = new ConvertedOLIWorkflows (listOLIs ); objConvertedOLIWorkflows.createEntitlementAfterOLI(listOLIs ); system.debug('Check If Entitlements Addedd Successfully'); } list<Service_Access__c> SAlist = new list<Service_Access__c>(); SAlist= [Select id, Sold_Opportunity__c from Service_Access__c where Sold_Opportunity__c In:OpsId]; Map<Id, Id> SAOptyMap = new Map<Id, Id>(); If (SAlist!=null) for (Service_Access__c SA:SAlist) { SAOptyMap.Put(SA.Sold_Opportunity__c, SA.Id); } list<Entitlement__c> EntLst = new list<Entitlement__c>(); EntLst= [Select id, Opportunity__c, Service_Access__c from Entitlement__c where Opportunity__c In:OpsId]; for(Entitlement__c Ent:EntLst ){ Ent.Service_Access__c= SAOptyMap.get(Ent.Opportunity__c); } Update EntLst; } } global void finish(Database.BatchableContext BC){ AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, ExtendedStatus,CreatedBy.Email from AsyncApexJob where Id =:BC.getJobId()]; //Send an email to the Apex job's submitter notifying of job completion. Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses = new String[] {a.CreatedBy.Email}; mail.setToAddresses(toAddresses); mail.setBccSender(true); mail.setSubject('Add missing entitlements batch job ' + a.Status ); mail.setPlainTextBody ('The batch Apex job processed ' + a.TotalJobItems + ' batches with '+ a.NumberOfErrors + ' failures due to'+ a.ExtendedStatus ); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } }
*******my Test Class for the above batch*** @isTest(seeAllData=true) private class CreateMissingentitlementWithSATestClass{ static testMethod void myTest() { Id rtid = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Renewal').getRecordTypeId(); Id rtid1 = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Renewal - Booked').getRecordTypeId(); Product2 p = new product2(name='Test Product', Family = 'Product Bundle', Discount_No_Approval__c=10, Discount_FL_Approval__c=25, Discount_GL_Approval__c =50, Discount_Finance_Approval__c =75, Web_Site_Id__c = 'test'); insert p; Bundled_Components__c bundComp = new Bundled_Components__c(CurrencyIsoCode='USD', Parent_Product__c=p.id); insert bundComp; insert new PricebookEntry(unitprice = 100.0, product2id = p.id, pricebook2id = Test.getStandardPricebookId(),isActive=true); Pricebook2 pb = new pricebook2(name='test pricebook'); insert pb; PricebookEntry pbe = new PricebookEntry(pricebook2id=pb.id, product2id=p.id, unitprice=100.0, isActive=true); insert pbe; account acc = new account(Type = 'LE', Membership_Type__c = 'Standard', AnnualRevenue = 100, Name = 'SaurabhTest', NumberOfEmployees = 2, Region__c = 'NA'); insert acc; Contact c = new Contact(AccountID =acc.Id, FirstName='FirstName', LastName='Testing Contact',Title='Naveen', Email='test14@gmail1421.com', Mailing_Address_1__c='Delhi'); insert c; opportunity oppNew = new opportunity(); oppNew.Gartner_Opportunity_ID__c = 'o12345'; oppNew.Amount = 0 ; oppNew.Pricebook2Id = pb.id ; oppNew.GTS__c = true; //oppnew.TerritoryId = TerritoryId; //oppnew.ownerId = OwnerId; oppNew.Main_Contact__c = c.id ; oppNew.accountId = acc.id; oppNew.stageName = 'Prospecting'; oppNew.CloseDate = Date.today(); oppNew.Name = 'GTS Opportunity'; oppNew.RecordTypeId=rtid; insert oppNew; OpportunityLineItem oli = new OpportunityLineItem(Allow_Delete__c=true, Manual_Pricing__c=true,opportunityid=oppNew.id,UnitPrice=100, quantity=1, pricebookentryid=pbe.Id,Start_Date__c=Date.newInstance(2018,03,22),End_Date__c=Date.newInstance(2019,03,21),Retail_Amount__c=550000); insert oli; Test.startTest(); CreateMissingentitlementWithSA ent = new CreateMissingentitlementWithSA(); Id batchId = Database.executeBatch(ent); Test.stopTest(); } }
- Prabhat Arora
- May 31, 2018
- Like
- 0
- Continue reading or reply
Dynamic Referencing SObject Fields in Lightning Component Helper
In my lightning component Helper method (called via controller when field value changes), I call another helper method and pass the field name as String which I need to update. Is there a way to dynamically reference that field and update it's value?
//Helper Method 1 calculateSegmentsAmounts : function(component, event, helper) { var prepayRecord = component.get("v.prepaymentRecord"); var segmentsList = component.get("v.prepaymentSegmentsList"); var calculatedTotalPercentage = 0; var calculatedTotalPrincipal = 0; var calculatedTotalInterest = 0; var calculatedTotalPremium = 0; var calculatedTotalBreakage = 0; var calculatedTotalOther = 0; for(var i=0; i < segmentsList.length; i++) { var percentage = 0; var principal = 0; if(segmentsList[i].Selected__c) { percentage = segmentsList[i].PAR_Percentage__c / 100; principal = percentage * prepayRecord.Native_Principal__c; segmentsList[i].Interest__c = percentage * prepayRecord.Native_Interest__c; segmentsList[i].Premium__c = percentage * prepayRecord.Native_Premium__c; segmentsList[i].Breakage__c = percentage * prepayRecord.Native_Breakage__c; segmentsList[i].Other__c = percentage * prepayRecord.Native_Other__c; segmentsList[i].Total_Segment__c = principal + segmentsList[i].Interest__c + segmentsList[i].Premium__c + segmentsList[i].Breakage__c + segmentsList[i].Other__c; } percentage = percentage * 100; calculatedTotalPercentage += percentage; segmentsList[i].Principal__c = principal; calculatedTotalPrincipal += segmentsList[i].Principal__c; calculatedTotalInterest += segmentsList[i].Interest__c; calculatedTotalPremium += segmentsList[i].Premium__c; calculatedTotalBreakage += segmentsList[i].Breakage__c; calculatedTotalOther += segmentsList[i].Other__c; } // Loop ends // Update attribute value because it will be referred in below Helper methods component.set("v.prepaymentSegmentsList", segmentsList); var reCalcTotal = false; if(calculatedTotalPercentage == 100.00000000000) { if(calculatedTotalPrincipal != 0 && calculatedTotalPrincipal != prepayRecord.Native_Principal__c) { helper.adjustExtraAmount(component, event, helper, prepayRecord.Native_Principal__c, calculatedTotalPrincipal, "Principal__c"); // Passing Field name as String reCalcTotal = true; } if(calculatedTotalInterest != 0 && calculatedTotalInterest != prepayRecord.Native_Interest__c) { helper.adjustExtraAmount(component, event, helper, prepayRecord.Native_Interest__c, calculatedTotalInterest, "Interest__c"); // Passing Field name as String reCalcTotal = true; } if(calculatedTotalPremium != 0 && calculatedTotalPremium != prepayRecord.Native_Premium__c) { helper.adjustExtraAmount(component, event, helper, prepayRecord.Native_Premium__c, calculatedTotalPremium, "Premium__c"); // Passing Field name as String reCalcTotal = true; } if(calculatedTotalBreakage != 0 && calculatedTotalBreakage != prepayRecord.Native_Breakage__c) { helper.adjustExtraAmount(component, event, helper, prepayRecord.Native_Breakage__c, calculatedTotalBreakage, "Breakage__c"); // Passing Field name as String reCalcTotal = true; } if(calculatedTotalOther != 0 && calculatedTotalOther != prepayRecord.Native_Other__c) { helper.adjustExtraAmount(component, event, helper, prepayRecord.Native_Other__c, calculatedTotalOther, "Other__c"); // Passing Field name as String reCalcTotal = true; } if(reCalcTotal) { helper.reCalculateSegmentsRowTotal(); } } component.set("v.prepaymentRecord", prepayRecord); component.set("v.prepaymentSegmentsList", segmentsList); }, //Helper Method 2 adjustExtraAmount : function(component, event, helper, nativeAmount, calculatedTotal, fieldName) { var segmentsList = component.get("v.prepaymentSegmentsList"); var multiplier = 100; var difference = (Math.round(multiplier * nativeAmount) - Math.round(multiplier * calculatedTotal)) / multiplier; var absdiff = Math.abs(difference); var calculatedMoreThanActual; if(nativeAmount < calculatedTotal) { calculatedMoreThanActual = true; } else { calculatedMoreThanActual = false; } if (absdiff >= 0.01 && absdiff < 1) { var affliatedInvIndex = helper.getLargestaffiliatedINVIndex(component, event, helper, fieldName); // Another Helper to which fieldName is passed if (affliatedInvIndex == -1) { affliatedInvIndex = helper.getLargestSegmentIndex(component, event, helper, fieldName); // Another Helper to which fieldName is passed } var nonAffliatedInvIndex = helper.getLowestNonAffiliatedINVIndex(component, event, helper, fieldName); // Another Helper to which fieldName is passed if (nonAffliatedInvIndex == -1) { nonAffliatedInvIndex = helper.getLowestSegmentIndex(component, event, helper, fieldName); // Another Helper to which fieldName is passed } var runOnce = false; console.log('>>>> Recalculating ' + fieldName); for(var i=0; i < segmentsList.length; i++) { if(segmentsList[i].Selected__c) { var oldValue = 0; oldValue = segmentsList[i].fieldName; // Need to dynamically fetch the value if(calculatedMoreThanActual) { if (i == nonAffliatedInvIndex && !runOnce) { var delta = oldValue + difference; segmentsList[i].fieldName = delta; // Need to dynamically Update the value runOnce = true; } } else { if (i == affliatedInvIndex && !runOnce ) { var delta = oldValue + difference; segmentsList[i].fieldName = delta; // Need to dynamically Update the value runOnce = true; } } } } } component.set("v.prepaymentSegmentsList", segmentsList); },
- Karan Khanna 6
- October 18, 2017
- Like
- 0
- Continue reading or reply
How to create a pop up alert
IF there's a value in the field, "Failed Status" - Then create an alert that says "Email Failed to Send"
In other words, if the "Failed Status field is not blank, trigger the alert.
How could I accomplish this?
Thank you!
- Deanna Aaron 11
- October 12, 2017
- Like
- 0
- Continue reading or reply
Date format within URL parameter
My URL looks like this:
Click<a href="https://na3.salesforce.com/a1B/e?CF00N0L0044062bDo={!relatedTo.Name}&CF00N0L0044062bDo_lkid={!relatedTo.Id}&CF00N0L4400062bDx={!recipient.name}&00N0L0055062bE2='{!relatedTo.Start_Date__c}"> HERE</a> to respond.<br />But the field "Start Date" renders as :
Fri%20Jul%2014%2000:00:00%20GMT%202017Is there an equivalent to this:
<apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!relatedTo.Start_Date__c}" /> </apex:outputText>
that I can do within the href tag to output the date into my URL in a cleaner format?
- Jon Hayes CHI
- March 17, 2017
- Like
- 0
- Continue reading or reply
How to Autosave and refresh from VisualForce when Using a picklist and other formulas
I have an opject with a MasterDetail Relation to Opportunities. And I want to Display on To display on the edit screen the Account Name that is tied to the opportunity.
So I have
<apex:pageBlockSection title="Opportunity Information"> <apex:inputField id="opportunity" value="{!Item.Opportunity__c}" /> <apex:outputField id="accountName" value="{!Item.Account_Name__c}"/> </apex:pageBlockSection>
very simple.
What I want is when the user Selects the opprtunity, I want all the formula fields to refresh. This formula fields basicall expose properties of the Account Object.
I dont mind saving the object, since i am going to use a status of 'Incomplete'
public CustomObject getItem() { if(item == null) { item = new CustomObject (); item.Application_Status__c = 'Incomplete'; } return item; }
So any ideas? I read something about saving it via JS, but how do Ido it?
- Alejandro Gonzalez 18
- February 06, 2017
- Like
- 0
- Continue reading or reply
How to integrate salesforce with Epic- Clarity Database
We are thinking to integrate Salesforce with EPIC and looking for the best possible options to implement this.
- Anusha Katkuri
- April 14, 2016
- Like
- 0
- Continue reading or reply
Module : Controlling Access to the Organization : Can not uncheck "Active" box
he new user must use the System Administrator Profile.
The username for the new user must include 'guestadmin' somewhere in it.
The new user must be inactive.
- David Meats
- April 07, 2016
- Like
- 0
- Continue reading or reply
Nested Queries Not Returning Using a Referenced Apex Class
I am having an issue where nested query results are not returning when being passed through a different class.
Here is my scenario.
Master Object: Project__c
Child Object: ProjectRole__c
When using a subquery in the same class, the related subqueried objects show up just fine.
list<Project__c> pl = [Select Id, Name, (Id, Name from ProjectRoles__r) from Project__c]; system.debug(pl.get(0).ProjectRole__r);
Running this query in a class or in the developer console returns the ProjectRoles__r subquery just fine.
DEBUG|(ProjectRole__c:{Project__c=a0lg0000002tbnuAAA, Id=a0mg00000048QUTAA2, Name=PRR-0000117848}, ProjectRole__c:{Project__c=a0lg0000002tbnuAAA, Id=a0mg00000048QUUAA2, Name=PRR-0000117849})
However, when you reference a class to return this query, the subqueries are completely lost.
public without sharing class QueryController { public static list<Project__c> getProjects(){ return [Select Id, Name, (Id, Name from ProjectRoles__r) from Project__c]; } }
list<Project__c> pl = QueryController.getProjects(); system.debug(pl.get(0).ProjectRole__r);While the Project__c record is returned, none of the subqueried records are returned.
DEBUG|()
Anyone have any ideas?
- Michael Johnson 29
- April 06, 2016
- Like
- 0
- Continue reading or reply
Nee help for lead conversion code from JavaScript
I would like to implement lead convert functionality from javascript, which will be invoked by a button click on a VF Page.
How do we implement this in javaScript to convert lead and get all the lead converted details (AccountId,ContactId,OpptyID) ?
- CloudGeek
- April 06, 2016
- Like
- 0
- Continue reading or reply
Send email when picklist field value changes from null (blank) to a certain value.
Is the formula something like this?
ISPICKVAL(PRIORVALUE(PICKLIST_FIELD_NAME),"NULL")
- Trevan
- April 06, 2016
- Like
- 0
- Continue reading or reply
Passing a where clause to a batch job dynamically.
Is there a way to pass the where clause dynamically to the query which is executed in the database.execute method from developer console.
- rcher
- April 06, 2016
- Like
- 0
- Continue reading or reply
Test Class Problem (In Anonymous Window I get returned values but in test class always empty)
I have the below test class for my REST Class:
When I run this test class always the returned list is empty though actually I am able to see data on page.
And when I run this test class code from anynymous window - I get to see results are fine with no of rows as expected.
Can anyone help me understand If I am missing something here ?
@isTest public class OSCTestClass { static testMethod void getMeListOfProducts() { // Set up a test request RestRequest request = new RestRequest(); // Set request properties String sfdcBaseURL = URL.getSalesforceBaseUrl().toExternalForm(); System.debug('sfdcBaseURL = '+sfdcBaseURL); request.requestUri = sfdcBaseURL+'/services/apexrest/OSCList/'; request.httpMethod = 'GET'; request.params.put('region', 'USA'); request.params.put('segment', 'ALL'); request.params.put('product', 'ALL'); RestContext.request = request; List<OnlineSalesCatalogWrapper> results = new List<OnlineSalesCatalogWrapper>(); String currentRequestURL = URL.getCurrentRequestUrl().toExternalForm(); System.debug('currentRequestURL = '+currentRequestURL); results = OnlineSalesCatalogController.getOfferedProductsList(); System.debug('size of results = '+results.size()); } }
- CloudGeek
- April 05, 2016
- Like
- 0
- Continue reading or reply
Format Date in Visual Force page
I want to truncate the time (19:00:00 )
This is what I wrote:
<apex:column headerValue="Event Date"> <apex:outputText value="{0,date,MM'/'dd'/'yyyy}"> <apex:param value="{!listMysticsmailMap[m].eventDateTime}" /> </apex:outputText> </apex:column>
However, I get the following error: Content cannot be displayed: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.
I then tried
<apex:outputText value="{0,date,MM/dd/yyyy}">
That didn't work either
- Gavin Britto
- April 05, 2016
- Like
- 0
- Continue reading or reply
Apex script unhandled exception by user/organization
global class ExporterCSV implements System.Schedulable { global void execute(SchedulableContext sc) { List<Contact> conList = [Select id , Lastname, FirstName , CreatedDate , lastModifiedDate from Contact]; string header = 'Record Id ,Last Name, First Name , Created Date , Modified Date \n'; string finalstr = header ; for(Contact a: conList) { string recordString = a.id + ',' + a.Lastname+',' + a.FirstName + ',' + a.CreatedDate + ',' + a.LastModifiedDate + '\n'; finalstr = finalstr + recordString; } Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment(); blob csvBlob = Blob.valueOf(finalstr); string csvname= 'Contacts.csv'; csvAttc.setFileName(csvname); csvAttc.setBody(csvBlob); Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage(); String[] toAddresses = new list<string> {'xxxxxxxxxxxxx@gmail.com'}; String subject = 'Contacts Report CSV'; email.setSubject(subject); email.setToAddresses( toAddresses ); email.setPlainTextBody('The Contacts report is attached here.'); email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc}); //Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); //system.debug(r); } }Error message I got :
Sandbox
Apex script unhandled exception by user/organization: xxxxxxxxxxxxx/yyyyyyyyyyyyyy Source organization: zzzzzzzzzzzzzz (null) Scheduled job 'Email Contact test' threw unhandled exception.
caused by: System.LimitException: Apex CPU time limit exceeded
Class.ExporterCSV.execute: line 14, column 1
- Mahatma Vijay
- April 04, 2016
- Like
- 0
- Continue reading or reply
Data Security Controlling Access to the Organization
Challenge Not yet complete... here's what's wrong:
The user's profile was not set to System Administrator
here is a screen show of my profile I cloned
Please help me to dertermine what I am doing wrong.
- Adeline Moore
- April 04, 2016
- Like
- 0
- Continue reading or reply
Apex Class: How to manipulate a field from a List
my code is below:
events = new List<Event>(); try { Set<Id> eventIds = new Set<Id>(); for (EventRelation e : [SELECT EventId FROM EventRelation WHERE RelationId =:contactId AND Status NOT IN ('Declined','Uninvited')]) { eventIds.add(e.EventId); } events = [SELECT Id, Subject, StartDateTime, StartDateUTC__c, EndDateTime, IsAllDayEvent FROM Event WHERE (WhoId=:contactId OR Id IN :eventIds) AND Event.Cancelled__c <> TRUE AND ActivityDate>=TODAY ORDER BY ActivityDate ASC];I want to create a String within the class which appends the appopriate date value based on the boolean "IsAllDayEvent" field.
When I try a "For" statement or an "If" statement, it won't let me perform the following:
String StartDateVF;
IF(events.IsAllDayEvent == true) {
StartDateVF = StartDateUTC__c
} else {
StartDateVF = StartDateTime;
}
The error that I'm getting is because the List "Events" can't grab the field "IsAllDayEvent" for some reason, even though a SOQL query has been run on the events list. I'm not sure why the list created in the first section of code won't let me grab the "IsAllDayEvent" field. Do I need to set this part up differently?
- Khalid Abdullah
- April 04, 2016
- Like
- 0
- Continue reading or reply
Create a Guest Administrator and deactivate it
The user's profile was not set to System Administrator
Here is my screen shot of my users profile Please what am I doing to fail this?
- Adeline Moore
- April 04, 2016
- Like
- 0
- Continue reading or reply
How To Generate JSON Request Body from Wrapper Request Class.
Below are the Sample Classes.
public class requestResource{
public orderRequestResource order {get;set;}
}
public class orderRequestResource {
public String accountUNumber {get;set;}
public String contractNumber {get;set;}
public string status {get;set;}
public string externalKey {get;set;}
public string orderStartDate {get;set;}
public string priceBookName {get;set;}
public List<orderLineItemRequestResource> orderItems {get;set;}
}
public class orderLineItemRequestResource{
public string quantity {get;set;}
public string unitPrice {get;set;}
public string description {get;set;}
public string productCode {get;set;}
public string externalKey {get;set;}
}
- ROHIT.KUMAR.VERMA
- March 16, 2016
- Like
- 0
- Continue reading or reply
Javascript not running on VF page
I want when oppy stage is closed won. user should get pop up. i create this page. But the popup is not coming. even when i preview the page , nothing shows up.
<apex:page standardController="opportunity" rendered="{!opportunity.stagename="Closed Won"}"> <script type="text/javascript"> { window.alert("i did it"); } </script> </apex:page>
please help to resolve this.
- Developement
- March 15, 2016
- Like
- 0
- Continue reading or reply
Looking for a couple of Salesforce Developers
Note - please don't apply if you are looking for a freelance opportunity or has other freelance works.
- Naval Sharma4
- April 12, 2018
- Like
- 0
- Continue reading or reply
I am having issue in sending email from apex using an email template
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTemplateId( et.Id); mail.setTargetObjectId( cm.LeadId ); //mail.setWhatId(cm.Id); mail.setSaveAsActivity(false);
If I use CampaignId in the setWhatId() method, it doesn't populate the custom fields which are created on campaign member object. Also, I can't use the CampaignMember Id in the whatId.
- Naval Sharma4
- February 10, 2018
- Like
- 0
- Continue reading or reply
Having trouble with Lightning component when I put a component in the div. It doesn't render the nested component.
MainComponent.cmp
<aura:component controller="ContactClass" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:attribute name="contact" type="Contact[]"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:iteration items="{!v.contact}" var="con"> <br/> <a href="javascript:void(0);" onclick="" role="tab" tabindex="0" aria-selected="true" aria-controls="tab-default-1" id="{!con.Id}">{!con.Name} | {!con.AccountId}</a> <div> <c:NestedComponent Cont="{!con}" /> </div> </aura:iteration> </aura:component>
MainComponent.js
({ doInit: function(component, evt, helper) { var action = component.get("c.getContact"); action.setCallback(this, function(a) { component.set("v.Contact", a.getReturnValue()); }); $A.enqueueAction(action); }, } })
NestedComponent.cmp
<aura:component controller="SBBQQUOTELIneClass" access="global" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"> <aura:attribute name="Cont" type="Contact" default="{ 'sobjectType': 'Contact' }" access="global"/> <p>QUestion 1</p> <force:inputField aura:id="prId" value="{!v.Cont.AccountId}" class=""/> </aura:component>
- Naval Sharma4
- May 31, 2017
- Like
- 0
- Continue reading or reply
QuickBooks Integration with salesforce
Hello All,
I want to integrate QuickBooks integration with salesforce. As per QuickBooks API X.509 certificates are required with private key. Although i have created self-signed certificates but i am not able to get private key. Does anyone know, how can i get private key.
Any idea about signing a SAML assertion with private key would be more advantage for me.
Thanks in advance for your help.
- Naval Sharma4
- April 21, 2015
- Like
- 0
- Continue reading or reply
How we can Create Approval Process in APex Class Using MetaData Api ???
- Rashika Singh
- April 15, 2020
- Like
- 0
- Continue reading or reply
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “demo2” process failed. Give your Salesforce admin these details.
public class ContactUtilty {
Public static void CreateBulconRecords()
{
List<Contact> lstConRecords = new List<Contact>();
for(integer counter = 1; counter <= 20; counter++)
{
// Prepare the Record..
Contact con = new Contact();
con.LastName= 'arjunreddy - '+ counter;
con.Fax = '0878946464';
con.HomePhone = '9900998877';
con.Email = 'apexhr'+counter+'@gmail.com';
// Add the Record to the Collection..
lstconRecords.Add(con);
}
if(! lstconRecords.isEmpty())
{
insert lstconRecords;
}
}
}
- eggoni ashok
- April 15, 2020
- Like
- 0
- Continue reading or reply
I cant save record in table when I click on Save button
public class HospitalApex{ public Hospital__c hosp{get;set;} public Hospital__c insertedrecord{get;set;} public HospitalApex( ApexPages.StandardController sc ) { this.hosp= (Hospital__c)sc.getRecord(); } public void insertNewItem() { if(hosp.Name == NULL || hosp.Name == '' ) { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'Please enter Something')); } else { insert hosp; id insertedrecordid = hosp.Id; insertedrecord = [Select Name, Account__c from Hospital__c where Id = :insertedrecordid ]; hosp = new Hospital__c(); } } }
<apex:page standardController="Hospital__c" extensions="HospitalApex"> <apex:form > <apex:pageBlock > <apex:pageMessages id="showmsg"></apex:pageMessages> <apex:pageBlockSection > <apex:pageBlockSectionItem > Hospital Name : <apex:inputField value="{!hosp.Name}"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > Account Name : <apex:inputField value="{!hosp.Account__c}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!insertNewItem}" value="Save" rerender="showmsg"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{! insertedrecord }" var="ct" id="mainSection"> <apex:column headerValue="Hospital Name">"{! ct.Name }"</apex:column> <apex:column headerValue="Account Name">"{! ct.Account__c }"</apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>I want to save record entered in text field in table but when i click on Save button, nothing happens
- Mohammadasif Siddiqui
- April 15, 2020
- Like
- 0
- Continue reading or reply
I want to update lead owner to XYZ when lead owner is inactive before for loop starts
global Database.QueryLocator start(Database.BatchableContext bc)
{
return Database.getQueryLocator([SELECT OwnerId,DOB_Formula__c,Id,Possible_Followup_Date__c FROM Lead WHERE DOB_Formula__c = NEXT_N_DAYS:7 AND Possible_Followup_Date__c != null]);
}
global void execute(Database.BatchableContext bc, List<Lead> scope)
{
List<Task> listOfTask = new list<Task>();
for(Lead l : scope)
{
Task B = new Task();
B.Subject= 'Send Birthday Card';
B.ActivityDate = date.today();
B.OwnerId = l.OwnerId;
B.WhoId=l.Id;
listOfTask.add(B);
- Ishan Singh 4
- April 15, 2020
- Like
- 0
- Continue reading or reply
How to populate Opportunity fields of the opp that is created during Lead conversion
- API User 189
- March 22, 2019
- Like
- 0
- Continue reading or reply
API without OAuth?
- Zach Coffin
- March 22, 2019
- Like
- 0
- Continue reading or reply
I'm trying to create a visualforce page and turun that into a list button on my opportunity product, but I am stuck on how to formulate the standard controller.
CONTROLLER
public class Calculator
{
public integer number1{get;set;}
public integer number2{get;set;}
public string operator{get;set;}
public double result{get;set;}
public void calculation()
{
if(operator.contains('+'))
result=number1+number2;
if(operator.contains('-'))
result=number1-number2;
if(operator.contains('*'))
result=number1*number2;
if(operator.contains('/'))
result=number1/number2;
}
}
- Malik Butler
- March 22, 2019
- Like
- 0
- Continue reading or reply
Hi I keep getting a cryptic email but I don't know why or how to investiage it? I haven't made any recent changes but it started about two weeks ago. See email below:
Message: Apex script unhandled exception by user/organization: 00561000001ZL2O/00D610000007iZw
Failed to process Queueable job for class SlackOpportunityPublisher for job ID 7074M00005mBr87.
caused by: System.NullPointerException: Argument 1 cannot be null
Class.SlackOpportunityPublisher.QueueableSlackCall.execute: line 36, column 1
If anyone can make sense of this or has any recommendations I would appreciate it.
Thanks -Mark
- Mark Thomas 15
- March 22, 2019
- Like
- 0
- Continue reading or reply
Report difference between two column
Is there a way to get difference between two column as another column in report. Please let me know.
Thanks
Maheem
- MaheemSam
- March 22, 2019
- Like
- 0
- Continue reading or reply
Cannot read property 'indexOf' of undefined
My component is
<aura:component controller="ContactController">
<aura:attribute name="contact" type="Contact" default="{'sobjectType': 'Contact'}"/>
<aura:handler event="aura:locationChange" action="{!c.locationChange}"/>
<div class="details">
<h1>{!v.contact.Name}</h1>
<h3>{!v.contact.Account.Name}</h3>
<h3>{!v.contact.Title}</h3>
<p>{!v.contact.Phone}</p>
{!v.contact.MobilePhone}
</div>
</aura:component>
and Controller is
({
locationChange : function(component, event, helper) {
var token=event.getParam("token");
if(token.indexOf('contact/')===0)
{
var contactId=token.substr(token.indexOf('/')+1);
var action=component.get("c.findById");
action.setParams({"contactId":contactId});
}
action.setCallback(this,function(response){
component.set("v.contacttt",response.getReturnValue());
})
$A.enqueueAction(action);
}
})
- VIKASH CHAND KUMAR
- March 22, 2019
- Like
- 0
- Continue reading or reply
How to change Quote status and is not change in 7 days send reminder mail?
i was trying to do this but face problem in first status
When i create Quote it can't fatch me " Status change DateTime" first time.
I want to do this Scenario with Apex Class: "If Quote status exceeds 7 days, send email reminder to record owner to follow up with quote
"
- Rizwan Ali 8
- March 22, 2019
- Like
- 0
- Continue reading or reply
we have lookup relationship from custom object to the opportunity and with the help of visual force page or trigger I want to show both objects records in each other’s related list.
- Troy Turley
- March 22, 2019
- Like
- 0
- Continue reading or reply
Customise salesforce standard form
I need to fetch the field value on the form using DML. Is it possible in salesforce?
What is the other solution? Please reply.
- Nitin Kumar 162
- March 22, 2019
- Like
- 0
- Continue reading or reply
7Summits is looking for Salesforce Architects, Developers, Admins and BA's Remote and Midwest
- Salesforce Developer - Chicago IL, Milwaukee WI or Remote: http://7summitsinc.applytojob.com/apply/9QiHxR
- Salesforce Technical Architect - Chicago IL, Milwaukee WI or Remote: http://7summitsinc.applytojob.com/apply/8aEM4u
- Salesforce Front End Developer - Chicago IL, Milwaukee WI or Remote: - http://7summitsinc.applytojob.com/apply/BwSGOC
- Salesforce Sales Engineer - Chicago IL, Milwaukee WI or Remote: http://7summitsinc.applytojob.com/apply/ry8VAL
- Salesforce Business Analyst / Admin - Chicago IL, Milwaukee WI or Remote: http://7summitsinc.applytojob.com/apply/sufDyx
- Salesforce Alliance Manager - San Francisco : http://7summitsinc.applytojob.com/apply/GsQ5J5
- Plus Relocation Community: https://vimeo.com/139293581
- SeaRay Boat Owners Community: https://vimeo.com/151956674
http://www.7summitsinc.com/
- James Davidson 34
- March 24, 2016
- Like
- 3
- Continue reading or reply