• Himanshu.SFDC
  • 5 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 15
This is my code,

global class OpportunityInvoiceReport implements Database.Batchable<sObject>,Schedulable {
    global void execute(SchedulableContext SC) {
        Id batch = Database.executeBatch(new OpportunityInvoiceReport(),100);
    global Database.QueryLocator start(Database.BatchableContext BC){
        String query = 'SELECT Id,AccountId,Invoice_Number__c FROM Opportunity WHERE StageName = \'Implementation Complete (MED)\'';
        return Database.getQueryLocator(query);
    global void execute(Database.BatchableContext BC, List<Opportunity> scope){
        Set<String> invoiceNumber = new Set<String>();
        Map<String,Opportunity> oppMap = new Map<String,Opportunity>();
        List<Opportunity_Invoices__c> oppInvoiceInsert = new  List<Opportunity_Invoices__c>();
        for(Opportunity opp:scope){
        for(Invoice__c invoice:[SELECT Id,Name FROM Invoice__c WHERE Name =:invoiceNumber]){
            Opportunity_Invoices__c oppInvoice = new Opportunity_Invoices__c();
            oppInvoice.Invoice__c = invoice.Id;
            oppInvoice.Account__c = oppMap.get(invoice.Name).AccountId;
            oppInvoice.Opportunity__c = oppMap.get(invoice.Name).Id;
        insert oppInvoiceInsert;
    global void finish(Database.BatchableContext BC){
        System.debug('OpportunityInvoiceReport Batch Successfully COmpleted..!');
Hi there,

I am getting this error at the time of running test class at the below line.
      list<User> users = (list<User>) JSON.deserialize(newUsersJson, List<User>.class);
Error: malformed json exception.expected [ in salesforce at the begning of the list/set
any help can be appreciable.

Could you please explain me how to bypass a validation rule in the below trigger. The validation rule is to restrict the users not to change the Status manually. The trigger changes the status if they upload a file. I have created a checkbox called "On and OFF" but couldn't figure out how to include.
rigger FileUploadonLead on ContentVersion (after insert) {
map <id,string> lmap = new map <id,string>();
    list<lead> leadlist = new list <lead>();
    for(contentversion cv : trigger.new){
        id x = cv.FirstPublishLocationId;
        if(string.valueof(x.getsobjecttype()) == 'lead'){
            system.debug('inside test');
    for(Lead l : [SELECT Id,Status FROM Lead Where Id IN : lmap.keySet() AND Status = 'Engagement']){
    system.debug('lmap.get() '+ lmap.get(l.id) );
        l.status = lmap.get(l.id);
        system.debug('leadlist ' + leadlist );
        update leadlist;

We have noticed that our live org is failing to display any of the detail pulled from our API. There is a lot of functionality which isn't working and we have countless errors in our ErrorLog which we cannot decipher. This has been ongoing for a while now and we are currently lacking business critical functionality. Without a technical background, we are unable to fix this ourselves. Please see the below screenshots:
User-added imageUser-added image
Hi to all, I have an aura component, i developed it in sandbox, and it fully works, if passed to the test environment when I try to open it i've got the following error:
sforce is not defined

The function that is responsible is this:
editPanel: function(cmp, evt, helper) {
        var params = evt.getParams();
        if (params.label) {
                label: params.label

in the sforce.opencti part,
I tried to import connection.js and apex.js, but still no luck, can anyone help me to find out why this happens?
Thanks in advance, Antonio.
I have a custom object to track Call Logs in my app. This object contains a Date field to track the call date. I need a batch class to even out the call logs so that number of calls entered will be balanced per day. Suppose I have log count per day like the following :
Day 1 - 20 calls
Day 2 - 10 calls
Day 3 - 30 calls
I need to update this to:
Day 1 - 20 calls
Day 2 - 20 calls
Day 3 - 20 calls
Since I have to manually update each log date to accomplish this I have trouble writing a bulkified code. Is there any standard algorithms for such a use case. This scheduled class can be run on a weekly or monthly basis.

I want to update external system , with the fields that are updated on account ?

Basically , what I require is an update Account button on Account screen, which updates fields in external system on click.

I understand its through REST APi , but i somehow dont know how to code for it

Hi All,

I want to get previous page URL from the current visualforce page or from the controller class of the current VF page so that I can extract the id from the URL.

I am display this VF page from a list button created on 'Opportunity products' object in Lightning. 
I am new to SFDC, I have a program where I'm passing the values and I need to compare these values with a custom object field where it is present or not.

Here is my code,
public class CheckUtility {
        public static ID determineFeature(ID defaultPersonaID, String Email, String Industry, String Title, Decimal Revenue, Integer EmployeeCount) {
            ID fetrID = defaultFeatureID;
            String emailDomain = Email.split('@').get(1);           
            Feature__c[] features = new Feature__c[]{};
            features = [Select id, Industries__c, Title_Tags__c, Email_Domains__c, Company_Revenue_From__c, Company_Revenue_To__c, Employee_Count_From__c, Employee_Count_To__c FROM Feature__c ORDER BY lastModifiedDate DESC];
            Integer industriesFound = 0;
            for (feature__c p: features) {
         // checking if there is a matching feature based on email    
            System.debug('Email Domains = ' + p.email_domains__c);        
                 if (p.Email_Domains__c != null &&     
            p.Email_Domains__c.contains(emailDomain)) {
                     fetrID = p.ID;
                 if(p.Industries__c != null){ 
      //I am stuck compare the industry is present or not in the p.Industries__c (picklistdatatype)

                   System.debug('Industries' + p.Industries__c);        
                     fetrID = p.ID;
            return fetrID;      
I have Feature__c is a custom object. Feature__c.Industries__c custom field can have one value or multiple values.

ex:  Feature__c (object)
       id             | Industries__c
    a010b00000eERj4   | technology
    a010b00000eEYu4   | finance, biotechology
    a010b00000eHJj8   | chemical, healthcare, technology
input: technology
output : a010b00000eERj4 , a010b00000eHJj8

I want to check whether Industry (which is coming via value passed in determineFeature  ) is equal with how many Industries__c in Feature__c and send their fetrID's in response.
  • September 17, 2018
  • Like
  • 0