|
![]() |
#1 |
Участник
|
А если использовать этот код
Цитата:
function setFieldValue()
{ if(Xrm.Page.data.entity.attributes.get("new_bonus_malusid").getValue()!=null) //заполнено ли поля луап { var id = Xrm.Page.data.entity.attributes.get("new_bonus_malusid").getValue()[0].id; id = id.replace("{", ""); id = id.replace("}", ""); retrieveRecord(id, "new_bonus_malusSet", retrieveBonus_malus, null, false); function retrieveBonus_malus(data, textStatus, XmlHttpRequest) { if(data.new_bonus_malus_coefficient_k7!=null) { Xrm.Page.data.entity.attributes.get("new_testfield").setValue(data.new_bonus_malus_coefficient_k7); } else { Xrm.Page.data.entity.attributes.get("new_testfield").setValue(null) } if(data.new_bonus_malus_coefficient_k7!=null) { Xrm.Page.data.entity.attributes.get("new_testfield").setValue(data.new_bonus_malus_coefficient_k7); } else { Xrm.Page.data.entity.attributes.get("new_testfield").setValue(null) } } } else { Xrm.Page.data.entity.attributes.get("new_testfield").setValue(null) } } Последний раз редактировалось Ion; 22.08.2013 в 10:39. |
|
![]() |
#2 |
Участник
|
Извините за мои глупые вопросы, но не могу понять, почему не срабатывает функция
Создал кастомную кнопку, сделал все как указано на скрине. Нажимаю на нее, а функция не вызывается. function OpenEnt( ) { var parameters = {}; parameters["new_name"] = Xrm.Page.getAttribute("new_name").getValue(); parameters["new_fortest"] = Xrm.Page.getAttribute("new_testfield").getValue(); Xrm.Utility.openEntityForm("new_insurance_policy", null, parameters); } Кпопку делал с помощью Ribbon workbench Вот сам скриншот http://smages.com/images/ribbon.png |
|
![]() |
#3 |
Участник
|
вот еще один пример:
Цитата:
function GetInfo() {
//Getting the Lookup object from the CRM Page var ProjectObject = Xrm.Page.getAttribute("new_bonus_malusid").getValue(); // Getting the GUID for the Project record var ProjectNoID= ProjectObject[0].id; //Stripping out the curly brackets ProjectNoID = ProjectNoID.replace('{', '').replace('}', ''); //Checking if we have a project GUID Value if (ProjectNoID != null) { //Let’s create the Web Service URL oDataPath = Xrm.Page.context.getServerUrl() + "/xrmservices/2011/organizationdata.svc"; //Call the project retrieve function RetrieveProjectRecord(ProjectNoID, oDataPath); } } function RetrieveProjectRecord(Id, ODataPath) { var retrieveReq = new XMLHttpRequest(); retrieveReq.open("GET", ODataPath + "/new_bonus_malusSet(guid'" + Id + "')", true); retrieveReq.setRequestHeader("Accept", "application/json"); retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8"); retrieveReq.onreadystatechange = function () { retrieveProjectReqCallBack(this); }; retrieveReq.send(); } function retrieveProjectReqCallBack(retrieveProjectReq) { if (retrieveProjectReq.status == 200) { var retrievedProject = this.parent.JSON.parse(retrieveProjectReq.responseText).d; var ProjectName = retrievedProject.new_test; Xrm.Page.getAttribute("new_testfield").setValue(ProjectName); } else { alert("Error in Fetching data"); } } |
|
![]() |
#4 |
Участник
|
спасибо. с этим вопросом разобрался.
Цитата:
Сообщение от Ion
![]() Извините за мои глупые вопросы, но не могу понять, почему не срабатывает функция
Создал кастомную кнопку, сделал все как указано на скрине. Нажимаю на нее, а функция не вызывается. function OpenEnt( ) { var parameters = {}; parameters["new_name"] = Xrm.Page.getAttribute("new_name").getValue(); parameters["new_fortest"] = Xrm.Page.getAttribute("new_testfield").getValue(); Xrm.Utility.openEntityForm("new_insurance_policy", null, parameters); } |
|
|
![]() |
||||
Тема | Ответов | |||
extraqs и JQuery+JSON2 на OnLoad | 9 |
Опции темы | Поиск в этой теме |
Опции просмотра | |
|