I'm trying to create a custom workflow action with an output parameter for error handling. Working from various examples, I can't get Parameter Direction="Out" to work. Everything seems right, but when I try to assign the output to the "error" variable in SharePoint Designer, it places asterisks around it and flags it as a workflow error. Here is what the action XML looks like:
<Action Name="Create Folder"
ClassName="ActivityLibrary.CreateFolderActivityTest"
Assembly="ActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx"
AppliesTo="all"
CreatesInList="ListId"
Category="Custom">
<RuleDesigner Sentence="Create a folder %1 in the %2 base folder. If an error occurs it will be output to %3.">
<FieldBind Field="FolderName" Text="folder name" Id="1" />
<FieldBind Field="BaseFolderPath" Text="folder path" Id="2"/>
<FieldBind Field="OutError" DesignerType="ParameterNames" Text="out error" Id="3"/>
</RuleDesigner>
<Parameters>
<Parameter Name="FolderName" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="BaseFolderPath" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="OutError" Type="System.String, mscorlib" Direction="Out" />
</Parameters>
</Action>
I think you may want Direction="InOut" from the looks of the binding
Are you sure the issue is with the parameters and not maybe the variable in SPD? Certainly nothing looks wrong with your XML.
I always hated the way SPD and workflows make you create a variable within the workflow and another within the page to assign to the same value as the workflow variable.
Did you get anywhere with this? I suspect the problem was more likely in your logic code rather than this xml (.actions) file. It looks perfectly acceptable to me.
Related
I am lost. I've got a Web project that comes with a config file and several parameters which need to be set differently per target environment. I have an app setting and a connection string. The DEFINE values need to be replaced.
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="HostUri" value="DEFINE"/>
...
</appSettings>
<connectionStrings>
<add name="DbConn" connectionString="DEFINE" providerName="System.Data.SqlClient"/>
</connectionStrings>
...
</configuration>
I've got a parameter specification which an Azure App Service Deploy task uses later during deployment. Here, I specified both values to be replaced.
parameters.xml:
<parameters>
<parameter name="HostUri" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/appSettings/add[#key='HostUri']/#value" />
</parameter>
<parameter name="DbConn" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/connectionStrings/add[#name='DbConn']/#connectionString" />
</parameter>
</parameters>
While the app setting HostUri is correctly replaced, the connection string DbConn stays untouched. I do not even get the default value set. It keeps its value DEFINE as originally set in the Web.config.
My gut tells me my XPath /configuration/connectionStrings/add[#name='DbConn']/#connectionString is incorrect, but it looks okay to me and follows what other posts have done, such as Cobus Bernard.
Any help is greatly appreciated.
I studied log files and found that MSBuild treats connection strings differently:
...
Adding declared parameter 'HostUri'.
Adding declared parameter 'DbConn'.
Adding declared parameter 'DbConn-Web.config Connection String'.
...
The last line led to an unwanted entry in the the generated file SetParameters.xml:
...
<setParameter name="HostUri" value="Replace me!" />
<setParameter name="DbConn" value="Replace me!" />
<setParameter name="DbConn-Web.config Connection String" value="DEFINE" />
...
So my XPath was correct, but this special directive put a DEFINE into my target Web.config. I found two solutions to this, primarily based on this SO question: How to Publish Web with msbuild?
1) Tweak your project file
Unload you Web project, edit the project file and add in your desired configuration the following line:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<!-- Add this line: --
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
...
</PropertyGroup>
The build process will pick this up and stops treating connection strings special.
I find this solution too hidden and people will forget so the alternative is a bit more explicit:
2) Configure MSBuild
Pass an explicit argument to MSBuild when the release package gets built:
msbuild /P:Configuration=Release;AutoParameterizationWebConfigConnectionStrings=false;...
My source xml looks like this :
<connectionStrings>
<clear />
<add name="StrConn" providerName="SQLNCLI10"
connectionString="Server=dbserver;Database=db;User Id=user;Password=pass;" />
</connectionStrings>
Notice the seemingly innocent <clear /> tag.
Once I've imported this xml, and made changes to the xml file i.e: the connection string. All single tags in the document like <add /> or <clear /> are rewritten to long form eg: <clear></clear> and this prevents my service / app from even running.
It seems crazy since ultimately it seems like valid XML, but yeah it dies with an unknown fault exception, but when replacing the clear tags to all be <clear /> and not <clear ></clear> it works.
How can I prevent installshield from transforming these tags?
Are you using the 'update xml' feature? Try using the 'udpate text file' instead. That's a bit ugly to use for xml files but it works (we've been using it before the update xml feature was introduced)
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
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.
Does the current version of Log4net have a way to create a RollingFileAppender with composite rolling style where the rolled files always preserves the given extension (.log in my case)?
Example of the format I would like:
MyLog.log
MyLog.2011-04-10.1.log
MyLog.2011-04-10.2.log
MyLog.2011-04-10.3.log
I found this post which says that there is a "PreserveLogFileNameExtension" property, but that it's not included in the official binaries. Is this still the case?
If so: Can anyone explain why this property is still not an offical part of Log4Net? I am a bit sceptical to use a custom build, but maybe I should not be?
I am also curious to know why the default functionality does not preserve the file extension. I do not see why it would gain the user that all the log files have different extensions.
Edit: Got it working by doing this:
1: Downloading and building the log4net source code
2: Applying these patches: https://issues.apache.org/jira/browse/LOG4NET-64
3: Setting PreserveLogFileNameExtension to "true" in the config.
Have you tried these parameters?
<file value="log-files\MyLog" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd'.log'" />
<param name="StaticLogFileName" value="false" />
It will preserve the extension, but will give you a date in every filename like this.
MyLog2011-05-16.log
MyLog2011-05-17.log
MyLog2011-05-18.log
MyLog2011-05-19.log
Maybe it is possible to combine this with the size rolling?
The situation is unchanged. There is no newer release of log4net. It is quite unclear to me when (if) there will be a new release...
I think you do not need to worry to much about using a custom build. Test your software, if it works it is good enough.
EDIT: There is a new release that should include LOG4NET-64. Of course you can still stick to your custom build.
I'm using this configuration:
<file value="" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.log'" />
<staticLogFileName value="false" />
To get filenames like:
20111101.log
20111102.log
20111103.log