Open tleafs opened 10 years ago
You can do this by implemenig - (NSString *)fieldDescription
on your SalesAgent
entity.
If SalesAgent
is a OneToMany relation and already conforms to the FXForm
protocol, you should define the field as something like this in your Client+Form
:
- (NSArray *)fields {
return @[
@{
FXFormFieldKey: @"salesAgent",
FXFormFieldOptions: [self salesAgents],
}];
}
- (NSArray *)salesAgents {
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"SalesAgent"];
return [[CoreDataStack defaultStack].managedObjectContext executeFetchRequest:request error:nil];
}
Brilliant! The - (NSString *)fieldDescription took care of the issue.
Not sure if this is there already, but can't seem to get it to work.
How to display and set another MO entity from a relationship.
For example on the Client Form which points to SalesAgent Entity. How to pick the Sales Agent (which has name, id, etc) display just name and then assign the selected SalesAgent MO to the Client form?