You need to sign in to do that
Don't have an account?
SFDC org
Trigger calculation Help
Hi,
I have 3 fields
1)Lab_Process_Time_Days_HH_MM__c -> Text Data type
2)eDNA_Created_On__c -> Date/Time
3)Sample_Received_On__c ->Date/Time
I want the first field "Lab_Process_Time_Days_HH_MM__c" to be calculated automatically in this way
Lab_Process_Time_Days_HH_MM__c =eDNA_Created_On__c -Sample_Received_On__c
Please help me hw to do it.
Thanks in Advance
why not make Lab_Process_Time field a formula field?
then you just need to do this:
i am not able to change the data type of Lab_Process_Time from text to formula
However when i am, trying to create a new formula field and try to use the same formula its giving the following error
"Formula type is of datatype(number), incompatible with current datatype date/time",
Kindly advice me wat to do further.
Thanks
have you set your formal format type as a number?
If your formula datatype is text then you will need add
TEXT((test21__c - test22__c) * 24)
Hi,
When i do the same , i see the value as
Hi,
I just want to calculate the difference betwn these 2 dates
(eDNA_Created_On__c -Sample_Received_On__c) display the value of "Lab_Process_Time_Days_HH_MM__c " in a date/time format.
The previous one wasnt working its displaying it in a number
you will then need to do something like this:
https://success.salesforce.com/ideaView?id=087300000006nml
yes but i should also get the value for date alng with time
Please help me sir, got struck wen i use the same formula in the below link its not working
Thanks
IF(DATEVALUE(LastModifiedDate ) <> TODAY(),
/* If TRUE */
IF(
/* Is same business week? */
AND(
(CASE(MOD( DATEVALUE(NOW())- DATE(1985, 1, 5), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)
+ CASE(MOD(DATEVALUE(LastModifiedDate ) - DATE(1985, 1, 5), 7), 0, 0, 1,
5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)
>5),
DATEVALUE(NOW()) - DATEVALUE(LastModifiedDate ) < 6 ),
/* Then work out the number of business days with this formula */ CASE(MOD(DATEVALUE(NOW()) - DATE(1985, 1, 5), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)
+ CASE(MOD(DATEVALUE(LastModifiedDate ) - DATE(1985, 1, 5), 7), 0, 0, 1,
5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)
- 6,
/* Otherwise use this formula */
FLOOR(
(DATEVALUE(NOW())
-(DATEVALUE(LastModifiedDate )
+ CASE(MOD(DATEVALUE(LastModifiedDate ) - DATE(1985, 1, 5), 7), 0, 0, 1,
6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))
)/7)*5
+CASE(MOD(DATEVALUE(LastModifiedDate ) - DATE(1985, 1, 5), 7), 0, 0, 1,
5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)
+CASE(MOD( DATEVALUE(NOW()) - DATE(1985, 1, 5), 7), 0, 0, 1, 0,
2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)
),
/* If FALSE */
0)
+
/* Compensate depending on start and end time */ IF(
/* End datetime's time of the day in minutes referred to 0:00 GMT */ VALUE(LEFT(RIGHT(TEXT(DATEVALUE(NOW())),9),2))*60 +
VALUE(LEFT(RIGHT(TEXT(DATEVALUE(NOW() )),6),2))
/* Start datetime's time of the day in minutes referred to 0:00 GMT */ < VALUE(LEFT(RIGHT(TEXT(DATEVALUE(LastModifiedDate )),9),2))*60+VALUE(LEFT(RIGHT(TEXT(DATEVALUE(LastModifiedDate )),6),2))
, -1, 0)