• Naval Sharma4
  • 1134 Points
  • Member since 2015
  • Sn. Salesforce Developer
  • Appcino Technologies Pvt. Limited

  • Chatter
  • 34
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
  • 345
Hi All, I had created a batch job, for which i am writing a test class, batch class is working fine but i am missing something in Test Class, below is the code snippet of both of my classes, my Test class is not covering the execute method of the  batch job, resulting in just 37% of code coverage. It would be a great help  if somebody can help me in figuring out the issue.
***********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;
        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.setSubject('Add missing entitlements batch job ' + a.Status );
             ('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***
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';
                         insert oppNew;
          OpportunityLineItem oli = new OpportunityLineItem(Allow_Delete__c=true, Manual_Pricing__c=true,opportunityid=oppNew.id,UnitPrice=100, quantity=1,
          insert oli;
     CreateMissingentitlementWithSA ent = new CreateMissingentitlementWithSA();
     Id batchId = Database.executeBatch(ent); 

In my lightning component I have sObject list which I render as data table. Some of the cells/fields are editable and onChange of those fields I recalculate other fields.
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) {
        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);

I'd like to make an alert on the opportunity object to say -
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!
I am building a VF email template that contains a URL to create a record and prefilling some fields on the form. Of the fields is a date field and it only serves as a reference to the user but needs to be readable. I need to remove the time zone/offset from the date that is rendered into my URL. I know how to output the format I want anywhere else in the email but as part of an <a href".. tag I do not know how.

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 :
Is 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?

The scenario is simple . 
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}"/>


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?
Hi All

We are thinking to integrate Salesforce with EPIC and looking for the best possible options to implement this.
I am a newbie trying to complete this challenge but cannot uncheck this box when creating a new user.  I have Admin rights but it won't uncheck??

User-added image

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.​

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];

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();
While the Project__c record is returned, none of the subqueried records are returned.

Anyone have any ideas?

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) ?
In Process Builder, how can I trigger an email to be sent when picklist field value changes from null (blank) to a certain value?

Is the formula something like this?
  • April 06, 2016
  • Like
  • 0

Is there a way to pass the where clause dynamically to the query which is executed in the database.execute method from developer console.
  • April 06, 2016
  • Like
  • 0

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 ?
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());

I need Help converting 2016-01-08T19:00:00 to 01/08/2016

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}" />

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
Hi, I created a Schedulable class to send a CSV file to an email. While I'm testing it I got this error to my e-mail instead of a CSV file. Can anyone help me with this? I'm attaching the code here.
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';
	Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
	String[] toAddresses = new list<string> {'xxxxxxxxxxxxx@gmail.com'};
	String subject = 'Contacts Report CSV';
	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 });
Error message I got :

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

I keep getting a failure on this trailhead challenge for the following reason:
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
User-added image 

Please help me to dertermine what I am doing wrong.
Hello all,

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')]) {
          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?
I Keep failing this challenge for the below reason:
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?
User-added image
I am writing a REST Service and have created Request and Response Wrappers, Finding it difficult to generate the JSON Request Body out of the wrapper classes.
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;}

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");

please help to resolve this.
A few exciting opportunities have arisen within our team based in Jaipur to work on first-class ISV product and deliver exciting client projects. We have offices in various part of the world so you may require to travel to that offices too. If you are looking for challenging work on a day to day basis on Salesforce ecosystem and wanting to get your hands dirty with Lightning, Angular/React, Watson and Estine AI, working for ISV and API integration with complex solutions, just apply. We are only recruiting for a limited number of roles and only for the right person. You have to be dedicated and special.

Note - please don't apply if you are looking for a freelance opportunity or has other freelance works.
My email template has some campaign member merge fields and when I am sending email it's not populating the cusotm field values.
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateId( et.Id);
mail.setTargetObjectId( cm.LeadId  );

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.
Here is my code and according to me, there is nothing which can cause this issue. It does work when I don't use the div tag around the c:NestedComponent. 

<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">
        <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>
        <c:NestedComponent Cont="{!con}" />

    doInit: function(component, evt, helper) {
        var action = component.get("c.getContact");
        action.setCallback(this, function(a) {
                component.set("v.Contact", a.getReturnValue());

<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=""/>


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.

//iam executed bluk record code.i getting this dml exception.//
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..
        if(! lstconRecords.isEmpty())
            insert lstconRecords;            

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'));   
      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 >
Account Name :  
 <apex:inputField value="{!hosp.Account__c}"/>
    <apex:pageBlockButtons >
<apex:commandButton action="{!insertNewItem}" value="Save" rerender="showmsg"/>   

<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>

I want to save record entered in text field in table but when i click on Save button, nothing happens
global class BirthdayCard implements Database.Batchable<sObject> {
    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;
When a Lead is converted into an account, it gives the option to create a Pipeline opportunity. My issue is that if selected, I cannot edit this opportunity's fields via a trigger (I have both a trigger for when the Opportunity is created and when a Lead is converted and neither work for that opportunity). Strange thing is that if the opportunity is created before or after the conversion, my triggers are able to edit these fields. Is there a reason that the conversion opportunity is uneditable? Is there a workaround to this problem?
We're trying to import information from Salesforce into our Grails3 system and don't really need to authenticate every user since we can control user access at our system login. Can we use something a bit more permanent to send API requests to our my.salesforce.com instance at a system level without having to prompt our already locally logged-in authorized users to authenticate with SF every time we want to import another record from SF to our system?
<apex:page controller="Calculator"> <apex:form > <apex:inputText value="{!number1}"/> <apex:inputText value="{!number2}"/> <apex:inputText value="{!operator}"/> <apex:commandButton value="Show Result" action="{!calculation}">{!result} </apex:commandbutton> </apex:form> </apex:page>


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()
Subject: Developer script exception from (Company) : SlackOpportunityPublisher for job ID 7074M00005mBr87. : Argument 1 cannot be null

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

  Is there  a way to get difference between two column as another column in report. Please let me know. 

I am always getting this error "ContactDetails$controller$locationChange [Cannot read property 'indexOf' of undefined] Failing descriptor: {ContactDetails$controller$locationChange}" Not sure what is wrong, can you please help

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">


and Controller is

    locationChange : function(component, event, helper) {
        var token=event.getParam("token");
            var contactId=token.substr(token.indexOf('/')+1);
            var action=component.get("c.findById");
Scenario is: If Quote status exceeds 7 days, send email reminder to record owner to follow up with quote

User-added imageUser-added imageUser-added imageUser-added image 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
Can we customize the standard form code, Can I use DML on a standard form field.
I need to fetch the field value on the form using DML. Is it possible in salesforce?
What is the other solution? Please reply.
Join the Salesforce Community Cloud 2015 Innovation Award Winner and build the next generation of digital experiences powered by the Salesforce platform.  7Summits is looking for Salesforce talent including: 
  • 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 
We are a passionate team of strategists, designers, and developers that believe in unleashing people’s potential to create, innovate, and compete in entirely new ways. See our work at:
  • Plus Relocation Community: https://vimeo.com/139293581
  • SeaRay Boat Owners Community: https://vimeo.com/151956674
Ascend with the best—come see what we’re all about!