Selecting which fields to show in address composite control - dynamics-crm-2013

By default, when creating a new account, the composite address control displays three lines for entries (Street_1, Street_2 and Street_3). It looks really inappropriate in our scenario so I'd like to remove one of there. In fact, I'd like to gain a full control of what's shown and what's hidden.
According to this blog, we can resolve this by application of business rules. I don't like it one bit.
We need to rely on a condition from one field to affect the others for the rule to kick in. It feels like giving up to the stupid computer and cheating, without actually gaining control. And lastly - it'll be a huge number of rules bouncing around back and forth in my case. Baaad karma.
How can I control the contents of a composite control?

The article mentions that hiding a field on a form, hides it on the composite address control as well. Not sure if there is some other magic going on behind the scenes, but if there isn't, just add javascript to hide the field.
Here is a little helper function:
setVisible: function (controlName, visibility) {
// Do we need to be here?
if (!controlName) { return; }
if (!Xrm.Page.getControl(controlName)) { return; }
// Set visibility.
Xrm.Page.getControl(controlName).setVisible(visibility);
},

Related

How to add an 'image' property to questions in SurveyJS Creator?

In our application, the surveys that we create need to support an 'easy read' format whereby an image may be attached to any question, to be displayed alongside the question text.
I can't see a way to do this directly via the SurveyJS API properties, i.e. there doesn't seem to be any standard questionImage property. It therefore looks like this would need to be implemented as a custom property.
On that basis, I need to add a custom property to all question types, which the user can populate with an image in the same way as the 'image picker' question type allows you to select images. Specifically, the use-case we want to support is to open a file browser to the user's local machine and for the selected image to be encoded as a data: URI and stored in this property. (Supporting additional image-entry methods might be useful, but is not required.)
We are in a position to control the rendering of this property for respondents, so I am not concerned about how to make use of this property, just how to get it into the editor UI. Also, whilst it would be nice to see the image in the editing interface, this is also not essential behaviour at this stage.
From a Google search, I have seen similar questions, where the answer has been to insert an Image or HTML element into the survey just before the relevant question, however this is not an appropriate solution for our use-case. Firstly, it makes the survey hard to manage (both fiddly to use and also easy to break things when moving/deleting questions). Secondly, it means that the Image is rendered before the question, whereas we need it to be rendered as part of the question element (i.e. after the question number, before the question text).
Can anyone give an example for how I can add a new question property that behaves in the manner described above?
You need to add this property to surveyjs metadata:
Survey
.Serializer
.addProperty("question", {
name: "image:file",
category: "general"
});
Here is the working sample - https://plnkr.co/edit/5wpQMdMq1vxKhWaG

BlackBerry 10 Cascades app stuck affecting property

I have an issue with a list/detail pattern. I have an Article class, inheriting from QObject, defining some properties (title, updated and content being the ones that matters for now). To populate my (QML) ListView, I have a C++ GroupDataModel, filled with some Article*. Here's my list's onTriggered:
onTriggered: {
if (indexPath.length > 1) {
currentArticle = dataModel.data(indexPath);
var page = articlePageDefinition.createObject();
nav.push(page)
}
}
As you can guess, the articlePageDefinition defines a page using the upper currentArticle property.
Now, when I display the articlePage once, it's working fine. I can go back, click on the same list item, display the same Article details, works great. But when I pick a second article, the app kind of freezes. I can go back in my navigation pane, but I can't click on list items anymore. I tried to add some logs, the onTriggered is stuck on currentArticle = dataModel.data(indexPath);. At this point, I can log every property of dataModel.data(indexPath) without any issue. I tried to not create/push the page, simply affect currentArticle and display some of its properties, it's working fine too. I really don't understand what I am doing wrong here, any help appreciated.
In case you need to see more code, everything is here: https://github.com/Kernald/tt-rss-bb10/tree/e29e3b616aa179dd42f66804ecc20a6a45b6bb22
Here what can cause the problem your are having:
You create the articlePage and bind it's data to the "currentArticle" global variable
When you go back the articlePage is not deleted.
You open an other instance of this same articlePage. The last one still bind its data to the same currentArticle instance.
When you go back and click another item: the previous articlePage still exists in memory. It binds to "currentArticle". The problem is, it's not the data of "currentArticle" that has changed but the object referenced by "currentArticle". The Qml binder just fails then.
I had a similar behavior of my app, but I did not inspect your github code if the reason can be the same. I think you can verify that more quickly than me.
When removing and adding a list item with the same index, the code gets stucked. I removed an entry on user action and added a new one at that place, and it got stuck. This is a known issue to BB10, I found here: https://developer.blackberry.com/cascades/download/releasenotes/#known

