Thursday, 16 April 2015

Show lookup view dialog and Schedule engine

Following is UNSUPPORTED, and was used to work to elemenate some of the user clicks. I had a requirment to select the service on service activity form and then show schedule engine once the service been selected. function PrepoulateService() { if(Xrm.Page.getAttribute(serviceFieldName).getValue()!=null){ return;} var fetchXml = GetServicesQuery(validServices); var data = GetOrganisationService().Fetch(fetchXml); var canCreate = false; Xrm.Page.getAttribute(serviceFieldName).addOnChange(showScheduleEngine); if (data != null && data.length == 1) { if (data[0].attributes.serviceid.value != null) { Xrm.Page.getAttribute(serviceFieldName).setValue(data[0].attributes.serviceid.value); } } else { //select service by showing service lookup document.getElementById(serviceFieldName).click(); } //show schedule engine setTimeout("showScheduleEngine", 500); } function showScheduleEngine() { Type.registerNamespace("Mscrm"); Mscrm.Form_onload = function () { InitCalendar(USER_DATE_FORMATSTRING, USER_DATE_SEPARATOR, USER_DATE_START_DAY, _dCalMinDate); _oServiceRetrieveCommand = new RemoteCommand("Service", "Retrieve"); window.setTimeout("ScheduleActivity($get('crmFormSubmit').crmFormSubmitId.value, ServiceAppointment, !IsNull(location.search.match(/autoSearch=([^&]*)/)))", 100) }; Mscrm.Form_onsave = function (context) { CustomFormSubmit($find("crmForm"), context.getEventArgs()) }; Mscrm.serviceid_onchange = function () { ServiceLookupChanged() }; Mscrm.isalldayevent_onchange = function () { Mscrm.FormControlInputBehavior.GetBehavior("scheduledstart").set_forceSubmit(true); Mscrm.FormControlInputBehavior.GetBehavior("scheduledend").set_forceSubmit(true) } var eventObj = Xrm.Page.ui; var eContext = Mscrm.FormUtility.constructExecutionObject(eventObj, 0, null, null); eContext = Mscrm.FormUtility.constructExecutionObject(eventObj, 0, null, eContext); var t_s = new Date().getTime(); Mscrm.Form_onload(eContext); }

Tuesday, 31 March 2015

Refresh all subgrids on a form

RefreshAllSubGrids: function () { Xrm.Page.ui.controls.forEach( function (control, index) { if (control.getControlType() == "subgrid") { control.refresh(); } } ); }

Tuesday, 28 October 2014

SharePoint 2010 :- 'Activate Features'. A timeout has occurred while invoking commands in SharePoint host process.

When trying to deploy a SharePoint project getting Error Message:
Error occurred in deployment step 'Activate Features'. A timeout has occurred while invoking commands in SharePoint host process.

After doing a bit of search found every second article was saying to specify the time in the key

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools key, and then add a time out to 'ChannelOperationTimeout' to something like 240 for 4 mins time out.

but the issue I was getting in my system I only had path up to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0

Resolution

Open Regedit
go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0
Create a new Key (folder) SharePointTools
Create a DWORD entry called ChannelOperationTimeout
Specify the value of 480

I used the 480 as the project I was trying to deploy actually took 06.14 mins

Wednesday, 24 September 2014

Ribbon button display issue

I was involved in the issue of finding why one of the ribbon button R1 was not shown when deployed at client environment, after checking the entity ribbon diff xml everything looked fine, I started investigating into the database side of it.

After investigation I found that there was an old solution1 which used to refer the same entity but at that time the ribbon button which should be shown was not included in it.
Later on it was decided the correct place for the entity is solution2 and a new ribbon button R1was added on it afterward and entity was removed from solution1.

Theory says the ribbon xml should be merged instead of overwritten, but actually what's happening is the last one wins, so I updated installation instruction document to re-import soution2 when solution1 is deployed to make sure ribbon button appears correctly. This could be due to same publisher is in use for both solution1 and solution2.

Other option.
As any managed change deployed can not be removed from the system unless the managed solution which installed it is uninstalled but doing this would cause the import data to be deleted. one option we could use is to create a new solution3 with the same publisher for solution1 with the changes we like to keep in the system and then after installation of the solution3 uninstall solution1 doing this will keep the entities, records in the system as referred by solution3, but will take any change no longer required i.e. entity with R1, this would cause the deletion of any layers/records defined in the database due to solution1 initial import.

but the reason we didn't got with this option and stick for the installation instruction to re-import is the level of risk involved in uninstallation.

Thursday, 4 September 2014

Permission denied - javascript prompt

In development environment when trying to make ajax call using the ActiveX object post request was getting following error

Permission denied.


Resolution

Add the website the request is made to trusted site along with the one the site is making the request.

if the dialog is disabled due to enforced policies, use the following register key and delete it and then reopen the browser, this will let you add site to trusted area


HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings

Reduce the trust security to low

(before making any change to register please take a backup, and to reduce the trusted security level you should know the implication).

This is not in any shape the desired solution and should be avoided if possible.

Monday, 1 September 2014

getting the related view values from the lookup field

 
 
 

returns the  schema name of the field1
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[0].name

returns the  value of the field1
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[0].value


 returns the schema name of field2
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[1].name

returns the value of the field2
Xrm.Page.getAttribute("new_customAttribute").getValue[0].values[1].value