AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 16.07.2015, 07:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
mscrmblog: CRM 2015 save method with callbacks to navigate away from an error
Источник: http://mscrmblog.net/2015/07/16/crm-...from-an-error/
==============

Recently i stumbled upon an edge case scenario where the logged in user that has access to the record was making a specific change to the record which in turn fired the elevated plugin which removed his access and threw this strange error:
Server Is Busy

The record was saved. However, the data could not be displayed because the server is busy…



During my investigation, i had to come up with a way to remove this annoying error and take them back to the grid screen. Thankfully the Xrm.Page.data has a method save with the option to set callback functions to be executed after the save operation is completed.

Hooking onto these methods, i threw an alert and used the history.go method to return to the grid.

Notice the set_forceNavigationAway method, this is used to disable the the onbeforeunload message that CRM prompts saying you have unsaved changes to the form.

Xrm.Page.data.save().then( function() { // success callback }, function(errorCode, message) { // failure callback due to no access alert("You no longer have access to this Incident."); //this seems to work only in chrome Mscrm.RefreshPageHandler.set_forceNavigationAway(true); //this seems to work both in IE and chrome Mscrm.ReadFormUtilities.set_forceNavigationAway(true); window.LOCID_FORMS_SAVE_CONFIRM_TITLE = ""; window.history.go(-1); });



Источник: http://mscrmblog.net/2015/07/16/crm-...from-an-error/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: Product documentation for Microsoft Dynamics CRM Online 2015 Update 1 (7.1.0) is available! Blog bot Dynamics CRM: Blogs 0 02.05.2015 02:33
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2013 Update Rollup 2 Blog bot Dynamics CRM: Blogs 0 15.04.2014 01:15
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 12 Blog bot Dynamics CRM: Blogs 0 30.01.2013 01:11
Gareth Tucker: Resco MobileCRM vs. CWR Mobile CRM – Microsoft CRM Mobile Showdown! Blog bot Dynamics CRM: Blogs 0 13.01.2012 17:11
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:32.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.