Skip to main content
Question

Another day another expression


Daniel Söderlund
Skilled Expert
Forum|alt.badge.img+14

Hi,

This is just a test/concept 

I have setup a SI for end user( application owners and other key employee)  to request a Announcement in Freshservice. I use API to create the Announcement. 

The form looks like this, 

I have this 2 expressions to correct that the requester manage to set a earlier date. 
Sets current date and time

if('{{ticket.ri_205_cf_visible_from_iso}}' < now('Europe/Stockholm'),
    now('Europe/Stockholm'),
    '{{ticket.ri_205_cf_visible_from_iso}}'
)

and for To,  it adds 1 hour to the current date/time.

if('{{ticket.ri_205_cf_visible_to_iso}}' < addHours(now('Europe/Stockholm'),1),
    addHours(now('Europe/Stockholm'),1),
    '{{ticket.ri_205_cf_visible_to_iso}}'
)

It works just fine. I know I need to make some more checks for if the To value is earlier then the From date if the first expression sets current date. Have added a business rule that prevent the requester to set a earlier to date then from date. 

But I had a idea that the requester don’t have to select the start date or end date and the WFA would set now and now+1.  Started with the From date but ran in to a wall. 

if('{{ticket.ri_205_cf_visible_from_iso}}' == '',
    now('Europe/Stockholm'),
    if('{{ticket.ri_205_cf_visible_from_iso}}' < now('Europe/Stockholm'),
        now('Europe/Stockholm'),
        '{{ticket.ri_205_cf_visible_from_iso}}'
    )
)

Gives me an error when I test it 
 

I could press Done and just go with it but when I requested the item I see this in the logs 

if('2023-07-10T22:00:00.000Z' == '', now('Europe/Stockholm'), if('2023-07-10T22:00:00.000Z' < now('Europe/Stockholm') ,now('Europe/Stockholm'),'2023-07-10T22:00:00.000Z')) - text	


 

Did this topic help you find an answer to your question?

0 replies

Join the Community or User Group to Participate in this Discussion

Reply