crm 2011 switch between multiple forms within single entity - dynamics-crm-2011

We currently design our solutions using a single form per entity. We have a current set of requirements where the 10 or so entities are similar in terms of functionality and data collection. Ideally we would like to have entity with 10 or so forms and dependent on a lookup value display the correct form on the click of a custom button.
I have previously worked with a supplier who implemented something like this displaying the correct form using the GUID (using the formid querystring parameter) on the load event using JavaScript. Although this worked 95% of the time, depending on the client machine it occassionally did not load the correct form due to timing issues i.e. the code had not properly executed by the time the form loaded.
Is there a best practice for using this kind of technique?
I guess my other options are
1) multiple entities
2) one form with tabs/sections that i show/hide on the form load
I am leaning towards implementing option 2)
Richard

The multiple forms inside of CRM 2011 is only for different roles. It is not designed to handle switching between forms based on entity attributes.
Granted what you are trying to do is possible, but you will encounter
issues and will need JavaScript to switch the user to the right form
type. You'll also cause the user to load the form twice each time (kind of ugly)
Another option is to use JavaScript to show/hide the proper elements
on the form (similar to 4.0)
Or you can just use multiple entities with a common JS file for any
kind of logic.

depending upon any field value you can switch the forms through JavaScript.
In JavaScript redirect page to url:
[serverurl]/main.aspx?etn=[entityname]&extraqs=etc%3d[entitytypecode]%26formid%3d[formguid]%26id%3d%257b[recordguid]%257d&pagetype=entityrecord
Where
entityname = entity name (e.g. incident),
entitytypecode=entity type code (e.g for incident it is 112),
formguid=guid of the form to which you want to redirect,
recordguid = guid of the record. If you skip id parameter, form will open in create mode.

Related

Filtered and Categorized view on Lotus XPages within Notes client

Hoping someone can point me in the correct direction for an XPages application we are writing inside the Domino Client (Notes?) viewer.
I have a view of documents which is being returned, this view has categories on it, and shows fine as this in an XPage, we now apply a filter to the view to limit it to specific owners of the documents, but as soon as we apply the filter, the categories disappear, which means we are left with a long list of documewnts, but unsorted - is there any way to display a filtered view in a categorized manner, on an XPage.
Moving further down my list, I also need to be able to select these documents (and one or many owners) to send to an Lotus Agent which will then create a JSON document to be sent to our friends at DocuSign requesting signatures from the selected owners on the selected documents. I'm not sure what an Agent is yet, but that is the goal ...
Caveat: I'm not a Domino developer, so excuse me if some of the terminology is incorrect.
Categorised views are a very "Notes" construct. When you filter a view, it will only show documents, but not categories. While they are practical in the back, they are cumbersome in the UI.
There are a few design considerations how to tame them in a webUI. However if your users love them, you might consider to flatten them out and recreate the categories in the UI (client side) only.
The actual better way for your use case: add another view that is firstly categorised by the owner and secondly by your category. Use the category filter of the view control to limit the documents to that author. This should do the trick. Eventually use one of the controls from the extension library.
For the agent: don't bother, that's "old Notes speak". An agent would be a piece of code (LotusScript or Java, but since you do web interaction: Java) that gets triggered by an event: manual, on schedule, on document create/update (with some delay).
Since you are in an XPage, you have easier options at your disposal: create a Bean that has the JSON format you need, add a method that takes a Notes document as parameter to populate it, something like public void populate(final Document doc) {...} and use e.g. the GSON library to simply marshall them to JSON (or a collection of them). The GSON library probably is on a current Domino, I put it there as part of VoP 1.0.
Then use a managed bean to talk to Dokusign. When traveling down the managed bean road is is much easier to test than trying to mess with agents.
Hope that helps and ask more questions! (Check the Learning XPages Cheatsheet too)

How to edit a record(s) with multiple form xpage?

