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