Hi,
Marketing List and contact has n:n relation.When I am adding contacts in contact sub grid from marketing list, need to retrieve contacts and marketing list data using java script.
*This post is locked for comments
Hi,
Marketing List and contact has n:n relation.When I am adding contacts in contact sub grid from marketing list, need to retrieve contacts and marketing list data using java script.
*This post is locked for comments
Hi Neethu ,
Thanks for your clarification , now I understood your requirement .
I believe you know that without relationship you can not show any subgrid and this is how relationship works.
If my understanding is correct you are going to display those campaign in the contact form which the marketing list (contacts) associate with particular campaign.
You cant do this OOB without any relationship , you may think some alternate way or go for custom html retrieving the campaign data and display in third party grid.
The filter would be get the marketing list id of particular contact in one query and then using marketing list id's you can retrieve associated campaign data .
Hello Goutam,
Thanks for your quick response. I will attach screen shot about my requirement.
This is Campaigns entity form view,red circled is marketing list grid view.Campaign to marketing list entity has n:n relationship.
This is Marketing list form view. first red circled is contact grid view(member). Marketing list to contact also have n:n relationship.second red circled has showing campaigns grid view linked with that particular marketing list.The same campaign grid view list need to show in contact entity what are the contacts linked with the particular marketing list.Now i don't have any direct relationship between campaigns and contact.
Hello Neethu ,
Based on your earlier question you want to retrieve the marketing list contact information using Javascript , so call web API using Javascript which I have shared and it will work for all instance of dynamics 365 online or on-premise.
I am not very clear about your requirement - "When I Select Contacts in member named grid, I want to show Campaigns grid views in selected contact entity." Could you please give some more details on it so that may be I can help you.
Hi Goutam,
I am working with dynamics 365 online. I don't want to call webapi because working inside dynamics 365 only.Actually my requirement is,
Campaigns have marketing list. This marketing list has one field called 'Targeted At'. If i am selecting a contact entity in 'Targeted At' field i can create a contact in member grid view. When I Select Contacts in member named grid, I want to show Campaigns grid views in selected contact entity. Campaign to marketing list has n:n relation and marketing list to contact also n:n relationship.Need to display parent in grandchildren entity sub grid.Any possible way to customise and achieve this?
Hi Neethu ,
I would request download the CRMRestBuilder . In CRMRestBuilder select the entity called "list" and then in Many to Many select your contact association field and in addition you can provide filter.
https://github.com/jlattimer/CRMRESTBuilder
Here is sample I have prepared have a look -
var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/lists?$select=description,listid,listname&$expand=listcontact_association($select=fullname,jobtitle,lastname)", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var results = JSON.parse(this.response); for (var i = 0; i < results.value.length; i++) { var description = results.value[i]["description"]; var listid = results.value[i]["listid"]; var listname = results.value[i]["listname"]; //Use @odata.nextLink to query resulting related records var listcontact_association_NextLink = results.value[i]["listcontact_association@odata.nextLink"]; } } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send();
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,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156