How to Make one to one Relationship in crm? Please guys be more specific.
Thanks in advance
*This post is locked for comments
How to Make one to one Relationship in crm? Please guys be more specific.
Thanks in advance
*This post is locked for comments
Hello Mena_Khalaf ,
There is no thing called one to one relationship in RDBMS.
which also applicable to MSCRM.
i thing you need to use N:N relationship between payment certificate and contract.
i hope it may help you.
1.Create a 1:N relation between Contract and Payment Certificate
2.Create lookup field paymentcertificateid on Contract
3.Register a plugin for Contract on update of the Payment Certificate lookup
4.In plugin check whether Payment certificate going to be associated is associated with any contract ,if yes throw message or associate with contract
public void Execute(IServiceProvider serviceProvider) { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); try { //Get Entity and then paymentcertificateid from InputParameter //Using queryexpression fetch contracts associated with the paymentcertificateid //If ,associated contract is 0 ,go ahead and associate //Else ,throw a message that Payment Certificate is already associated with some other Contract. } catch (Exception ex) { //throw } }
Corrected your name in my comment
Thanks Prashant,
I already have these links but I'm asking for more details this plugin to update the lookup field and ...and ....
if you have a sample for an example please provide me or video to explain.
Look This is the scenario I have the contracts and payment certificates so i need the contract has only one payment certificate and the payment certificate for only one contract ,
How can i do this ?
and one last thing My name is Mena Khalaf not Mena Khalif =D
Thanks again,
Mena
Hi Mena_Khalaf
There's is no such thing called one to one relationship in CRM. its either 1:N or N:1 or N:N
But I think, you have a requirement of creating a lookup on a form and the value of lookup should not be repeated. For e.g. if Mena is a contact in CRM and Contact form is having a lookup called Driver's License No.; now DL No. cant be repeated anywhere so this would be called a one to one relationship but technically its not available to create by configuration.
Following URls will tell you how to do it:
crmtipoftheday.com/.../create-a-11-relationship
social.microsoft.com/.../onetoone-11-relationship-in-crm-2011
go to the solution then select you enity. click the 1:NRelationship, then click new
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156