• saulosb
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Paradigma

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I'm using the salesforce upsert component, but the field lookup field is getting empty. The field in the related object is an external ID, since I am using a product code and not the salesforce id.
The csv is apparently correct.
Who do you have any idea?

Process
User-added image
Conf. Upsert
User-added image

Conf csv
User-added image

Related object
User-added image

Account
User-added image
Hi

I am as a problem to know the difference between two dates.

datainicial: 2016-09-19 00:00:00
datafim:2016-09-20 00:00:00
public static integer calcula(String id,DateTime datainicial,DateTime datafim){
	  	BusinessHours bh = [SELECT id  From BusinessHours Where id=:id];
		
		Long businessDiff = BusinessHours.diff(bh.Id, datainicial, datafim);
		System.debug('businessDiff:'+businessDiff);
		String strDataInicial = datainicial.format('EEE');
        String strDataFim = datafim.format('EEE');
        System.debug('strDataInicial:'+strDataInicial);
        System.debug('strDataFim:'+strDataFim);  
		Long seconds = businessDiff / 1000;
		Long minutes = seconds / 60;
		Long hours = minutes / 60;
		Long dia = hours / 24;
		System.debug('diaCalculado'+dia);
		
		return dia.intValue();
  	}
The code is putting the start date to Sunday and it is a Monday, so I'm always with return 0.
Anyone know how to solve?

 
  • September 19, 2016
  • Like
  • 0
Hi

I am as a problem to know the difference between two dates.

datainicial: 2016-09-19 00:00:00
datafim:2016-09-20 00:00:00
public static integer calcula(String id,DateTime datainicial,DateTime datafim){
	  	BusinessHours bh = [SELECT id  From BusinessHours Where id=:id];
		
		Long businessDiff = BusinessHours.diff(bh.Id, datainicial, datafim);
		System.debug('businessDiff:'+businessDiff);
		String strDataInicial = datainicial.format('EEE');
        String strDataFim = datafim.format('EEE');
        System.debug('strDataInicial:'+strDataInicial);
        System.debug('strDataFim:'+strDataFim);  
		Long seconds = businessDiff / 1000;
		Long minutes = seconds / 60;
		Long hours = minutes / 60;
		Long dia = hours / 24;
		System.debug('diaCalculado'+dia);
		
		return dia.intValue();
  	}
The code is putting the start date to Sunday and it is a Monday, so I'm always with return 0.
Anyone know how to solve?

 
  • September 19, 2016
  • Like
  • 0