tag:blogger.com,1999:blog-3101394961765670978.post214815708268214355..comments2023-05-30T04:08:26.864-04:00Comments on CRMScape: CRM 2011 OData, JSON and CRM FormsMark Kovalcsonhttp://www.blogger.com/profile/05363028899186950966noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-3101394961765670978.post-44928280476184756882012-07-02T11:36:57.918-04:002012-07-02T11:36:57.918-04:00great post!!! everything I need in one place!!great post!!! everything I need in one place!!Summerhttps://www.blogger.com/profile/01869360615140064986noreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-64156712623368657932012-04-13T10:47:10.917-04:002012-04-13T10:47:10.917-04:00Excellent post. Thank you.
For everyone who is mi...Excellent post. Thank you.<br /><br />For everyone who is missing the lookup field I came up with this code:<br /><br />var olookup = new Object();<br />olookup.id = ManyEntities[0].Id;<br />olookup.entityType = "account";<br />olookup.name = ManyEntities[0].Name;<br />var olookupValue = new Array();<br />olookupValue[0] = olookup;<br />Xrm.Page.getAttribute("account").setValue(olookupValue);Gregnoreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-85117803629959516632012-03-01T03:07:10.528-05:002012-03-01T03:07:10.528-05:00Nice post, thanks for sharing this wonderful and u...Nice post, thanks for sharing this wonderful and useful information with us.SharePoint Development Australia Pagehttp://kojikitao.skyrock.com/noreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-21726779964379198412011-12-01T09:05:28.457-05:002011-12-01T09:05:28.457-05:00Great post. I struggled to get date fields workin...Great post. I struggled to get date fields working and after debugging used:<br />var fieldValue = oneEntity.new_DateTime; var dateValue = new Date(parseInt(fieldValue.replace("/Date(", "").replace(")/", ""), 10));<br /><br />since replace method was not otherwise exposedDavidnoreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-47156211566269962342011-11-16T18:22:22.600-05:002011-11-16T18:22:22.600-05:00Thanks! I'm typically covered up with interest...Thanks! I'm typically covered up with interesting projects so getting my blog articles posted is probably the closest I will ever come to writing a book.Mark Kovalcsonhttps://www.blogger.com/profile/05363028899186950966noreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-59743614734395454062011-11-16T18:14:47.992-05:002011-11-16T18:14:47.992-05:00Fantastic explanation. Thank you so much. You shou...Fantastic explanation. Thank you so much. You should write a book for CRM 2011 developers !Hugonoreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-72147164778102235222011-05-31T10:40:40.720-04:002011-05-31T10:40:40.720-04:00Thanks Mark,
The best post I found. Really great.
...Thanks Mark,<br />The best post I found. Really great.<br />One question. I have a global variable that I want to set in the ProcessReturnedEntities function during the OnLoad event. I need to use this value to load some aspx pages later. I can put an alert and see that the value is being returned but the value is lost somewhere after the call.<br /><br />For instance,<br /><br />in the Onload event I have:<br /><br />var webSiteURL = "";<br />alert("2: " + webSiteURL); <br />.....<br />function ProcessReturnedEntities(ManyEntities)<br />{<br />var oneEntity = ManyEntities[0]; <br />webSiteURL = eval(oneEntity.AccountURL);<br />alert("1: " + webSiteURL); <br />}<br /><br />Alert 1 shows the correct value.<br />Alert 2 losts the correct value.<br /><br />What am I doing wrong?<br /><br />ThanksLuiznoreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-90708030324856313432011-03-31T10:41:24.255-04:002011-03-31T10:41:24.255-04:00Guillermo is ews_rate a CRM Money value or a decim...Guillermo is ews_rate a CRM Money value or a decimal or double?Mark Kovalcsonhttps://www.blogger.com/profile/05363028899186950966noreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-32955831436716145262011-03-31T09:49:45.146-04:002011-03-31T09:49:45.146-04:00Great post. However, I can't get the data ass...Great post. However, I can't get the data assigned to a field in CRM, no matter what I try. I have use your example to the letter, but the script won't work. I may be missing something on the data.d format. Here is my code:<br /><br />function GetRate(context) {<br /><br /> var oProduct = context.getEventSource().getValue()[0].id;<br /> var oPricelist = Xrm.Page.getAttribute("ews_pricelistid").getValue()[0].id;<br /><br /> var pagecontext = Xrm.Page.context;<br /> var serverUrl = pagecontext.getServerUrl();<br /> var oDataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";<br /> var oDataSelect = oDataPath + "/ProductPriceLevelSet?$select=Amount&$filter=PriceLevelId/Id eq guid'" + oPricelist + "' and ProductId/Id eq guid'" + oProduct + "'";<br /><br /> alert(oDataSelect);<br /><br /> $.ajax({<br /> type: "GET",<br /> contentType: "application/json; charset=utf-8",<br /> datatype: "json",<br /> url: oDataSelect,<br /> beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },<br /> success: function (data, textStatus, XmlHttpRequest) {<br /> ProcessData(data.d);<br /> },<br /> error: function (XmlHttpRequest, textStatus, errorThrown) {<br /> alert('OData Select Failed: ' + oDataSelect);<br /> }<br /> });<br />}<br /><br />function ProcessData(query) {<br /> alert("Started ProcessData");<br /> var oData = query;<br /> var amount = oData.Amount;<br /> var amountValue = eval(amount.Value);<br /><br /> alert(amountValue);<br /> Xrm.Page.getAttribute("ews_rate").setValue(parseFloat(eval(Amount)));<br />}Unknownhttps://www.blogger.com/profile/01609295450380907262noreply@blogger.comtag:blogger.com,1999:blog-3101394961765670978.post-32928238271551685892011-03-08T18:59:54.403-05:002011-03-08T18:59:54.403-05:00Excellent post. I wish I had read this before I u...Excellent post. I wish I had read this before I used oData in CRM 2011 myself for the first time.<br /><br />You will save people a lot of time if they use this blogAnonymousnoreply@blogger.com