I've been searching for this solution but haven't found one! I'm using Novak solution's Infusionsoft API.
What I'm trying to do is to get value of a custom field for specific contact. Lets say, I've a custom fields named _myCustomField with Yes/No value. I've 200 contacts in my list but only 15 contact has value 'Yes' for _myCustomField. Lets say I've another custom field _myCustomField2. If I run following query:
$contacts = Infusionsoft_DataService::query( new Infusionsoft_Contact(), array('_myCustomField' => '1') );
I get an array of 15 records, BUT if I print $contacts array then I don't see _myCustomField or _myCustomField2 there.
So, how do I get value for those two custom field inside my loop? Can someone help me with this?
Thanks!
The second parameter of the query method is only the filter and does not tell Infusionsoft that you also want to return any custom fields.
You will want to add the custom fields first:
$contact = new Infusionsoft_Contact();
$contact->addCustomField('_myCustomField');
$contact->addCustomField('_myCustomField2');
$contacts = Infusionsoft_DataService::query( $contact, array('_myCustomField' => '1') );
Related
I have been struggled with my PHP script, I need to update a relationship type item in a app with Podio API php. Whe the field is "blank", does no work, I mean does not update the field, when it has a value it works, the item is modified with the new value, here is part of my code:
$item = PodioItem::get_basic($itemId);
$field_id = 'last-action-by';
$item->fields[$field_id]->values = array('item_id' => $contacto);
$item->save();
Any idea please?
You have to pass an empty array to "blank" a field,
$item->fields[$field_id]->values = array();
Finally I found the solution.- the problem was that I was passing in $contacto variable and email, and it should be the contact_id as an integer, so with that I resolve the problem, thank you for you comments!
I fetch data from podio CRM using PHP language and I fetch data for each element via its id as it is found in this function:
public function getContacts($item_id) {
$this->contactAuth();
$item = \PodioItem::get_by_app_item_id($podio_contact_app_id,$item_id);
return $item;
}
For example we have the 'Status' we show it like this:
$status = $item->fields[6]->values;
Not all elements get it right though it is the same function.
Sometimes :
$status = $item->fields[6]->values;
and sometimes :
$status = $item->fields[8]->values;
Can we know what caused the problem?
If some fields are empty they will not be presented in the PodioItem object, that is why the position of a particular field in the array may vary (like a Status field in your example).
So instead of using a field index (which may vary), you should get the value from a field by field's External ID (a human readable name like 'title', 'status' etc) or Field ID (a numeric code):
$item->fields['title']->values // 'title' is an External ID
$item->fields->get(123456789)->values // 123456789 is a Field ID
To know what External ID and Field ID are for a particular field you can list all fields like this:
// Iterate over the field collection
foreach ($item->fields as $field) {
// You can now work on each individual field object:
print "This field has the id: ".$field->field_id;
print "This field has the external_id: ".$field->external_id;
}
Or you can see developer's info on all fields right in Podio in App menu → Developer
And anyways, check the Podio PHP wrapper documentation at https://podio-community.github.io/podio-php/items/ it is pretty useful:)
I work on one project, users actively use PDF templates in CRM, the fact is that I need to get the field value in the SalesOrderPDFContoller.php file: I used this code:$this->focusColumnValue('input_name'); So I should get the value from the Products module, but instead of the value i get 0.
$this->focusColumnValue() is used to get Salesorder field value not Product value.
If you know the Product id you can use :
$recordModel = Vtiger_Record_Model::getInstanceById($id, 'Product');
$your_input = $recordModel->get('input_name') ;
I'm a newbie to web designing. I'm using contact form 7 to create a registration form for our conference.
All I wanted to do is, I need to give a unique id for all of them after they have registered for the conference and the further forms should be identified using this unique id.
So far, I have installed contact form 7 and contact form dtx
for this purpose and I have tried Koen de Bakker solution of generating a random number.
But it's slightly different from what I want, since it changes the random number for each refresh.
What I'd like is:
An unique number like "17ICLAA001,..." should be generated for each form submission.
Send the unique number to the applicant after successive submission of the form.(I hope this can be easily done once the shortcode is done).
Editing the form using the unique id.
Any help will be much appreciated. Thank you.
I have found a way to do this. Its just the number of rows+1 in the table.
When you add a record to your table the unique number also gets increased by 1 in the following code. Add the following function in function.php in your theme and use the short code "row_count" to call the function. Use it with dynamichidden text from dtx.
function row_count_shortcode() {
global $wpdb;
$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->username_wp1.SaveContactForm7_1" )+1;
return "17ICLAA".sprintf('%03d',$user_count);
}
add_shortcode( 'row_count', 'row_count_shortcode' );
Usually when you are creating contact forms using contact form7 it automatically creates a table in your database something like
username_wp1.SaveContactForm7_1
Instead of this replace your database table name.
So in your contact form, type
[dynamichidden uniqueid "row_count"]
and use [uniqueid] in your email body to serve your purpose.
It works fine. I have checked in my site.
Correct way to generate a unique and progressive number is to set a field in wp_option like this:
add_option('unique_number', '1');
When filter is called, you must simply increment this unique number:
function genTicketString() {
$currentUniqueNumber = get_option('unique_number');
$newCurrentUniqueNumber = $currentUniqueNumber + 1;
update_option('unique_number' $newCurrentUniqueNumber );
return $newCurrentUniqueNumber;
}
add_shortcode('quoteticket', 'genTicketString');
I am using google shopping Api from last one year it is working properly. But now I want to add new attributes in it such as CustomLabel5. For that I have used setCustomAttributes() method and passed three attributes name, type ,value.
But it is working showing error 400 invalid attribute values. following is my code please check and suggest proper answer for that.
$product = new Google_Service_ShoppingContent_Product();
$data= new Google_Service_ShoppingContent_ProductCustomAttribute();
$data->setName('CustomLabel5');
$data->setType('text');
$data->setValue('test');
$product->setCustomAttributes($data);
Please give answer.
Fairly simple fix here.
setCustomAttributes expects an array of Google_Service_ShoppingContent_ProductCustomAttribute instances.
What you need is:
$attributesArray = array($data);
$product->setCustomAttributes($attributesArray);