Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!
SOLVED

Mark Status Timestamp In Field

Avatar

Level 5

How would I modify this code from @Doug_Den_Hoed__AtAppStore to reflect a single status change. For instance when a project goes into status "On Hold". Everytime I try and do it myself it updates using $$NOW time when another field is being updated, am banging my head against my desk (metaphorically) trying to figure this out, please help. I modified $$NOW to show UTC time to create a scenario in Fusion using this field.

 

Target:

{status}

 

Target History:
LEFT(IF(LEFT(Target History,LEN(IF(ISBLANK({Target}),"-",{Target})))={Target},Target History,CONCAT(IF(ISBLANK({Target}),"-",{Target})," (",$$NOW,") | ",{Target History})),2000)

 

Modified $$NOW time UTC:

CONCAT(
YEAR($$NOW),"-",
IF(MONTH($$NOW)<10,CONCAT("0",MONTH($$NOW)),SUB(MONTH($$NOW),7)),"-",
IF(DAYOFMONTH($$NOW)<10,CONCAT("0",DAYOFMONTH($$NOW)),DAYOFMONTH($$NOW)),"T",
IF(HOUR($$NOW)+7>24,CONCAT("0",SUB(HOUR($$NOW),24)),IF(HOUR($$NOW)+7<10,CONCAT("0",HOUR($$NOW)+7),HOUR($$NOW)+7)),":",
IF(MINUTE($$NOW)<10,CONCAT("0",MINUTE($$NOW)),MINUTE($$NOW)),":",
IF(SECOND($$NOW)<10,CONCAT("0",SECOND($$NOW)),SECOND($$NOW)),".000Z")
)

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 6

@Lawson02 

 

here is an example of a one-time-set calculated field

 

IF(
   ISBLANK({DE:status set to NEW})&&{status}="NEW", 
   $$now,
   {DE:status set to NEW}
)

 

The logic is simple: If the field is blank and the current status is NEW - set the field to $$now, otherwise, keep the value (literally, re-set it to its current value)

If you want to get more fancy, format your own date/time string (pain in the neck but i needed to see seconds for testing)

 

IF(ISBLANK({DE:status set to NEW})&&{status}="NEW", IF(MONTH($$NOW)<10,"0","")+MONTH($$NOW)+"/"+IF(DAYOFMONTH($$NOW)<10,"0","")+DAYOFMONTH($$NOW)+YEAR($$NOW)+" "+IF(HOUR($$NOW)<10,"0","")+HOUR($$NOW)+":"+IF(MINUTE($$NOW)<10,"0","")+MINUTE($$NOW)+":"+IF(SECOND($$NOW)<10,"0","")+SECOND($$NOW),{DE:status set to NEW})

 

I had 3 fields and timestamped on NEW, INP and CLS - these stay the same even when I press recalc, or otherwise edit the issue.

one-time-set-status.png

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

@Lawson02 

 

here is an example of a one-time-set calculated field

 

IF(
   ISBLANK({DE:status set to NEW})&&{status}="NEW", 
   $$now,
   {DE:status set to NEW}
)

 

The logic is simple: If the field is blank and the current status is NEW - set the field to $$now, otherwise, keep the value (literally, re-set it to its current value)

If you want to get more fancy, format your own date/time string (pain in the neck but i needed to see seconds for testing)

 

IF(ISBLANK({DE:status set to NEW})&&{status}="NEW", IF(MONTH($$NOW)<10,"0","")+MONTH($$NOW)+"/"+IF(DAYOFMONTH($$NOW)<10,"0","")+DAYOFMONTH($$NOW)+YEAR($$NOW)+" "+IF(HOUR($$NOW)<10,"0","")+HOUR($$NOW)+":"+IF(MINUTE($$NOW)<10,"0","")+MINUTE($$NOW)+":"+IF(SECOND($$NOW)<10,"0","")+SECOND($$NOW),{DE:status set to NEW})

 

I had 3 fields and timestamped on NEW, INP and CLS - these stay the same even when I press recalc, or otherwise edit the issue.

one-time-set-status.png

 

Avatar

Level 5

Thanks for the quick response. Is it possible to add, if status changes from NEW, set back to blank?

Avatar

Level 6

Not sure i understand the rationale - but this formula will set the field to a dash if the status is not NEW

( setting a calculated field to emptystring doesn't work )

IF(
   {status}!="NEW",
   "-",
    IF(
       (ISBLANK({DE:status set to NEW reset}) || {DE:status set to NEW reset}="-")&&{status}="NEW", 
       IF(MONTH($$NOW)<10,"0","")+MONTH($$NOW)+"/"+IF(DAYOFMONTH($$NOW)<10,"0","")+DAYOFMONTH($$NOW)+"/"+YEAR($$NOW)+" "+IF(HOUR($$NOW)<10,"0","")+HOUR($$NOW)+":"+IF(MINUTE($$NOW)<10,"0","")+MINUTE($$NOW)+":"+IF(SECOND($$NOW)<10,"0","")+SECOND($$NOW),
       {DE:status set to NEW reset}
    )
)

 

Avatar

Community Advisor

TIP:
This is a good example of how to set a calc field to do it's thing once and then not change again, keeping it's original first calculation.

I use the same logic to see if a task was copied from another project. On my global task form I set a calc field to record the task>projectID and then never change, so when I see one that doesn't match the current projectID, I know it was copied from another project and I know which project it was copied from. Thanks Sven.