I have a simple upsert operation using the Jitterbit data loader. I am trying to create a new case record in Salesforce. One of the attributes of the case object is the case origin. This is a picklist field. I want all case objects created using Jitterbit to have a certain origin value. Let's call that value "Company Core". When my upsert runs I always get the following error if Company Core is supplied as the value for case origin.
Operation is not allowed
If I omit the case origin then the upsert is always successful. If after insert I update the record and supply the case origin field then the update is also successful.
As a workaround I could first insert the record without a case origin and then subsequently update it but:
1. This is a suboptimal solution and shouldn't be necessary.
2. There are case assignment rules triggered on insert that rely on case origin having the correct value at the time of insert.
I can't find much online about anyone experiencing similar problems. Some posts hint that field level security might be involved but I've tried removing read-only without success.
https://developer.salesforce.com/forums/?id=906F0000000938xIAA
The account doing the data uploading is a system administrator account. The version of the Jitterbit data loader is 8.4.4.6.
Thanks for your help.
Field Level Security
Field Accessibility
Even though the value we're inserting for Case Origin is never null checking the "Insert null values" check box resolves the problem. I recommend if possible your Operation Options be exactly the same as the screenshot below. This seems to be a Jitterbit related issue rather than a Salesforce API issue.
I hope this helps anyone with a similar problem.
Related
I have a custom object in Salesforce which I need to setup a Master Detail relationship from Accounts. Accounts being the Master and CompHist being the Detail. The problem I am running into is that I need to set the relation to work off of custom fields within the objects. Example:
1.) Accounts has a custom field called CustomerId.
2.) CompHist also has custom field called CustomerId.
3.) I need to be able to have this linked together by CustomerId field for report generation.
About 2,000 records are inserted into CompHist around the 8th of each month. This is done from a .NET application that kicks off at the scheduled time, collects info from our databases and then uploads that data to salesforce via the SOAP API.
Maybe I'm misunderstanding how Salesforce relationships work as I am fairly new (couple months) to salesforce development.
Thanks,
Randy
There is a way to get this to work without triggers that will link the records or pre-querying the SF to learn Account Ids in .NET before you'll push the CompHistories.
Setup
On Account: set the "External ID" checkbox on your CustomerId field. I'd recommend setting "Unique" too.
On CompHist: you'll need to make decision whether it's acceptable to move them around or when the relation to Account is set - it'll stay like that forever. When you've made that decision tick / untick the "reparentable master-detail" in the definition of your lookup / m-d to Account.
And if you have some Id on these details, something like "line item number" - consider making an Ext. Id. for them too. Might save your bacon some time in future when end user questions the report or you'll have to make some kind of "flush" and push all lines from .NET (will help you figure out what's to insert, what's to update).
At this point it's useful to think how are you going to fill the missing data (all the nulls in the Ext. Id) field.
Actual establishing of the relationship
If you have the external ids set it's pretty easy to tell salesforce to figure out the linking for you. The operation is called upsert (mix between update and insert) and can be used in 2 flavours.
"Basic" upsert is for create/update solving; means "dear Salesforce, please save this CompHist record with MyId=1234. I don't know what's the Id in your database and frankly I don't care, go figure this out will ya?"
If there was no such record - 1 will be created.
If there was exactly 1 match - it will be updated.
If there were more than 1 found - SF won't know which one to update and throw error back at you (that's why marking as "unique" is a good idea. There's a chance you'll spot errors sooner).
"Advanced" upsert is for maintaining foreign keys, establishing lookups. "Dear SF, please hook this CompHist up to Account which is marked as "ABZ123" in my DB. Did I mention I don't care about your Ids and I can't be bothered to query your database first prior to me uploading my stuff?"
Again - exact match - works as expected.
0 or 2 Accounts with same ext. id value = error.
Code plz
I'd recommend you to play with Data Loader or similar tool first to get a grasp. of what exactly happens, how to map fields and how to not be confused (these 2 flavours of upsert can be used at same time). Once you'll manage to push the changes the way you want you can modify your integration a bit.
SOAP API upsert: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm (C# example at the bottom)
REST API: http://www.salesforce.com/us/developer/docs/api_rest/Content/dome_upsert.htm
If you'd prefer an Salesforce Apex example: Can I insert deserialized JSON SObjects from another Salesforce org into my org?
If I have some leads in my Salesforce org which are already converted to some Accounts or Opportunity and now I have to insert the same converted leads to my other Salesforce Org then how it can be done for bulk records.
I have the required permission for converting the LEADS i.e. Edit and Create on Accounts, Opportunity, Contacts along with 'convert leads' permission.
I am seeking for the steps to be followed to accomplish this with full details.
Thanks
Chirag
I got this sorted out.
In order to insert Converted Leads into SALESFORCE, we have to raise a case in SF in order to enable these fields: CONVERTEDACCOUNTID, CONVERTEDCONTACTID, CONVERTEDOPPORTUNITYID and CONVERTEDDATE in editable mode.
These are the audit fields, once enabled then you can load/insert converted leads into your environment.
Following Points to Consider:
Firstly, Load Account, Contact and Opportunity which needs to be associated with the converted lead.
Next prepare a csv files with information of lead and get the ids from previous step and load it into the appropriate converted fields of file as mentioned above.
The field Isconverted should be set to true.
The CONVERTEDDATE must be created after the Lead's CreatedDate, Otherwise it will give error. [this is a common sence ;)]
Also these Audit Fields are automatically disabled in two weeks, so try to finish your work within this time.
Thanks & Regards
Chirag
Export data from salesforce Org1. OR use 'salesforce to salesforce' sharing feature to send data from one org to another org.
Write a apex job to mass convert leads to accounts.
I have a custom object. There are combination of fields like month_c,Project_c,contact_c and role_c which determine the record as unique.
I can write a trigger on before insert to check if there are any records with the same combination already existing. The question i wanted to ask was
how can i make the insertion stop. once i find there is already an record then it should just not insert the record. it doesnt need to throw / show an error.
Thanks
Prady
Although others have answered this with better solutions (generally non-code solutions are more flexible for the end users of the system), the answer to stop a particular record from being inserted is to add an error to a field on that record.
For instance, if I was inserting accounts I might have something like this:
for(Account sAcct : trigger.new)
{
if(sAcct.Name == 'DeniedAccount')
{
sAcct.Name.addError('This is a denied account.');
}
}
Another alternative is to create a class extending Exception, and then throw a new instance of that exception class, this will prevent all of the records passed to the trigger from being processed as opposed to specific records.
A few days ago I found an incredibly useful and simple solution (in a ForceTree.com article) that prevented me from having to write a trigger. It allows you to combine fields to check for uniqueness using a workflow rule and a custom field.
Here's a walk-through:
http://www.forcetree.com/2010/07/unique-field-combination-in-salesforce.html
I have a similar situation in Salesforce. It is handled by creating a field that contains a value composed of all the values needed to guarantee uniqueness (in your case, month_c,Project_c,contact_c and role_c ). You then select the "Unique" checkbox for that field. Duplicates will now end up in the trash.
In my case, this new field is filled in (and pushed into Salesforce) by an external program. In your case, you'll need to fill in the value in your trigger. I think this is more efficient than doing SOQL queries in a trigger, but I have not done any checking to confirm this.
How do we redirect error/failed data to another table in SQL Server, during data importing in SSIS 2008 ?
In a particular data flow component - in Configure Error Output, choose to redirect the row. You may need to add some derived columns after that, and then union all your errors from different parts of your package together if you have just one unified error output.
Cade's way will work for any errors.
If you have data that you know in advance you want to redirect (say states that are not in a list of official states or people with no address), then you can do a conditional split and redirect the rows that way. I prefer to check for known problem issues rather than just to rely on something failing insert to avoid sending things to my datbase that might actually go into the filed but which are data I don't want. For instance I got a file that had the phrase "Legistlative restriction" in the last name field - this clearly wasn't a person, so I redirected the rows. But the actual text would have fit in our lastname field and the record would have been inserted if I had just reliedon error output.
I am getting the following error in an MS Access ADP when trying to add a record on a form linked to a MS SQL Server 2000 table:
Run-time error '31004':
The value of an (AutoNumber) field
cannot be retrived prior to being
saved.
Please save the record that contains
the (AutoNumber) field prior to
performing this action.
note: retrieved is actually spelled wrong in the error.
Does anyone know what this means?
I've done a web search and was only able to find the answer at a certain site that only experts have access to.
First of all, if you are going to look at experts-exchange - do it in FireFox, you'll see the unblocked answers at the bottom of the page.
Second, do you have a subform on that form that's using the autonumber/key field on the master form? Do you require the data that's on that subform to be saved (i.e., having its own key) before the main form is saved. You could be into a deadlock of A and B requiring each other to be saved first.
Other than that, you must somehow be accessing that autonumber field whenyou are saving it. The best I can suggest is to step through the code line by line.
Are you trying to assign the value of an Identity field to a variable or something else before you have saved the record?
For whatever reason, your app is trying to read the value of the identity field before the record has been saved, which is what generates that identity field. In other words, no value exists for the Autonumber field until the row is saved.
I think we'd need to see more code or know more about the steps that lead up to this error to resolve it in more detail.
You should have add some lines of code to show us how you're managing your data and what you are doing exactly. But I am suspecting an issue related to a recordset update. can you identify when the autonumber value is created? Is it available in a control on a form? Can you add a control to display this value to check how it is generated when adding a new record? Is the underlying recordset properly updated? Can you add something like me.recordset.update on some form events: I would try the OnCurrent one ...