Clearing ISupportIncrementalLoading

I have created a search page in a Windows 8 Style App. I have implemented ISupportIncrementalLoading and when the user scrolls the paging works great.
The problem that I'm having is when a user does a second search. I apparently don't know how to get the LoadMoreItemsAsync to fire again. I've tried the following:
1) Clear the underlying collection that is Observable and supports ISupportIncrementalLoading. This clears all items from screen so I know it is bound properly.
2) Replace the underlying collection instance entirely that implements ISupportIncrementalLoading and raise INotifyPropertyChanged so the view knows the property was changed. This also, clears all the items from the screen.
However, the LoadMoreItemsAsync doesn't want to fire after clearing or replacing the underlying collection instance. My hunch is that the UI doesn't think it needs to Load any more, but since I've clear all the items it should want to load more.
I have verified that the HasMoreItems property is set to true.
If it would help, regrettably, you can see the error in production if you download FlixPicks from the Windows 8 store. The steps to reproduce are:
Search using windows search contract
Notice paging works From the Search page
Search again.
Notice all items are cleared. (At this point the LoadMoreItemsAsync is not firing)
Thanks for any advice you can provide!
This definitely looks like a bug. To solve this, add the following line after resetting your collection (in any of the cases):
gv.LoadMoreItemsAsync();
You can probably inherit from the control and create some overrides that will do this automatically:
I know this is an older issue, but I also encountered it and thought others may benefit from an MVVM approach to resolving it. My fix was, after resetting the collection, load a single item into the collection.
private async Task ResetCollectionAsync()
{
Clear();
await LoadMoreItemsAsync(1);
}
The collection is emptied and a single item is re-added. The GridView/ListView control detects the CollectionChanged event and re-queries HasMoreItems to determine whether to load additional data.
This behaviour is baked into IncrementalLoadingCollection (v1.0.1), which also supports filtering and sorting functionality out of the box.
I'm reviving an old question, but I found a solution when none of the previous answers worked for me.
myCollection = new MyIncrementalLoadingCollection();
myListView.ItemSource = myCollection; //This is what I was missing!
Since I wanted the list view to refresh every time the page was navigated to, this was my end result.
protected override async void OnNavigatedTo(NavigationEventArgs e) {
_logItems = new CommandLogIncrementalLoadingCollection();
logListBox.ItemsSource = _logItems;
}

Extend Page Property with custom controls in Sharepoint

Sharepoint is quite limited when it comes to multi-Lookups because it saves that information in strings. So I changed the Page-Property
"Elements (MultiLookup-> elementIds" on the propertyPage
to an inserted List "PageElements":
"
(SingleLookup)pageId , (singleLookup) elementId"
Because this is quite hard to maintain for my content admins I want that they can enter that information in the page properties like before instead of adding lines into "PageElements"
Therefore I want to add a control that handles that.
I do not need a solution for the task how to achieve that specific function, but a general hint how to add any custom control into a Page property.
I starting point link would be very nice. I just doen't seem to find the right words to feed google with my topic.
Solved this by using a custom field type with that logic. Basicly Described here: http://avinashkt.blogspot.de/2011/07/creating-custom-field-in-sharepoint.html

Basepage handling events with two different types of controls

My problem is thus...
I have 4 pages which all essentially do the same thing, that is to value a specific vehicle based on the information entered, each of these pages is over 3.5k lines in the code behind.
The pages need to remain separate to allow for some minor differences between the way in which each page is accessed and to allow for future changes, however they all use the same IDs for controls so I saw no reason why I couldn't move the event handlers to the base page along with primary functions, this would allow rapid addition of future pages just by referencing the base page and setting any in page overrides that I need.
So the actual problem is that I am defining the controls as public in the base page e.g.
"Public WithEvents lstCAPManufacturers As FLHighComboBox"
Now this is fine from 2 of the pages as they use our own user control FLHighComboBox, the problem arises when called from the other 2 pages which use standard .Net dropdowns and the public declaration dies. The same thing is occurring image buttons in one page which are standard buttons in the others, and .Net textboxes in one page which are (Telerik) RadTextBoxes in others.
I did consider declaring all controls of this type as objects, and then casting them to the appropriate control in a function called on page load, however this just causes masses of compilation errors and I am unable to access properties and methods for them because they are already defined as type Object.
So I'm really after suggestions for how I can make this kind of thing work, or if not how to make this work, what I should be doing instead.
Thank you.
Added custom handlers on page load for the controls that needed them and cast the others to their type on page load for those that didn't need handlers.