I have a salesforce query which returns contact information. I need to save the data in 2 tables. In the first table I have to store some metadata about the contacts in an intermediate state. I then get the auto-generated metadata table ID from the metadata saved and apply it to every contact. I then have to save the contact data into a database table and then finally update the contacts metadata to its final state. The problem is that there is a lot of data so I have to include a fetch size when performing this process. What I want to achieve should be something like this, please note this is only what I am looking to achieve. How can I know that the fetch contacts is complete, so that I can save the final state? How can I structure the flow for transactions?
Ideally, I would like to pass the ConsumerIterator to a Java component where I can easily control the process. Can I pass a reference of the ConsumerIterator to a Java component for example? If I can how can I do so?
<sfdc:query fetchSize="100" config-ref="sfdc-connector"
query="dsql:SELECT Id, Account.Id,
Account.Name, Account.PersonEmail, Account.LastName From Contact" />
dw:transform-message metadata:id="d1f6ab4f-4b40-4e30-ae" doc:name="trnsfm">
<enricher target="variable:metaInfo">
<flow-refname="getContactMetadata"/>
</enricher>
<dw:set-payload><![CDATA[%dw 1.0
.//Rest of transformer
<db:insert config-ref="MySQL_Configuration" doc:name="Save Metatdata">
...
</db:insert>
<db:insert config-ref="MySQL_Configuration" doc:name="Save contacts">
....
<db:insert>
<db:insert config-ref="MySQL_Configuration" doc:name="Update Metadata
Final State">
....
<db:insert>
</flow>
Problem Solved. I wrote a Java Component, implementing Callable and grabbed the ConsumerIterator. I then was able to use the iterator to obtain items in fetchSize. I then used Spring Jdbc since the data model is simple enough to transactionally save the data
Related
i have a small problem:
I coded a checklist for MS Dynamics 365 as a pcf component.
Now I have the problem that i can't save the data.
The Checklist's data is stored in a JSON format.
I want to store this JSON in the entity.
This is my property.
<property name="saveCheckList" display-name-key="datom_saveCheckList" description-key="Property_Desc_Key" of-type="SingleLine.TextArea" usage="bound" required="true" />
Can you please tell me how I store the data. Thank you!
If you need more informations do't worry to ask.
you need to ensure that the PCF method getOutputs returns the data being stored in your component code. For example, we store a JSON in the control and if we want the control to tell the Dynamics 365 to save the actual data, we use it like this:
/**
* It is called by the framework prior to a control receiving new data.
* #returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output”
*/
public getOutputs(): IOutputs {
// Our method to retrieve JSON.
let data = this.priceIndexationData.getData();
// And we tell the framework to save the JSON to bound property (declared in control's manifest)
return { priceIndexationData: data }
}
Manifest line of declaring the "priceIndexationData" in our case:
<property name="priceIndexationData" display-name-key="Price Indexation Data" description-key="ken_priceindexationdata field value." of-type="Multiple" usage="bound" required="true" />
If you navigate to account/contact/custom object we do have a related list "related content" (if content is enabled and related list is added to page layout).
My question is were are these "related content" records stored? in which object?
Using apex I'm able to upload file to content version, but not able to create or find the object which stores the "related content" information.
UPDATE
Tried to create a link to show up in "related content" section of account, but no success. Got error " Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, You cannot create a link for this type of entity through the api: [LinkedEntityId]"
Any idea?
ContentVersion cv = new ContentVersion(
versionData = EncodingUtil.Base64Decode(base64BlobValue),
Title = fileName,
PathOnClient = '/'+fileName,
FirstPublishLocationId = '058900000009KcL'
);
insert cv;
//fetch ContentDocumentId
cv = [Select Id,ContentDocumentId from ContentVersion where Id = :cv.Id];
insert new ContentDocumentLink(LinkedEntityId=parentId,ContentDocumentId=cv.ContentDocumentId,ShareType='V');
** USE CASE **
The use case is to allow user to attach content right from object detail page for eg say Account will have button say Attach Content, this will bring upload content page, once uploaded (i will create contentversion records - this is happening perfectly, no errors) and then I need to relate the uploaded content to account (from which request orginated) ie create "related content" records (here I'm facing difficulty, trying to create contentdocumentlink records but its erroring out).
The use case is just one click to attach content to account or opportunity instead of long current process were user goes to content, uploads there first and then comes back to account/opty and searches content again, and then attaches it to account/contact.
As you know the content is stored in the ContentDocument object and the links are stored in the ContentDocumentLink table.
I find that the http://workbench.developerforce.com really useful for figuring out these kinds of relationships.
See the ContentDocumentLink specification in the user docs, LinkedEntityId represents:
ID of the linked object. Can include Chatter users, groups, records
(any that support Chatter feed tracking including custom objects),
and Salesforce CRM Content libraries.
I'm thinking that based on that explanation, you can only create the ContentDocumentLink for Chatter based object fields, not for regular sObject records or custom sobjects, etc.
I am eager to know how status of Product in Magento get changed/saved?
Requirement-:
Suppose there are existing products which are enabled in Magento...Now If admin Disable particular product from Backend then I need to catch that particular product's Id through code in Magento file system?
So from where Can I get disabled product's id in Magento code? What is the file location & function name for the same? how Can I get that particular id?
Please guide me...
I think the down voting here is a bit unfair. The op is only asking one question - how to get the product id and status of a product after it has been saved.
#Sam - in Magento, instead of finding the exact point in code where a product is being saved, you would typically hook into an event by creating a custom module and use the Magento event/observer facility from within that module.
Have a look through this tutorial which will guide you through the process of creating a module with event/observers: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Specifically related to your question: the event you are looking for is catalog_product_save_after.
The xml for your event would look similar to this:
<events>
<catalog_product_save_after>
<observers>
<yourmodule>
<class>Yourcompany_Yourmodule_Model_Observer</class>
<method>catalog_product_save_after</method>
</yourmodule>
</observers>
</catalog_product_save_after>
</events>
Your observer is going to look similar to this:
class Yourcompany_Yourmodule_Model_Observer
{
public function catalog_product_save_after($observer)
{
$product = $obvserver->getEvent()->getProduct();
$productStatus = $product->getStatus();
$productId = $product->getId();
}
}
Note - code is untested
I have a custom object in SalesForce called Deal, which is a child of the built-in Account object. I am trying to use the Bulk XML API to upload a batch of records, but I can't seem to figure out how to specify this relationship correctly. From the documentation it says that you should reference a custom object's relationships like so:
<Relationship__r>
<sObject>
<some_indexed_field>#####</some_indexed_field>
</sObject>
</Relationship__r>
If you have any idea how to specify a relationship to the Account object from a custom object I'd really appreciate it.
Added
The Deal object has the following 2 fields:
DealID
API Name - DealID__c
Data Type - Text(255)(External ID)(Unique Case Sensitive)
Account
API Name - Account__c
Data Type - Master-Detail(Account)
Request XML:
<Account__r>
<sObject>
<ID>0013000000kcWpfAAE</ID>
</sObject>
</Account__r>
Result XML:
<result>
<errors>
<message>Field name provided, Id is not an External ID or indexed field for Account</message>
<statusCode>INVALID_FIELD</statusCode>
</errors>
<success>false</success>
<created>false</created>
</result>
There appears to be a bug and you have to strip out all whitespace and newlines when dealing with reference objects.
Check out:
http://success.salesforce.com/ideaview?id=08730000000ITQ7AAO
From the docs
<RelationshipName>
<sObject>
<IndexedFieldName>rwilliams#salesforcesample.com</IndexedFieldName>
</sObject>
Everything looks good, but instead of using "ID" for the Indexed Field Name, you need to use "Account__c". That should take care of your issue.
I want to implement some kind of tagging functionality to my app. I want to do something like...
class Item(db.Model):
name = db.StringProperty()
tags = db.ListProperty(str)
Suppose I get a search that have 2 or more tags. Eg. "restaurant" and "mexican".
Now, I want to get Items that have ALL, in this case 2, given tags.
How do I do that? Or is there a better way to implement what I want?
I believe you want tags to be stored as 'db.ListProperty(db.Category)' and then query them with something like:
return db.Query(Item)\
.filter('tags = ', expected_tag1)\
.filter('tags = ', expected_tag2)\
.order('name')\
.fetch(256)
(Unfortunately I can't find any good documentation for the db.Category type. So I cannot definitively say this is the right way to go.) Also note, that in order to create a db.Category you need to use:
new_item.tags.append(db.Category(unicode(new_tag_text)))
use db.ListProperty(db.Key) instead,which stores a list of entity's keys.
models:
class Profile(db.Model):
data_list=db.ListProperty(db.Key)
class Data(db.Model):
name=db.StringProperty()
views:
prof=Profile()
data=Data.gql("")#The Data entities you want to fetch
for data in data:
prof.data_list.append(data)
/// Here data_list stores the keys of Data entity
Data.get(prof.data_list) will get all the Data entities whose key are in the data_list attribute