I tried to add a button to connection subgrid ribbon. This button should only be visible if the primary entity equals 'new_visitreport'.
Here is my try:
<CustomAction Id="Visitreports.connection.customAction"
Location="Mscrm.SubGrid.connection.MainTab.Management.Controls._children"
Sequence="15" >
<CommandUIDefinition>
<Button Id="Mscrm.SubGrid.connection.AddXYZ"
ToolTipTitle="$LocLabels:Button.AddXYZ.Label"
ToolTipDescription="$LocLabels:Button.AddXYZ.Tooltip"
LabelText="$LocLabels:Button.AddXYZ.Label"
Command="Button.AddXYZ.Command"
Image16by16="$webresource:new_XYZ_16"
Image32by32="$webresource:new_XYZ_32"
TemplateAlias="o1" />
</CommandUIDefinition>
</CustomAction>
<CommandDefinition Id="Button.AddXYZ.Command">
<EnableRules></EnableRules>
<DisplayRules>
<DisplayRule Id="EntityEqualsVisitreport" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="openDialog"
Library="$webresource:new_script_open_dialog">
<StringParameter Value="3EEE3AE1-5543-433E-8123-6A14EA925A96" />
<StringParameter Value="3EEE3AE1-5543-433E-8123-6A14EA925A96" />
<BoolParameter Value="false" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
<DisplayRule Id="EntityEqualsVisitreport">
<EntityRule AppliesTo="PrimaryEntity"
EntityName="new_visitreport" />
</DisplayRule>
It seems that this rule always returns false. If I remove the display rule from command definition the button is visible, but independet of the currently primary entity.
Is there any mistake in my examply or is it not working for custom entitis although it is supported? (MSDN article)
Try using FormEntityContextRule it looks like these guys had the same issue you had. Forum Link
<FormEntityContextRule EntityName="account"/>
Related
The dot is removed by the browser and results in a value of 25 if you choose 0.25 (hence the error below).
The example config with listitems results in a dropdown in TFS. This works fine in Firefox. Chrome and Internet Explorer remove the dot and e.g. transform the value 0.5 to 5
<FIELD name="Effort" refname="Microsoft.VSTS.Scheduling.Effort" type="Double" reportable="measure" formula="sum">
<HELPTEXT>The estimated effort to implemented the backlog item</HELPTEXT>
<ALLOWEDVALUES expanditems="true">
<LISTITEM value="0" />
<LISTITEM value="0.25" />
<LISTITEM value="0.5" />
<LISTITEM value="1" />
<LISTITEM value="2" />
<LISTITEM value="3" />
<LISTITEM value="5" />
</ALLOWEDVALUES>
</FIELD>
It can be solved for Internet Explorer by putting English as language preference, but that is not a solution since most of our users have set Dutch. Setting the dot as a decimal separator isn't a solution either, because Dutch uses a comma for that.
How can I solve this without bothering the end user?
You need to define a control field .Please follow this tutorial it will surely help you.
Click here Control field numberFormat
or you can also try my sample
<Control Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.Effort" Label="Rough Estimation:" LabelPosition="Left" NumberFormat="DecimalNumbers" />
Feel free to ask if it not work .Thanks
Someone from Microsoft found the issue and they are solving it;
"FYI, we found this to be an issue with localization. We are fixing it 😊"
Is that possible to define a security role that is not able to delete any invoice but able to delete invoiceproduct of any invoice?
The environment is not customized, and the definition( Tab:Mscrm.Form.invoicedetail.MainTab-->Group:Mscrm.Form.invoicedetail.MainTab.Groups-->Group:Mscrm.Form.invoicedetail.MainTab.Save-->Controls:Mscrm.Form.invoicedetail.MainTab.Save.Controls) for the ribbon button is
<Button Id="Mscrm.Form.invoicedetail.Delete" ToolTipTitle="$Resources:Mscrm_Form_Other_MainTab_Management_Delete_ToolTipTitle" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Form.Tooltip.Delete" Command="Mscrm.DeletePrimaryRecord" Sequence="70" LabelText="$Resources:Ribbon.HomepageGrid.MainTab.Management.Delete" Alt="$Resources:Ribbon.HomepageGrid.MainTab.Management.Delete" Image16by16="/_imgs/ribbon/Delete_16.png" Image32by32="/_imgs/Workplace/remove_32.png" TemplateAlias="o2" ModernImage="Remove" />
And the corresponding Command Definition is
<CommandDefinition Id="Mscrm.DeletePrimaryRecord">
<EnableRules>
<EnableRule Id="Mscrm.FormStateNotNew" />
<EnableRule Id="Mscrm.EntityFormIsEnabled" />
<EnableRule Id="Mscrm.CanDeletePrimary" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="Mscrm.DeletePrimaryEntityPermission" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="onActionMenuClick" Library="/_static/_forms/form.js">
<StringParameter Value="delete" />
<CrmParameter Value="PrimaryEntityTypeCode" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
It seems it is not able to create such a role meet the requirement.
because
1. In the 'displayrule' section, it needs 'Mscrm.DeletePrimaryEntityPermission' permission.
2. In the 'enablerule' section, it needs 'CanDeletePrimary' permission.
Thanks in advance
I believe that's not possible using OOB functions. I would suggest to develop the plugin that will handle Delete message of invoiceproduct and throw an exception if user doesn't have required role.
I have added a content type in my custom orchard recipe but when I try to create an instance of that content type within the recipe nothing happens.
Declaration:
<Metadata>
<Types>
<Speedbump ContentTypeSettings.Creatable="True" ContentTypeSettings.Draftable="True" TypeIndexing.Indexes="Search">
<TitlePart />
<BodyPart />
<CommonPart />
</Speedbump>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
</Parts>
</Metadata>
Creation:
<Command>
Speedbump create /Slug:"valid-url" /Title:"Valid URL" /Path:"valid-url" /Homepage:false /Publish:true /UseWelcomeText:false
</Command>
Any ideas as to why this isn't working? I can go into the site after it is created and my speedbump type is defined and creatable but the instance that should have been created by the recipe doesn't exist. Thank you.
This isn't how you create content items in recipes. You add xml in the <Data> tag like so:
<Data>
<Speedbump Id="" Status="Published">
<BodyPart Text="Hello this needs to be encoded" />
<CommonPart Owner="/User.UserName=admin" CreatedUtc="2014-09-05T16:09:13Z" PublishedUtc="2014-09-05T16:15:43Z" ModifiedUtc="2014-09-05T16:15:43Z" />
<TitlePart Title="My Page" />
</Speedbump>
</Data>
For any custom parts, you will need to implement Import and Export functions in your driver method. Check core modules for good examples
I found a lot of examples how to add custom tab with custom controls on the ribbon bar. But no one works for me. I got the custom tab, but button is always disabled.
There is my current version of code:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="CustomRibbonTab"
Location="CommandUI.Ribbon"
RegistrationId="101"
RegistrationType="List">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Tabs._children">
<Tab
Id="Ribbon.CustomTab"
Title="Custom Tab"
Description="Custom Tab !!!"
Sequence="701">
<Scaling
Id="Ribbon.CustomTab.Scaling">
<MaxSize
Id="Ribbon.CustomTab.MaxSize"
GroupId="Ribbon.CustomTab.CustomGroup"
Size="OneLargeTwoMedium"/>
<Scale
Id="Ribbon.CustomTab.Scaling.CustomTabScaling"
GroupId="Ribbon.CustomTab.CustomGroup"
Size="OneLargeTwoMedium" />
</Scaling>
<Groups Id="Ribbon.CustomTab.Groups">
<Group
Id="Ribbon.CustomTab.CustomGroup"
Description="Custom Group!"
Title="Custom Group"
Sequence="62"
Template="Ribbon.Templates.CustomTemplate">
<Controls Id="Ribbon.CustomTab.CustomGroup.Controls">
<Button
Id="Ribbon.CustomTab.CustomGroup.CustomButton"
Command="CustomTab.CustomButtonCommand"
Sequence="115"
Description=""
LabelText="Custom Button"
Image32by32="/_layouts/images/PPEOPLE.GIF"
TemplateAlias="cust1"/>
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.CustomTemplate">
<Layout
Title="OneLargeTwoMedium"
LayoutTitle="OneLargeTwoMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="cust1" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="CustomTab.CustomButtonCommand"
CommandAction="javascript:alert('Hello, world!');"
EnabledScript="javascript:return true;"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
I cleaned up the cache. I read about importance of EnabledScripts attribute in the CommandUIHandler. But I always have the same result:
Did anybody have the same issue? Please help!
I checked out a local custom action of mine, and the EnabledScript followed a different pattern:
EnabledScript="javascript:function JustReturnTrue()
{
return true
}
JustReturnTrue();"
If your item is showing up, but always disabled, I bet that's where the problem is.
I think the attribute is optional anyway, if I recall.
I had the same problem, I'm not sure if this is the proper solution, I'm a newbie. I removed the element from feature which scope was set to "Site", added another feature, set the scope to "Web", added my button item in this feature, saved, deployed, enabled the new feature from site features and it worked.
Is there any way to have a custom recipe add some text and image fields to the page? It looks like part of the recipe handles commands, but I can't find any commands that do this at # http://docs.orchardproject.net/Documentation/Using-the-command-line-interface
Update
Thanks for the response Bertrand, but there are some issues with that.
I exported everything for a recipe from a tenant that has 1. added fields, 2. added parts to the Page along with 3. an added List and 4. an added container widget to the Default layer that shows the list.
<Metadata>
<Types>
<Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
<TagsPart />
<LocalizationPart />
<TitlePart/>
<AutoroutePart />
<ContainablePart />
<AmazonProductsPart />
<YouTubeVideosPart />
</Page>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
<Page ContentPartSettings.Attachable="True">
<Thumbnail.ImageField DisplayName="Thumbnail" ImageFieldSettings.MaxHeight="75" ImageFieldSettings.MaxWidth="75" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Validate" />
<PageImage.ImageField DisplayName="PageImage" ImageFieldSettings.MaxHeight="250" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Resize" />
<PreContent.TextField DisplayName="PreContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
<PostContent.TextField DisplayName="PostContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
</Page>
</Parts>
</Metadata>
...
<Data>
<List Id="/alias=page-list" Status="Published">
<CommonPart Owner="/User.UserName=admin" CreatedUtc="2012-05-26T22:52:20Z" PublishedUtc="2012-05-26T22:57:37Z" ModifiedUtc="2012-05-26T22:57:37Z" />
<AutoroutePart Alias="page-list" UseCustomPattern="false" />
<AdminMenuPart AdminMenuPosition="2" OnAdminMenu="false" />
<MenuPart MenuText="Page List" MenuPosition="3" OnMainMenu="false" />
<ContainerPart ItemContentType="Page" ItemsShown="true" Paginated="true" PageSize="10" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" />
<TitlePart Title="Page List" />
</List>
<ContainerWidget Id="" Status="Published">
<CommonPart Owner="/User.UserName=admin" Container="/Layer.LayerName=Default" CreatedUtc="2012-05-26T22:55:42Z" PublishedUtc="2012-05-26T22:55:42Z" ModifiedUtc="2012-05-26T22:55:42Z" />
<WidgetPart Title="Page List" Position="1" Zone="AsideFirst" RenderTitle="false" />
<ContainerWidgetPart Container="/alias=page-list" PageSize="5" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" ApplyFilter="false" FilterByProperty="CustomPropertiesPart.CustomOne" FilterByOperator="=" />
</ContainerWidget>
</Data>
I then inject that into a copy of the default recipe with the appropriate modules activated.
When creating a new tenant from that recipe,
All the modules are enabled, good
The list is created, good
The page has the added parts, good
The page does not have the added fields, bad
The container widget does not exist, bad
It looks like the part fields are not added, and the widget was not created.
I did another simple test, and it looks like a bug?
Repro Steps:
Add fields to the page
Add a widget
Export everything
delete the widget
Import the exported xml
Expected: The widget to be back
Actual: the widget is still missing
is the recipe suppose to honor page fields and widgets, did I do something wrong, or is this a bug?
Update
Okay, this has to be a bug. When manually adding the fields, I get this message even though it isn't showing the fields: "A field with the same name already exists."
You don't need a command, this is supported by recipes without that. The easiest way to get an example is to add a field from the admin UI, and then export the metadata and examine the recipe that created.