I've got a field collection, which contains
A copy field
A user field, via entity reference
Now when I try to access the copy field by storing the collection in $collection, via
$collection->field_my_collection_copy->value();
I get what im looking for, but trying similar on the entity referenced field
$collection->field_my_collection_user->value();
It breaks. By looking into the variables for $collection->field_my_collection_user I should have 'uid' available on it, but $collection->field_my_collection_user->uid gives me nothing and $collection->field_my_collection_user->uid->value(); gives me Unable to get the data property uid as the parent data structure is not set
It could be because Field Collection doesn't inherently know what node type their parent is associated with.
Related
I have a store and a model with a hasMany association.
If I call Ext.getStore('SessionStore').removeAll() does it also remove any associated data with the records in the store?
If not, how would I do this?
if you console log a record in SessionStore you should have a property with the name of the association plus the suffix Store
e.g. if the name of the association is personalInformation there should be a new property in the record called personalInformationStore.
So the answer would be yes by removing a record or all from a store the associated data will also be removed as this data is part of the parent object.
Perhaps Ext.StoreManager.getCount() can help validate the existence of the data / objects.
I also recommend this chrome extension: https://chrome.google.com/webstore/detail/app-inspector-for-sencha/pbeapidedgdpniokbedbfbaacglkceae?hl=en
I am trying to update the memberUid property of the posixGroup.
I do a directory search and find my record. If I loop through the searchresults.property I can list the values (it is defined as Multi-value) of the field.
I define a DirectoryEntry using the searchresults.getdirectory method.
If I do anything with the property from this directoryentry, for instance check if it exists (property.contain), or list it or try to update it I get an unknown error x'8000500C'.
The fields cn and description' do not cause this problem.
If I add other user defined properties I also get the error.
How can I work with properties belonging to this type of schema?
Your error looks like it is:
8000500c The Active Directory datatype cannot be converted to/from a native DS datatype
This seems to imply that the data returned is not a native AD datatype.
There seems to be a workaround at this article.
I have a database of finance info and i want to check that supplied totals 'add up'. I have added fields to the database for the check data and am using data binding via the Entity Framework. How do i populate these 'check' fields while the user is adding data to the record?
Eg The form contains SubtotalA, SubtotalB and TotalAB textboxes. The database has these fields plus CheckTotalAB. The user keys in SubtotalA, SubtotalB and TotalAB from a hard copy form. I want to populate CheckTotalAB with the sum of SubtotalA and SubtotalB to compare against the provided TotalAB.
I first tried getting the data from the textboxes. Unfortunately txtSubtotalA.Value doesn't exist.
I then thought I'd have to go to the entity itself. Unfortunately I don't know how to access the current record/entity being entered and if I did, how would I access the value of fields that haven't been saved yet.
Can someone point me in the right direction?
tia
mcalex
Accessing the entity was the answer. This was accomplished through use of an entity property in the datacontext that i set to equal a class member i added to my form class.
After that getting to the entity's fields including my calculated fields was just a case of getting/setting the member's properties.
I have been tinkering with this problem and trying to research for a few hours. I am still getting familiar with the entity API for Drupal 7, and have been trying to work with PHP but to no avail--I think I am missing something VERY obvious as a result of my tired brain over-thinking things.
I have two Content Types, CT1 and CT2. CT1 has a field that can hold multiple Field Collection values. In this Field Collection (field_coll_ct2) one of the fields (field_ct2_ref) is an Entity Reference to a node of content type CT2.
Now, when I am looking at a single node of type CT1, I want a block View that will show me all of the CT2 nodes referenced in that CT1 node's field_coll_ct2 field collection field.
My primary approach, which has worked on non-field collection fields of the same kind of relation, is to add a contextual filter to the view on Content:NID. From there, since it is a block and URL parameter passing is out of the question (there are so many of these kinds of relations between 7-8 different content types, at different tuples per node, it is absolutely not feasible to use the URL for parameter-passing) I have it set to 'Provide default value' of type 'PHP' and 'allow multiple values' and here is where it gets hairy.
I need to get all of the field_ct2_ref entity references in the currently-viewed node's field_coll_ct2 field collections. I've tried using:
$wrapper = entity_metadata_wrapper($entity_type, $entity);
return $wrapper->field_coll_ct2->field_ct2_ref->value();
or
$node=menu_get_object();
foreach ($node->field_coll_ct2['und'] as $record)
{
$values[]= $record['value'];
}
foreach($values as $val){
$tgts[]=$val['every'][index]['possible'];
}
return $tgts[omg];
and probably close to a hundred variations of the above trying to get it to return something that vaguely resembled an entity reference to a CT2 type node.
I can't seem to dig deeply enough into the entity/field references to get to the field_ct2_ref['und'][0]['target_id'] that has worked for all non-field collection fields with this kind of relationship. Or I get AJAX errors telling me 'Unknown data property field_coll_ct2' or console errors saying that every index I try to throw at these array objects (to even just get ONE of the values) is wrong.
Is there an easier way of doing this? Am I missing something simple and obvious--either in the way I'm implementing my View or the PHP itself?
For what it's worth, I've been able to narrow down the view results without any contextual filter by selecting a relation to 'Referencing Entity: field_ct2_ref' but it shows ALL CT2 nodes referenced by ANY CT1 type node rather than the specific CT1 type node I'm looking at.
Thank you!
I'm trying to get over a limitation in Salesforce where Lead objects can't have related lists that convert with the Lead over to Opportunity, Contact and Account. I have set up 4 objects of type Lookup Relationship, and created a dummy record in each.
I want to use Custom Settings to store the id of each of these dummy records, so that when the Lead converts, any custom objects can also convert to objects with Master/Detail relationships on the respective standard objects.
My trigger on Lead(after update) tries to create a Map of the Custom Settings:
Map cs = AcctId__c.getAll();
AcctId__c is the Custom Setting api name. Compile time is giving me the above message.
Now, I copied this code directly from the Salesforce documentation. What am I forgetting?
I believe that you must include the actual map definition <String,AcctId__c> after the word Map.
Check out this page.
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_collections_maps.htm