Thursday, 10 November 2016

Real Scenario Question

1.After saving data i want to show record how we can do this ?

2.We have two look up Account and Case on selecting element to Account how we can filter its own record ?

3. On button click how i can call a plugin.

4.How I can add a html control in MS CRM.  Check box is not in ms crm how will you overcome this problem.
5.How we can call parent report from a child report?

6. I have one subgrid in Account form  which shows only address1Name  and  . I need to copy that address in grid.
Ans - For this we can  add a custoum button and add it on  from and call it on button click
add following javascript function
copyaddress = function ()
{
   var selectedrows = xrm.page.controls.getconrol("gridname").getgrid().getselectedRows():
    var selectedRows = selectedRows.getAll()[0];
    var attributes  = selectedRows.getData().getEntity().getattributes.getAll();
     arttributes.forEach(function (attribute))
      {
       
     }

}
7. On button click call plugin ?
Hi,
You can create an action and where you can pass set of parameter if required, once activated your action will be available as a new message, so you can register your plugin on that message, and then it can be called using javascript.
Refer:
Thanks
 
https://www.linkedin.com/pulse/write-scripts-subgrids-dynamics-crm-2015-crm-consultant
 

8.On button click event display records,
Ans - Add custoum button  in subgrid  using xml work bench tool add script to this button
here is the following script
document.getElementById(“grid”).control.SetParameter(“fetchXML”, fetchxml);
Also when you set up the subgrid with “Records = Only Related Records” in the Data Source section, the subgrid will append a condition to your fetchxml so that it returns only records related to the specific relationship that you specified. So always select the Records as all record types.
One more change with FetchXML is that previously if we want to get all records for a condition, we used to add “*” as a value for that condition. This has changed now, the “*” is now automatically converted to “%%%” while generating FETCHXML.
Sample code:
//Filter connection subgrid
function FilterConnectionSubgrid()
{
var ConnectionSubgrid =document.getElementById(“Contacts”);
if(ConnectionSubgrid==null)
{
setTimeout(function () { FilterConnectionSubgrid(); }, 2000); //if the grid hasn’t loaded run this again
return;
}
var fetchXml = “<your fetchxmlquery here>”
//Set the fetchxml directly to subgrid
ConnectionSubgrid.control.SetParameter(“fetchXml”, fetchXml); //set the fetch xml to the sub grid
ConnectionSubgrid.control.Refresh(); //refresh the sub grid using the new fetch xml
}





No comments:

Post a Comment