Create Lead with PeopleForm WITH DateTime field

First - I know this may be a dumb question, and I’m NOT a very seasoned developer…so please be gentle :slight_smile:

I’m trying to create lead records in Suite via posting a form to the webform endpoint:
http://{{mydomian}}/index.php?entryPoint=WebToPersonCapture

I’m trying to pass in a datetime field (ie. Lead Appointment Date), but I’m struggling to get it to work.
I’ve already created the datetime field in the Lead module.
I’m seeing 2 issues:

#1 - it seems that you can not use a date time field in the webform builder. I think that this is a known issue…and I’m guessing it’s not easily solvable. I don’t strictly need to use the form builder, but I was using it to dump out the ‘format’ of the data/fields so I can match that format when sending data to that endpoint. So I’m guessing this is not the way to go…

#2 - so the ‘real’ issue I may be having is that I’m not ‘formatting’ the datetime correctly?
I’ve tried MANY different formats…but I ‘think’ the format it’s expecting is:
2016-04-15T18:47:00-05:00
but this seems not to work either.

I know that I likely “should” use the new API, rather than curl-ing over to the webform endpoint…but is there an easy solution to what I’ve already set up??

Any thoughts???

Thanks all!!!

Hi, @TobyTkd!
Welcome to community!

You should use format date which actually for user who generated the form in SuiteCRM.

Thanks for the welcome!

Not sure I understand what you’re saying??

I’ve created a “datetime” field in the Lead module using the Studio.
I’ve not done anything to change the format of that field…but, I’m not able to add that field to the Person Creation form in SuiteCrm.

So, I’m posting to the form endpoint with custom script…but for some reason the datetime isn’t being accepted by the endopoint…and I can’t figure out why.
I’m “guessing” I don’t have the format correct…but not 100% sure.

Here is the format I’m sending…
2016-04-15T18:47:00-05:00

But, that seems not to work…

Any thoughts??

@TobyTkd
The webform endpoint:
http://{{mydomian}}/index.php?entryPoint=WebToPersonCapture
support only text type fields. If you want to use date you should load javascript which will make correctly the date field.

You can find the line in your webform:

<input name="campaign_id" id="campaign_id" type="hidden" value="44b3ae6c-fb59-40ca-f94b-5e294323c78f" /> <input name="assigned_user_id" id="assigned_user_id" type="hidden" value="ede8d6aa-3069-a5ff-98fd-5e108395c9ef" /> <input name="moduleDir" id="moduleDir" type="hidden" value="Leads" /></form>

Format of date field should be as which user (assigned_user_id) with id ‘ede8d6aa-3069-a5ff-98fd-5e108395c9ef’ use.

Thanks for helping with this…

Yes, I’m already using an outside process to send the POST to the endpoint. (PHP via curl)

I’m sending a string in the POST with this parameter:
demo_1_apt_text_temp_c=2016-04-15T18:47:00-05:00
(where demo_1_apt_text_temp_c is the custom field I’ve created)

However…the data seems not to populate that field…and I’m not sure why.
I’m guessing that the field may want a different format, but I’m not sure what that might be, or how to figure it out.

Thoughts??

Try to see what’s happening here

I wouldn’t be surprised to discover that it needs an additional if clause there, to check if the field is a datetime, to insert the value properly…

EDIT: also, check if it’s the $possiblePersonCaptureFields mechanism that is blocking your field.

@TobyTkd
You should look at format date of user (screenshot) who make the form. The variable of $_POST use format “01/04/2020 15:30” for this example.

Ahhhh!!!
Perfect!

I got it working now!

Yes - the format it was expecting is: 04/15/2020 18:47

Once I matched that format, the datetime field is being set correctly.

Thanks all!!!

1 Like