RE: How to add same items into subgrid of multiple entities
So you are trying to add users to account, now its confusing - we started at Lead and Competitor.
Any ways what is the relationship between user and account, I mean how you want to add a user to account? Is it owner?
The lookup window looking weird to me, which version of CRM it is? below is lookupoptions code for user entity
function AddToCompetitor() {
debugger;
var lookupOptions = {};
lookupOptions.allowMultiSelect = true;
lookupOptions.defaultEntityType = "systemuser";
lookupOptions.entityTypes = ["systemuser"];
Xrm.Utility.lookupObjects(lookupOptions).then(
function AddCompetitorCallback(selectedCompitetors) {
debugger;
var recordIds = // fetch the selected lead ids here
for (var l = 0; l < recordId(s); l++) //loop for selected leads
{
for (var c = 0; c < selectedCompitetors.length; c++) { //loop for selected uers
// add your logic
}
}
}
}