function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stephen McLoughlinStephen McLoughlin 

How to 'replace' or relate Cases with new custom object (imported csv from data loader)?

Hi,

I'd be very grateful if someone could help me with my query. (Note that I'm a Salesforce newbie). I've imported data from an external public service reports system. I cleaned the data in the csv and created a new custom object in SF before I imported the csv using the Apex data loader. The import was successful but I can't find the data!

I have a new lookup field in 'Case' to connect to the new custom object but I think it should be the other way around?

The end goal is to be able to view all reports that I imported with their custom fields correctly mapped and then also to be able to create new 'Cases', but with all the new fields available to me to input information...in other words "I want to replace Cases with my new custom object called 'Incidents'. I then wish to assign staff in different depots to these cases/incidents, but that's at a later stage.

Any help would be greatly appreciated. Thank you,

Stephen

P.S. I can send you a small sample of the csv I imported if that helps? 
Best Answer chosen by Stephen McLoughlin
Suneel#8Suneel#8

You can see all the incidents as a list in the Incidents tab,if you have one.Have you created Incidents tab?If you have the tab but if it is set to Default off,you can click + beside Cases and can see all the tabs you have access to.

In order to link Cases and Incidents you need to find the relationship between these two objects in first place.So what is the relationship between these two objects?You can find more information regarding Object relationships in below links.Hope this helps

https://help.salesforce.com/HTViewHelpDoc?id=overview_of_custom_object_relationships.htm
http://www.salesforce.com/developer/docs/api/Content/relationships_among_objects.htm

All Answers

Suneel#8Suneel#8
You should use case id to relate the cases in the system with data imported.Also you can check the errors in error file.Before uploading,Data loader would be asking you to specify a path for error file as well Check it for more infromation on errors.Attach that file too.Yes you can attach a sample file for better understanding.
Stephen McLoughlinStephen McLoughlin
Thank you for your reply Suneel#8,
I have attached a sample of the csv I uploaded. The full csv of 893 records uploaded successfully with no errors (i.e. the errors.csv file was empty). I have also attached the schema builder showing the relationship I had setup between 'Case' and the new custom object 'Incidents'.

The field names in the csv are as follows. 
UniqueID
IncidentId
Title
DateTime
CategoryId
CategoryTitle
Latitude
Longitude
SmallAreaID
ElectoralDivision
OpenPostCode
OpenPostCodeMap
What3Words
What3WordsMap
FYSReportURL
OWNERID
ACCOUNTID

The schema is also attached (see schemabuilder_case2customobject.jpg). These fields in the csv match the schema in the SF custom object. 
So I would like to replace the Case schema with the Incident schema.

Thanks again for your help,
Stephen
 
CSV Sample:
UniqueID,IncidentId,Title,DateTime,CategoryId,CategoryTitle,Latitude,Longitude,SmallAreaID,ElectoralDivision,OpenPostCode,OpenPostCodeMap,What3Words,What3WordsMap,FYSReportURL,OWNERID,ACCOUNTID
1,24641,"Lucan Heights Lane, Tree down",12/09/2014 23:49,7,Tree and Grass Maintenance,10.10101,-15.10101,267101018,Lucan Heights,M84KG,http://…,sweaters.ghostly…,http://…,http://…,005w…,001w…
2,24914,Lighting in Waterstown Park,23/09/2014 14:53,3,Street Lighting,11.10101,-16.10101,267109015,Palmerstown West,MPQDJ,http://…,dawn.mason…,http://…,http://…,005w…,001w…
3,24908,Overgrowth causing danger,23/09/2014 12:46,7,Tree and Grass Maintenance,12.10101,-17.10101,267109019,Palmerstown West,LNG67,http://…,wishes.steps…,http://…,http://…,005w…,001w…


Schema relationship between Case and Custom object (Incidents)
Suneel#8Suneel#8
Stephen,

It is strange that import was successful without errors and still records are not available in Salesforce.You should be getting Salesforce record ID in success file.Do you see it?If record Id is available there and record is not visible in Salesforce,I recommend you to query in workbench with the salesforce id to verify if the record really exists.

I suggest you to create an Incident in the application from Browser, export into a CSV and remove the Id and alter the data in the file and upload it again.Basic idea is to use Export file for Import. Initially you can try importing one or two records instead of all the records.

May I know why you want to replace Cases with a new Custom Object when you have many useful functionalities(like Email to Case) with standard Case object
Stephen McLoughlinStephen McLoughlin
Ok Suneel,
Thank you. I hadn't used Workbench before and did not realise (until now) that you can access a record using it's recordid from the 'success.csv' file and append it to the URL. So I found the records (well, one at a time - see attached), but they are not available under Cases. How can I find them as a list? 
I'll take your advice and I won't replace Cases with the custom object. Can you advise a better way to link them? I don't think I have them correctly linked (see Schema Builder screenshot in my last reply). Thanks again for all your help.
Stephen
Imported incidents viewable in Salesforce using RecordID in URL

 
Suneel#8Suneel#8

You can see all the incidents as a list in the Incidents tab,if you have one.Have you created Incidents tab?If you have the tab but if it is set to Default off,you can click + beside Cases and can see all the tabs you have access to.

In order to link Cases and Incidents you need to find the relationship between these two objects in first place.So what is the relationship between these two objects?You can find more information regarding Object relationships in below links.Hope this helps

https://help.salesforce.com/HTViewHelpDoc?id=overview_of_custom_object_relationships.htm
http://www.salesforce.com/developer/docs/api/Content/relationships_among_objects.htm
This was selected as the best answer
Stephen McLoughlinStephen McLoughlin
Hi Suneel,
I did not have the Incidents tab created, but I have since created it and made it available as one of my tabs. So I can now see all the incidents as a list! Great! However, when I tried to setup a relationship between Incidents and Cases like so, I ran into a problem...

Field Label    FYSCase

Data Type    Master-Detail

Field Name    FYSCase

Description    Incidents related to Case

These are the page layouts that will include this field. Because this is a Master-Detail relationship, the field is required.

Page Layout Name: IncidentID Layout
"Cannot Create Master-Detail Relationship
You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail."

​Since I already have imported all my records (~900), I may need to delete all records, then create the Master-Detail relationship, and then re-import the data again? I think that is probably easier than having to first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.
I might try that tomorrow (unless you have any other suggestions) and I will let you know how I get on.

Thanks again Suneel. You have been a great help.

Stephen
 
Suneel#8Suneel#8
It looks like you are trying to create Incident object as a child object to Case.There are two important things to note about this relationship.
If you delete a Case all the related Incidents of the case will get deleted as Child records cannot exist as orphan records without parent
Also child record's access control is controlled by Master object.Hope you got that from the link I provided you in my earlier post

Yes you can delete all the records and create a Master Detail relationship and later import the incidents again.That would solve the problem :)
 
Suneel#8Suneel#8
Stephen,is your issue fixed.If so kindly mark this question as Solved
Stephen McLoughlinStephen McLoughlin
Thank you Suneel. I have not yet deleted all the incidents and created the master-detail relationship, but I now know what to do. I've marked you 'best answer' above. Thanks again and Happy New Year!
Stephen