Kentico 11 - How to make the search Dialog inside an Uni Selector search for other than name - kentico

I have a situation with a custom user interface where I need to use an UniSelector-type component but the displayed names of the objects would be composite, e.g: 'ClientPrefix + " - " + ClientName'.
This would be trivial to do by creating a macro on the DisplayName property of the selector, however, if the client uses the search dialog he's not able to search by the Prefix part of the objects.
I know that an UniSelector component uses the "selectall" query so I tried using a view there to bring a new "ClientCodeName" column with the final name and it works properly in place of the macro above, however the search still ignores it and searches by name only.
There doesn't seem to exist a property for this on Kentico. Is there a way to modify this behaviour? I
would be fine creating a custom unigrid implementation if it would come to this, as long as I can still keep the solution as a Custom module interface.
If client searches for 1401, nothing comes up

There is a field under the advanced options of the uni selector called "Additional columns". Add the columns to this that you want to have it also search through.

Related

Defaulting parent entity of custom activity

This should be a simple thing, but as I am quickly finding out with CRM 2011, simple things almost never are...
Anyway, I have a custom activity type, a "Trip". A Trip represents a single visit by a service technician to a client's site. Trips are always created in connection with a Case (Incident) and never with any other entity type, so the entity exists as a custom activity that does not "Display In Activity Menus". That allows me to drop a subgrid of Trips into the primary Case view, making it the only place these things can be created.
The problem is that when I try to create a new Trip from the Case form (by clicking the subgrid and choosing "Add New Trip" from the ribbon), the "Regarding" field isn't populated with the Case that I was on when I clicked "Add". Any of the "built-in" activity types will default their corresponding field with no problem, so it would seem to me that I can do the same here. The field's supposed to be read-only once this defaulting works, but just so I can set up the reference when creating new Trips, I've made it editable, and of course when you pop up the lookup, you can assign this Trip to anything (which is why I want the field read-only in the first place).
I need the form to default the parent Case when the Trip form loads. It has to be there when it's first created, because if it isn't there on the first save, then some plugin code that sets other default values (namely data relating to other Trips that may or may not exist for the same Case) won't work properly.
I read about relationship field mapping, where you can default the values of various fields based on fields of the parent entity, but the relationship between the Incident and my Trip is not listed as mappable from either side and I can't figure out how to make it mappable. I also know it's possible to set default values using JavaScript, but if there's a less "custom" way to set this particular behavior up I would love to know how.
As an epitaph based on Mike's comment, it does indeed seem that Microsoft doesn't want this done. But, it's still possible to do it. The basic steps are:
Download the Ribbon Workbench solution and import it into CRM.
Create a new solution containing the entity or entities you want to be able to customize.
Create a JavaScript file containing functions that will open the form you want and pass the information you need as a parameter. There are two ways to specify the parameters; you can define custom parameters on the form, or you can use Microsoft's undocumented parameters for the Regarding field:
function OpenNewTripFromCase()
{
var entityId = Xrm.Page.data.entity.getId();
var entityTypeCode= Xrm.Page.context.getQueryStringParameters().etc;
var entityDisplayName = Xrm.Page.getAttribute("title").getValue();
var params = {};
params["pId"] = entityId;
params["pType"] = entityTypeCode;
params["pName"] = entityDisplayName;
Xrm.Utility.openEntityForm("cst_trip", null, params);
}
Import this JavaScript file as a Web Resource, and add it to the Solution so it will be available to Ribbon Workbench.
Open up Ribbon Workbench and open the solution you created with your entity and resources. Click the Solution Elements tab, and find the "Commands" item. Right-click and select "Add New". Now expand the list, find and click on your new command. In the Properties pane, change the name of the command to be more descriptive (it's recommended you only change the third "Command#" term), then click the magnifying glass button to the right of the Actions field.
In the window that pops up, click "Add", then choose "JavaScript Function Action". A new item will be added to the action list. Click it, then in the properties pane to the right, find the library containing your function, then type in the function name. I didn't get any sort of IntelliSense here, so be careful typing in the function name. Add parameters if you need to (you shouldn't need to with the code above), then click OK
Now click the custom activity entity in the Entities list of Ribbon Workbench, then in the dropdown to the upper right of the ribbon layout, select the SubGrid ribbon. Create a button in this Ribbon, give it the icon and text you want, and in the Properties pane, set the Command to the command you just created.
Publish the customized Solution, and you should, if you did everything correctly, have a new button that will do the same thing as the "Add New" button when you've selected a sub-grid, but will additionally populate the Regarding field.

Get listitems from Current Site

I am trying to create a Page Layout, that should have a lookup field. Lookup field should always get populated with a list's items.
This list will exist in all subsites, so whereever I create this page, list should get populated with listitems from current site.
I tried using site column lookup field, but it always point to list under top site and not the current site.
Any suggestion on how to make it work or better alternative? Thanks!
Let me know if I can provide more info.
The most straightforward solution I can think of is using a cross site lookup column and creating a seperate fields for each subsite. However, you will need to create and use different Page Layouts for each subsite.
You can use http://sp2010filteredlookup.codeplex.com/ for cross site lookups.
Solution 1 - Use http://sp2010filteredlookup.codeplex.com/
Use filtered lookup solution. So let's say you have your custom Page Layout and custom Page Content Type.
Every time you create new subsite, you should remember go to Pages list settings and edit Page Content Type by adding cross site lookup (with the same field "internal name").
So you still have one Page Layout (and one Content Type). But for each Pages library instance, Content Type contains diff fields (but with the same Internal Name). It will allow you run CAML queries and other things needed without any problems.
Solution 2 - develop custom sharepoint field type.
In edit mode, control will render "dropdown list" and populate data from list instance that is on current subsite. In the field settings you can have relative list url.
Solution 3 - hidden text field / js snippet solution
Page Content Type can contain hidden text field (it can contains selected field value in json format for example). Develop js snippet that will handle all the logic (rendering in edit/view mode, saving etc) and put it on Page Layout (aspx).
I would suggest to use solution #1 or #2.

Add finding attribute by name in Opencart Admin panel: Catalog - Attributes - Attributes

How to implement Attribute to find his own name in the admin area in Opencart : Products - Attributes - Attributes? Is that there is a separate field and simply by driving into the field and displays the name of the attribute is an attribute, as usual searching for items in the admin by name, but only with attribute
It's hard to understand what you are asking, but if you are trying to use attributes for products then you must first define them at catalog>attributes>attributes.
To List attributes in the Products tab you will need edit these files
admin>view>template>catalog>product_form.tpl
admin>controller>catalog>product.php
If your understanding of PHP or Opencart isn't very strong it will help you to copy data from the attribute.php controller to the product.php controller.
As for the search function, this is something I haven't done before but you could try using the search function on the front of the website as reference.
I recommend working through this as best you can then asking more questions if or when you get stuck.
*Update
Ok so since HTML is your strenth it will be smartest to start from there. Open any of these files (the ones that have the data you need).
admin>view>template>catalog>attribute_form.tpl
admin>view>template>catalog>attribute_group_form.tpl
admin>view>template>catalog>attribute_group_list.tpl
admin>view>template>catalog>attribute_list.tpl
Then work backwards with what you see. The tpl will show variables that look like $attribute, track these back to
admin>controller>catalog>attribute.php
admin>controller>catalog>attribute_group.php
And you will see how all the code is used to pull the data from the model and format it if necessary.

Sharepoint 2007 Data view Webpart custom parameters

I'm sort of new to the custom parameters that can be setup on a DataView Webpart.
There are 6 options:
- None
- Control
- Cookie
- Form
- QueryString
- Server Variable
I think that None, Cookie and QueryString speak for themselves and are pretty straightforward.
The issue comes from the other 3. There isn't much documentation as to what they are and how they can be used (or I haven't found it)
I know that there's plenty of tutorials that explain that a dropdown can be a matched to a dataSource and then used as a parameter source 'control'.
If you don't use a datasource it seems that parameter source 'control' isn't the right item to pick as the parameter specified will never be populated with the dropdown values.
If anyone could explain the different parameter sources? Also how would one use checkboxes or a simple input text box to filter a dataview webpart?
Thanks for any tips/help.
ps: here's the link to the dropdown parameter use:
http://sharepointxperiments.wordpress.com/2009/08/03/multiple-filters-on-a-data-view-webpart/
The other 3 are:
Control: Binds the DataForm(or View)WebPArt to a control somewhere on the page using the following syntax:
<ParameterBinding Name="Meal" Location="Control(clStartDate)" DefaultValue="01-01-2010"/>
or
<ParameterBinding Name="StartDate" Location="Control(clStartDate, SelectedValue)" DefaultValue="01-01-2010"/>
Where clStartDate is an ASP.NET Calender Control.
You see that Control() takes either 1 or 2 parameters, the second is the name of the property on the control you want to use (i.e. 'Text' or 'SelectedIndex' etc etc.).
If you leave it empty (like in option 1) it will use the Control's DefaultProperty (as defined by the control itself).
As for the Form option, I've never used it before but I'm guessing it can be used to bind to a value received through a Form POST action.
More info can be found here

Custom list form using sharepoint object model VS 2008

Is there a way to handle the DropDownSelectedIndexChanged for list item new form.
Let say I have a custom list named Temp having Title, Products (which is a DropDownList) and Color Shade (which is a TextBox).
When I create a list item I want to select a product from DropDownList and on the selected index changed I want to write the
business logic such as fetching the row from Color Shade list and bind the data to TextBox of Color Shade. Now I can say ok so that
a list item will be created. Is it possible using VS 2008 sharepoint object model.
you could add a custom control to your masterpage which resursively traverses your control tree (start from this.Page) to find your dropdown and attaches the event handler (which itself is defined in your custom control). Also set the AutoPostBack property to true on the dropdown once you found it.
In terms of getting a reference do your textbox within your eventhandler, you could also apply the same approach of traversing the control tree.
note, you need to ensure that event handler is attached before eventhandlers are run.
Jaap
I am not sure if I understand what you mean.
An alternative approach, and probably less work, would be to use javascript (I would recommend using the jQuery library) to automatically populate your textbox when the selection of the dropdown changes. Everything would be done clientside.
Jaap
There are some third party components that do this sort of thing as custom column types, but if you're developing from scratch you'll probably find it a lot easier doing a custom form. If you do a fully custom version of newform.aspx, you'll still be using the standard new item menu.
If you try to modify the standard controls you'll run into issues like security errors if the submitted value wasn't in the original list.
If you don't want to write your own saving code, hiding the standard new form with css and modifying the values with javascript from your custom control can work quite well.

Resources