locked
How get View Id on Form RRS feed

  • Question

  • I have ribbon button on Lead home page.it working as if you click it it check the User Selectd view and Retrive records according to Selected View.

    function nextProspect(){ try { if (document.getElementById('crmGrid_SavedNewQuerySelector')) { var view = document.getElementById('crmGrid_SavedNewQuerySelector'); var firstChild = view.firstChild; var currentview = firstChild.currentview; var viewId = currentview.valueOf(); //alert(viewId); if (viewId=="{C0417C54-71E9-E211-8E0D-00155D25022F}") { //alert("LifeInsuranc view"); LifeInsuranceView(); } var dt = new Date(); var a=dt.format("yyyy-MM-dd HH:mm:ss"); //alert(a); var fetchxml="<fetch mapping='logical'>"+ "<entity name='lead'>"+ "<attribute name='fullname' />"+ "<attribute name='leadid' />"+ "<attribute name='statuscode' />"+ "<attribute name='statecode' />"+ "<attribute name='new_scheduledtime' />"+ "<attribute name='createdon' />"+ "<attribute name='subject' />"+ "<order attribute='fullname' descending='false' />"+ "<filter type='and'>"+ "<condition attribute='statecode' operator='eq' value='0' />"+ "<condition attribute='subject' operator='eq' value='"+parameter+"' />"+ "<condition attribute='new_scheduledtime' operator='on' value='"+a+"' />"+ "<condition attribute='ownerid' operator='eq-userid' />"+ "</filter>"+ "</entity>"+ "</fetch>"; var fetchedLeads = CrmServiceToolkit.Fetch(fetchxml); alert(fetchedLeads.length); if(fetchedLeads.length>0) var dt = new Date(); var a=dt.format("yyyy-MM-dd HH:mm:ss"); //alert(a); var fetchxml="<fetch mapping='logical'>"+ "<entity name='lead'>"+ "<attribute name='fullname' />"+ "<attribute name='leadid' />"+ "<attribute name='statuscode' />"+ "<attribute name='statecode' />"+ "<attribute name='new_scheduledtime' />"+ "<attribute name='createdon' />"+ "<attribute name='subject' />"+ "<order attribute='fullname' descending='false' />"+ "<filter type='and'>"+ "<condition attribute='statecode' operator='eq' value='0' />"+ "<condition attribute='subject' operator='eq' value='"+parameter+"' />"+ "<condition attribute='new_scheduledtime' operator='on' value='"+a+"' />"+ "<condition attribute='ownerid' operator='eq-userid' />"+ "</filter>"+ "</entity>"+ "</fetch>"; if(fetchedLeads.length>0){ var leadId=fetchedLeads[0].getValue('leadid'); var scheduledtime=fetchedLeads[0].getValue('new_scheduledtime'); Xrm.Utility.openEntityForm("lead",leadId);

    and want to so same functioanlity on Lead Form but on form It is not Working.view id is not getting.

    how can i get View id on form


    Muhammad Sohail


    • Edited by sohail450 Thursday, July 11, 2013 9:49 AM
    Thursday, July 11, 2013 9:47 AM