I have an xpage that allows the user to choose a customer and then order products for that customer. It's not a simple xpage that created a document, uses a view control to view it and re-edits it. It will be used on the web and in the client. How do I fill in all the data for the various fields when the user wants to look at their order for a company since there are multiple documents that make up that xpage? Is there automatic processes or do I need to do it manually?
The best method is to use multiple datasources (the Notes documents) each with a different datasource name. When saved, be sure to save each of the datasources that have a change. Also, it is helpful to mark to "ignoreRequestParameters", so each one acts independently.
I have found that using the dynamic content control useful when doing things like this, it seems to reduce the number of replication/save conflicts.

How to add a property an ASP.Net user control or web page and have that property read by Microsoft coded-ui testing? (CUIT)

I am using Microsoft coded-ui testing (CUIT) in VS 2010 Ultimate to test an ASP.Net 4.0 site.
I have the source code to the ASP.Net site, so I can modify it as needed.
I've got record/playback working.
I can write simple assert statements in the test methods to check properties of the UITestControl descendents (HTML links, tables, etc.) and compare them to expected values.
I want to add properties to user controls (ASCX's) and pages in my site, to pass back useful values to the testing code.
For example, I have a user control that implements a menu which displays different sets of menu items depending on the role of the current user.
Rather than having the test script click at the various menu items to check whether or not they're present, I want to add a property to the user control. This property will return info to the caller, listing the menus and menu items present.
I've found info on the Net on how to do this in WinForms, but this code relies on accessability, which I believe is only useful for CUIT with WinForms. Likewise, I've found info on how to do it with WPF/SL.
The answer may be related to getting the UITestControl.NativeElement property, then calling a method that overrides GetProperty(), but I haven't been able to get this approach to work.
Can anyone provide a short code sample showing how to add a property to an ASCX or ASPX page, where that property can be written in C# code-behind, and read by Microsoft Coded UI Testing (CUIT) code?
Thanks!
Adam Leffert
http://www.leffert.com
I haven't found an answer to this question, but I have written some code to solve the underlying problem.
I realized that adding properties to user controls would keep the validation data together with the control under test, but only for the case where the section of UI was implemented as a user control.
There are at least two other cases I need to cover:
1) Third-party controls added to the page, for example ASPxGridView, ASPxTreeView, etc.
2) Items that are not visible in the UI, for example the user profile data for the current user.
When you're running CUIT validation code with a Web app, the data you have available is DOM data, i.e. a tree that represents the contents of the Document Object Model of the contents of the browser window. There is no Request object, .Net Page object, etc. This DOM data is accessible through the UIMap object.
I don't want to wrap the third-party controls in user controls, because doing so would disturb the application under test, causing me to re-write the application code that touches properties and events of the grid, tree view, etc. Too intrusive for testing code.
So I created a code interface (ITestable) that contains a dictionary of string values, and a list of ITestable children.
In the LoadComplete event handler of the master page, I create an ITestable for the master page and fill the list with child ITestable objects for the child page, which can themselves contain lists of children.
I serialize this object into JSON, then store it in a hidden field on the master page.
I added the hidden field to the UIMap.
The test validation code deserializes the ITestable, then looks through it for values that need validation.
The controls create their own ITestable objects, so they can easily fill the objects with values that may be needed for validation, rather than forcing the test code to manipulate the UI trying to read validation values.
For example, a tree view could return its contents without the testing code having to click on each node and try to read the value displayed there. Additional properties (visible, enabled, etc.) can be stored in the values dictionary for each ITestable object.
CUIT has some very powerful features. I would very much appreciate it if Microsoft would document some best practices for solving these non-trivial validation problems. I've read through the Microsoft documentation but haven't found much on this topic for Web apps.

How do I store this external data in SharePoint?

