Friday, 31 May 2013

Updating InfusionSoft Custom Fields

This is a quick post, and I'm writing it mainly because I wasted a lot of time trying to programatically update custom fields in Infusionsoft. So here goes, if you need to update a custom field you need to know the id of the field and the new value:

 updateCustomField($fieldId, $fieldValues)  

You can find the id of the field by going to Admin -> Settings -> Set up custom fields for -> Go and when you hover the field you are interested into you will see the id.
Getting the value is more tricky. What works on any type of field is setting a value manually and then querying DataFormField for the value like this:
  
 $returnFields = array('DataType', 'Id', 'FormId', 'GroupId', 'Name', 'Label', 'DefaultValue', 'Values', 'ListRows');   
 $query = array('Id' => custom_field_id);   
 $res = $sdk->dsQuery("DataFormField", 10, 0, $query, $returnFields);   
 var_dump($res);   
In the result above, have a look at the "Values" field, this is how it should look like.
So to conclude, if you need to update a listbox custom field, this will do it: 

 $values = array(  
     'Values' => "\naaa\nbbb\nddd"  
 );  
 $result = $sdk->updateCustomField(custom_field_id, $values);  

5 comments:

  1. Thanks for sharing such beneficial information with us. Your article is really very enjoyable while reading and please keep sharing more.

    Kaseya | Infusionsoft

    ReplyDelete
  2. We are a company that specializes in cleaning homes from the inside and outside, and we also have a home sterilization service. Click on شركة تعقيم دبي And also sterilize
    homes in the city of Sharjah, too, press شركة تعقيم في الشارقة and شركة تعقيم في عجمان and شركة تعقيم في راس الخيمة With the best materials for comprehensive cleaning and sterilization from viruses harmful to humans .


    شركة تعقيم منازل في عجمان
    شركة تعقيم في الشارقة
    شركة تعقيم دبي
    شركة تعقيم في راس الخيمة
    خطوات تنظيف المنزل

    ReplyDelete
  3. شركة تعقيم بالاحساء
    والتى لها دور كبير فى عمليات التطهير والتعقيم فى الكثير من الأماكن فى كافة أنحاء المملكة العربية السعودية وليست الإحساء فقط.

    ReplyDelete
  4. أفضل شركات توزع ارباح ربع سنوي أمر يشغل العديد من الأشخاص باعتبارها الاختيار الذي يحقق الهدف

    ReplyDelete