Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

unable to Change the default view on the teams lookup window of the associated sub-grid table using JavaScript

$
0
0

Im following the below article to Change the default view on the teams lookup window of the associated sub-grid table using JavaScript

https://www.inogic.com/blog/2023/02/change-the-default-view-on-the-lookup-window-of-the-associated-sub-grid-table-using-javascript/  

i have added my code below.

followed the exact same method mentioned in above article. 

when i click on add exisiting record it is opening correct lookup mentioned in the js ,.as you can see in the screenshot it is opening all IN teams which is correct

Image

But when i  select the team and click on add button then it is opening below window again with all teams, the first operation is not adding the teams

Image

async function checkApp(primaryControl) {
debugger;
if (!(primaryControl)) { return; }

formContext = primaryControl;
//get globalcontext
let globalContext = Xrm.Utility.getGlobalContext();
//get app Name
result = await globalContext.getCurrentAppName().then(
function (appName) {
// Switch case check App name
switch (appName) {
//For the Sales Hub app
case "Customer Service admin center":
//set default view as Sales Contact View
defaultviewId = "93482daa-15f3-ed11-8849-6045bd1f9d3d",
//Set Sales Views

viewIds = ["93482daa-15f3-ed11-8849-6045bd1f9d3d", "00000001-0000-0000-0001-00000000009b"],
//call setDefaultView function
setDefaultView(formContext, viewIds, defaultviewId);
break;
}
},
function (err) {
console.log('err ' + err.message)
});
}


function setDefaultView(formContext, viewIds, defaultviewId) {
var lookupParameters = {};
//define data for lookupOptions
var lookupOptions =
{
//list of entity types to be displayed in the lookup dialog
defaultEntityType: "team",
// default entityType need to be displayed
entityTypes: ["team"],
//allow multiple selections or not
allowMultiSelect: false,
disableMru: true,
/* filters: [{
filterXml: "<filter type='and'><condition attribute='description' operator='eq' value='CC Team' /></filter>",
entityLogicalName: "team"
}], */
//Default view we need to be displayed
defaultViewId: defaultviewId,
//list multiple views we want to display in the lookup dialog
viewIds: viewIds
};
//open lookup window
Xrm.Utility.lookupObjects(lookupOptions).then(
function (result) {
if (result != null) {
console.log(result)
}
}
),
function (error) { console.log(error); };}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images