Jump to content

Integration Call (Convert Date/Time)


SJEaton
 Share

Recommended Posts

Hi All

I'm trying to configure a workflow so that it takes the Date/Time entered in a question on the procap and converts it to the format dd/mm/yy hh:mm so that it looks nice in an autoemail that is then generated.

I've done a similar thing before where I converted just the date (see attached) but can some please advise me what to enter in the input and output formats if the field I am converting is a date/time picker?  Also if in this instance the custom field is h_custom_e do i just replace CustomFieldA with CustomFieldE in the example below?  

Thanks

Sam

 

Capture.PNG

Link to comment
Share on other sites

Hi Sam,

I haven't tried using this to convert a Date/Time field, only a date field so I can't say if if it works or not.  But there is a help icon on some of the operations that can provide some info to help you out.

image.png

 

It suggests the following page for the input formats: http://php.net/manual/en/function.date.php

I will do my best to test this out, but do let me know if you manage to get this working

Regards,

James

Link to comment
Share on other sites

@SJEaton the date/time value in the custom field is stored as YYYY-MM-DD HH:MM:SS. This is the, let's call it, calendar date/time format,that needs to be "translated" into the integration node date/time format (PHP date formatter) for "Input format" field. So, looking at the PHP date formatter page (http://php.net/manual/en/function.date.php) we have the following:

  • for YYYY - the format we need is: Y - a full numeric representation of a year, 4 digits
  • for MM - the format we need is: m - numeric representation of a month, with leading zeros
  • for DD - the format we need is: d - day of the month, 2 digits with leading zeros
  • for HH - the format we need is: H - 24-hour format of an hour with leading zeros
  • for MM - the format we need is: i - minutes with leading zeros
  • for SS - the format we need is: s - seconds, with leading zeros

So the input format should be (taking into consideration dashes, colons and spaces):

Y-m-d H:i:s

Have you tried this input format? (EDIT: the case is important here as the format is case sensitive)
 

P.S. Apologies, I did not have chance to look at the example you posted, but I thought to confirm the input format that is being used...

Link to comment
Share on other sites

Hi @Victor, you mention YYYY-MM-DD HH:MM:SS and d/m/Y H:i:s as both the input field so I'm a bit confused.  Should one of these be the output format?

I tried it with YYYY-MM-DD HH:MM:SS as the input format and d/m/Y H:i:s as the output format but it didn't work? (still pulled through as undefined)

Sam

Link to comment
Share on other sites

@SJEaton I mentioned "YYYY-MM-DD HH:MM:SS" being the format in which the date value is stored in the custom filed. You only use this information to help you build the correct input format for the conversion node.

So, if the date value is stored in the custom filed as 4 digit year(dash)2 digit month(dash)2 digit day(space)2 digit hour(colon)2 digit minute(colon)2 digit second then you sort of "translate" this into the input format according to the format used by PHP Date format. So, going back to the definitions I made in my previous post, the above becomes, in the input format for the conversion node: Y-m-d H:i:s (which is what I said in the above reply should be used as input format).

You might have noticed I haven't mentioned anything about the output format. The output format will be whatever format you need to be displayed in the email. If you want the slashes instead of dashes and have the day, month then year displayed, then the output format (again, according to the format used by PHP Date format ) would be: d/m/Y. If you want to add the time information to this, then output format becomes: d/m/Y H:i:s... if you don't need the seconds then only use d/m/Y H:i ...etc. You can adapt the output format as needed.

Does this make sense?

Link to comment
Share on other sites

@SJEaton  I looked at SR00017505 could not see anything wrong and then I had to run another test (SR00017761 - which I cancelled, sorry for the notification email) as I could not understand why it would not work... then looking at the process I see that you don't actually capture (or get) the value for the custom filed prior to pass it to the conversion node...  you can see what I mean if you try to set the value for the Date parameter using the flowcode variable picker:

image.png

As you can see, there is no flowcode that would give you the custom E field variable... the "&[global["flowcode"]["customFieldE"]]" ... therefore it will be "undefined". Perhaps the value for the Date parameter was manually typed in or copy/pasted from somewhere else? If yes, then I would advise against this practice, best way would be to always use the variable picker to make sure the variables are available to the node...

So, to summarise, your process needs a "Get Request Information - Request Details" node somewhere before the conversion node. Once this is done you will see the variable picked for the Date parameter in the conversion node will have a variable for custom filed E...

Link to comment
Share on other sites

  • 1 year later...

Hello,

Jumping on this bandwagon... very late (I hope that's ok).

I am struggling to convert the Integration Calls - Utlities\Get Timestamp (14 days from now) format from

2019-03-21T10:37:53.000Z
to 
21-03-2019

Using the Integration Call Utilities\Date Formatter

I have the following Integration node to get the date in 14 days from now:
1677468175_GetDate.png.fb65c4030e007552099ffcbb9d179f30.png

 

I am then using another Integration Call to convert the format of this date... this is what I have so far:
image.png.d2294ef039dc9ce4748cb56489b339dc.png

 

I am then attempting to update the timeline with &[global["integration"]["date"] (as per the variable picker)... but it comes back empty/blank in the timeline.

Can someone advise? I have a feeling it has something to do with the input format...

Thanks,

Samuel

Link to comment
Share on other sites

54 minutes ago, samwoo said:

I have a feeling it has something to do with the input format...

Search your feelings; you know it to be true!

This should work fine:

image.png

 

If not, try and use the SQL timestamp variable: &[global["integration"]["timestampSql"]]

 

 

Link to comment
Share on other sites

22 hours ago, Victor said:

Search your feelings; you know it to be true!

This should work fine:

image.png

 

If not, try and use the SQL timestamp variable: &[global["integration"]["timestampSql"]]

 

 

Hi @Victor,

Thanks for responding.

After playing around with this for ages using your suggestion, i finally got this to work!

The reason it wasn't working because the 2 integration calls had the same "Result Refrence" name in there... it appears there is no validation checks on this field when Publishing the BPM.

Please can I request this feature? I cant believe it took me that long to work it out though (facepalm)

Thanks for your help,

Samuel

 

Link to comment
Share on other sites

8 minutes ago, Victor said:

You can... However, I am no the one that can say if, how, when...

Glad to hear you worked it out :) 

Ok I would like to request that feature xD

Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...