Forum
Community Login
Infusionsoft Community
Welcome, Guest
Please Login or Register.    Lost Password?
Programmatically obtaining custom field names? (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: Programmatically obtaining custom field names?
#8341
mmdurrant (User)
Junior Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Programmatically obtaining custom field names? 3 Weeks ago Karma: 0  
Is there a way to programatically obtain custom field names? Right now, the only way I know is to use brute force - trying _FieldLabelWithoutSpaces,_FieldLabelWithoutSpaces0,_FieldLabelWithoutSpaces2

... and that seems downright silly. Any suggestions?

Michael
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#8349
nonickch (User)
Senior Boarder
Posts: 36
graphgraph
User Offline Click here to see the profile of this user
Re:Programmatically obtaining custom field names? 2 Weeks, 6 Days ago Karma: 1  
unfortunatelly there doesn't seem to be one.

I've trying to find such a thing for over 6 months, no go.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#8357
techportal (User)
CMAC
Posts: 226
graphgraph
User Online Now Click here to see the profile of this user
Re:Programmatically obtaining custom field names? 2 Weeks, 5 Days ago Karma: 7  
It can be done... sort of...

Code: :

  $retFIELDS = array('Id','FormId','GroupId','Label','Values'); $query     = array('Id'=>'%'); $arrTEST $myApp->dsQuery('DataFormField'10000$query$retFIELDS); echo ""print_r($arrTEST); echo "";



The only caveat is... to get the actual **field name**, we're still waiting for one more table to be exposed through the API, the same one that was "promised" to me a few months ago.

With the above code, you will see all the custom form **labels**, which you can normally convert to the field name itself by removing all spaces and underscores.

However, if anyone using your Infusionsoft application has made any changes to the custom fields, then all bets are off.

The reason is that Infusionsoft makes backups of those changes and the backups keep the original names whereas the originals get renamed.

It's a very screwy logic but that's the way it's done.

Back to the above code...

If a custom field label comes up more than once, you can be sure that changes were made to the custom field. You can then start counting...

After the first change, your custom field will have been renamed to "customfield0". After the second change, "customfield1". And so on.

The obvious solution would be for Infusionsoft to expose one additional table through the API, which would then enables to look up custom fields but also to **create** them through the API. The method provided for that purpose doesn't work because they forgot to expose that one crucial table.

The sad thing is that this stupid little oversight to which no one will admit and no one will rectify is stopping many features from being implemented through the API. Sad.

They may have already exposed it and I may have to eat crow, but from the documentation available I don't see that change having taken place.

Good luck!

Best,
Bob
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/11/01 20:59 By techportal.
 
Bob Keen
https://www.InfusionWP.com - TurboCharge InfusionSoft with WordPress Membership Sites!

http://www.infusionsoftkunaki.com - Full Kunaki/Infusionsoft Gateway Solution

http://infusionsoft1clickupsell.com/ - Don't miss a launch and don't lose a single sale
  The administrator has disabled public write access.
#8369
mmdurrant (User)
Junior Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:Programmatically obtaining custom field names? 2 Weeks, 5 Days ago Karma: 0  
I've looked through the documentation back and forth and I came up empty-handed just like you. Here is what I ended up doing...

Get a test contact from the database so I can test if fields exist on a valid contact
Loop through the DataFormFields
Perform a DataService.Query on the test contact, using the Label of the DataFormField, minus spaces, slashes, underscores, and other undesirable characters.
If the query succeeds, add field name to list of valid field names.
If it returns error 4 (Database error) or 10 (Field not found) - I can't get it to return either consistently - add a "0" to the field name and try again.
Increase the number by 1, testing the field every time.
If we get to 9, we decide that the field is not a valid field and move to the next DataFormField.

...

Yeah. It works... but seriously?
Wouldn't exposing the actual field name through the API be a little easier??? Am I making this too difficult?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#8373
techportal (User)
CMAC
Posts: 226
graphgraph
User Online Now Click here to see the profile of this user
Re:Programmatically obtaining custom field names? 2 Weeks, 5 Days ago Karma: 7  
Yes, we just need the one table exposed... just one more table which has no real reason for not being exposed as it contains no critical information.

Within my own application, I can create a test user but most of my work is for customers. I can't ask every customer to create test users will imaginable custom fields.

I think we agree: these workarounds are no solution.

To make matters worse, in a copy of what seems to be the new SDK, both custom field methods have been dropped. It looks like API support for custom fields is a thing of the past.
 
Report to moderator   Logged Logged  
 
Bob Keen
https://www.InfusionWP.com - TurboCharge InfusionSoft with WordPress Membership Sites!

http://www.infusionsoftkunaki.com - Full Kunaki/Infusionsoft Gateway Solution

http://infusionsoft1clickupsell.com/ - Don't miss a launch and don't lose a single sale
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop