Core Data - Delete rule - core-data

I'm following Apple's documentation about Relationships. In their example, a Department has a to-many relationship to the Employees that work in a Department, and there is an inverse relationship from an Employee to the Department.
What should be the delete rule from Employee to Department? When I delete an employee, I don't want to change anything in the department, so the rule would be "No Action", which gives me a warning. I suppose I'm missing something here.

Nullify, which means that if a department is deleted the relationship on the Employee site will be set to nil.

Related

NetSuite NOT a Sales Team Member Saved Search

It's easy to do a saved search for when some person is a member of the sales team - how can I search for customers where a particular person is NOT a member of the sales team?
What I'm trying to do is find all the customers in a certain geographical area which do NOT have a certain person in the sales team. They all should; I know some don't, and I need a list of those ones that don't.
I don't have sales team enabled on my NetSuite account, so I can't really write it out for you. But, essentially, you could just script a customer search, and load the sales team for each customer. Then loop through the team, checking as you go. If you find the correct person, move on to the next customer, if not, log that customer to a return variable. Hope that helps...

CRM 2011 How to select the related entity fields in Advanced Find

I am using CRM 2011 Advanced Find on Account Entity to find the Incident CreatedOn Date where Incident is connected to Account.
But when I go to Edit columns it does not give me option to select the Incident CreatedOn Date (Because Advanced find query is on Account Entity). Is there any way to select the Related Entity fields on in search.
You wont be able to add the Incident.CreateOn in the Edit Column from the Account entity as you can only add lookup fields (resulted from a N:1 relationship between account and the other entity).
As the Account and Incident have a 1:N relationship, you should be able to add the account column to the Incident columns as stated by Pedro Azevedo. The image below shows you how to do it:
Notice that the Record Type will show you a list of the lookup fields you have in the Incident entity and to which entity is relates to - in this case, Customer is the relationship name in the Incident entity and Account is the related entity.
Cheers, dimamura
Try do this in Incident Entity. You can filter and add columns in both entity.

Create custom view with multiple entities in CRM 2011?

I'm new in CRM 2011. So not familiar with all it functionality.
Have a question about displaying data from multiple related entities.
First Entity is a Users (contain information about user)
Second Entity is a Class (contain information about class user enrolled)
Third Entity is a Class Attendance (contain information if user attended class on specific date)
The idea is to show view with users who is enrolled in class.
To show start end dates and if user attended class or not.
Administrator should select user and change status to attended or not.
How it can be done in CRM 2011? Is it required custom development or just to View Customization using user interface in CRM?
Any suggestion or examples highly appreciated.
In Mscrm you can create a view for a single primary record type, on this view you can show fields from the primary record. You can also include secondary records that are linked via a lookup to the primary record, you can show columns of these secondary linked records. The limitation here is that you cannot link tertiary records from these secondary linked entities. The slight confusion here is that you can show the name of the tertiary entity as its a field on the secondary entity.
So to put this into the context for a real example, take the following entity model.
Contact has a 1 to Many relationship with incident (a contact can have many incidents, each incident has a lookup to contact)
Incident has a 1 to Many relationship with task (an incident can have many tasks, each task has a lookup to an incident)
So a view of tasks can;
Show all the fields from the task (task in the primary)
Show all the fields from the incident (incident is the secondary)
Show the name of a the contact, but not any other field (contact is a tertiary, but its name is shown as a field from the incident)
This is one of those things that becomes a lot clearer when you actually try it out for yourself. Its hard to say what you will be able to achieve because its not clear what your entity model is.
In any case here is how you create your own custom view.
CRM > Settings > Solutions > Your Solution > Your Entity > Views > New. There are various buttons would should hopefully be self explanatory.
Click Add Columns and it will present you with fields of the primary entity, use the Record Type drop down option to select fields from linked secondary entities.
Reading between the lines you have:
Class entity with many:many relationship to student (user), so a user can be enrolled on more than one class and a class has more than one user.
There is then a second entity for attendance which by the sound of it has a many:1 relationship to both student and class, and has a status to show attendance for a particular instance of the class on one date.
So far sounds like a good model.
Using the ideas in James' answer you ought to be doing a view of Attendances, including the name of the class and user. You might also have extra columns from the user or class to show things like when the course starts and ends, what the student's email address is etc.
Sort this view by class, then student, then attendance date and you have a pretty good view. But this won't display in any kind of hierarchy or show summaries. You might want to look at building a custom report for this instead so you can report on attendances, grouped by student and grouped by class. If you get clever you could also add filters for dates so you can look at attendances last month only, for example. You can probably do a lot of this with the built-in report wizard, for more complex or pretty versions go to SSRS

How to reuse the Entity Field in CRM 2011

I created an entity name is Student,
In that entity I created fields like Name , Age, Qualification etc.,
I wanted to add new field that is Contact number but I don't want to create new one.
Is there any chance to reuse the Mobile phone filed that is presented in Contact Entity..
If there how..??
Please help me..!!
No, you cannot move the mobile phone field from the Contact entity to the Student entity.
You will have to make a new field on the Student and hide the field on the Contact.
Or you could, add a lookup on your student to contact, so each student has a contact record associated and use the phone number that way.
Or you could, get rid of the student entity and just use the contact with the extra fields you needs, as a student is effectively a person which is effectively a contact.
The choice relies on your business requirements.
Yes, you can.
You need to create a htm webresource and retrieve the contact number in the webresource, and then insert this htm webresource into the form.
Please see this article for details:
http://www.gapconsulting.co.uk/DesktopModules/SunBlog/Handlers/Print.aspx?entryid=58

Xcode 4 - Adding and associating an object to an entity using relationships

I've been learning how to use Core Data in xcode for a couple of weeks now but have been stumped on how to get the relationships to work.
In my code I have 2 entities. The "House" entity and the "City" entity. A house can only belong in 1 city, but a city can have many houses associated with it. So I set up a one-to-many relationship between the house and city entities.
The following code snippet is in the city view controller, which is just a table view that displays all available cities to choose from. The list is pre-populated in the city entity. Now when I select a row I try to execute the following code to associate a house with the selected city but the result is always nil.
The referringObject is the house object that I am creating
cities is the relationship from the house to the city entity
Any help is appreciated
NSManagedObject *selectedCity =
[self.fetchedResultsController objectAtIndexPath:indexPath];
[self.referringObject setValue:[selectedCity valueForKey:#"cityname"]
forKeyPath:#"cities.cityname"];
You want to associate the city object with the house object. You don't need to change the cityname value inside of it. That way you only have one entry in the table for each city. So what you want to do is:
NSManagedObject *selectedCity = [self.fetchedResultsController objectAtIndexPath:indexPath];
[self.referringObject setValue:selectedCity forKeyPath:#"city"];
That'll set up your both relationships for you. You can then access the city's name from a house object with houseObj.city.cityname or get the list of houses in a city with city.houses (assuming you named the relationship houses).

Resources