I am using Visual Studio 2010, SharePoint 2010 with custom document content types and forms. And plan to also use jquery to build the document add/edit/view forms.
I am developing a solution where I want to have a document library where each document uploaded also has a number of external data elements added as metadata.
The tricky part I'm trying to figure out is I want the user to be able to specify and add a multiple number of those same external data elements.
I'm trying to figure out how I represent the data internally in SharePoint. My initial thought is to programmaticly add hidden external fields as the users adds those external selections. But then I also think of simply storing those external elements as non-external text fields but have my own code which performs the external data lookup and validation.
I'm not adverse to significant custom coding, as I'm probably going to need to do a lot anyway since even the user interface is going to be a jquery tabbed form to enable all the external data the user will be able to associate with each SP document.
I've made an attempt to hopefully further explain what I'm trying to do and included that image. Essentially I'm wanting to add 1+ external data relationships to each document, as desired by the user.
It uses just example data. I'll actually have 4-7 different complex relationships much like the example. And the user is permitted to drilldown and select 1, 2 or all 3 of the dropdowns.
Think of it as similar to how here on Experts-Exchange we can add multiple zones to a question.
An example illustration is here: http://flic.kr/p/aFUSJn
Could you simply add a multi-line text column and have the user input the metadata with comma's, then use your code to seperate the data and do what you want with it?
You said you were not adverse to significant custom coding :)
One solution is to use SharePoint content types. The trick is that not all items in a list need to have the same content type.
Therefore, you can do the following:
As the user is selecting the fields he wants to use you generate or select a content type that matchs those fields.
You then add your document to the document list using the content template
You then have all your information strongly typed in SharePoint lists.
We have previously built a system where we generate content types based on xsd files, this worked very well.

SharePoint 2010 - Customizing the rendering and behavior of a List field

In my SharePoint List, I have an "Employee" column that is a User type field. I would like to add some custom Business Logic to the processing of this field.
Currently, when the user adds a row, I check to see if the user is an Employee or a Manager and then change the behavior on this column accordingly. I do this by statically rendering the field in my custom "ListForm Rendering Template", just before my custom ListFieldIterator. I simply use a standard SharePoint FormField (and FormLabel) control. In the markup of the FormField control, I specify the FieldName (Employee) and an event handler for the Load event. In this Load event, I will check to see if the current user is an Employee or Manager (using two different SharePoint groups). If the user is an Employee I set the value of the field to the current user (this part works perfectly). I also want to change the field so it can't be modified. I thought I might be able to just change the ControlMode on the field (in the code of the OnLoad Event Handler) to Display, but for some reason this has no effect. The field still renders with the full, people picker editor. Am I not changing the fields control mode soon enough? Or is this simply not the correct approach? The other logic I want to put in is if the user is a Manager, I would like to allow that user to select the person from a list (SharePoint group) of Employees. It may be easier to just use the people picker and limit the selectable users to that group. (I think I can do this with the SelectionGroup property.) Although, it would be better if I could just provide a dropdownlist of users, which I could possibly do with a hidden dropdownlist that I would show and event handlers that I could use (handle event selectedindexchanged) to pull the value selected and populate the (now hidden) Employee (user) field. Does this approach make sense? Assuming all that will work, the real difficulty I am having is with changing the ControlMode (rendering) on the field (when the user is an employee) to a label or some kind of read only control, which is how that field renders when viewing the row, which is why I think if I can just trick the control into thinking it is in Display mode then it should work perfectly!
I am still learning SharePoint, but I am very proficient in ASP .Net. This is why I would like to keep my customizations in this Custom Rendering Template, using code behind and leverage my existing skill set as much as properly.
Any thoughts, opinions or advice? Does anyone know why I can't get the column to switch the "Control Mode"?
I do not think that I fully understand your scenario. Some code samples could help.
But anyway it sounds like you want some heavy customizations of the user field. In that case you might want to have a look at creating a custom field with all its advantages and disadvantages. Have a look at MSDN: http://msdn.microsoft.com/en-us/library/gg132914.aspx
Another option might be - in case you do not want to re-use this column in many list definitions - that you can get away with your custom rendering template and create a custom create/edit form where you implement the specific edit behaviour for the field (plain ASP.NET with some SharePoint controls). Here is a nice walk-through on how to grab a custom edit form from SharePoint designer: http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2011/05/12/sharepoint-2010-cookbook-how-to-create-a-customized-list-edit-form-for-development-in-visual-studio-2010.aspx
I hope this helps. Kr., Bernd.

Resources