Skip to content

Commit

Permalink
Fixes #18,#20
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdurow committed Sep 10, 2017
1 parent 587eefa commit 90b1025
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Develop1SmartButtons/CrmPackage/BuildScripts/pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off
set package_root=..\..\
REM Find the spkl in the package folder (irrespective of version)
For /R %package_root% %%G IN (spkl.exe) do (
IF EXIST "%%G" (set spkl_path=%%G
goto :continue)
)

:continue
@echo Using '%spkl_path%'
REM spkl workflow [path] [connection-string] [/p:release]
"%spkl_path%" pack "%cd%\.."
1 change: 1 addition & 0 deletions Develop1SmartButtons/CrmPackage/CrmPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
</ItemGroup>
<ItemGroup>
<None Include="BuildScripts\build_pack.bat" />
<None Include="BuildScripts\pack.bat" />
<None Include="BuildScripts\unpack.bat" />
<None Include="BuildScripts\UpdateBuildNumbers.ps1" />
<None Include="packages.config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ public class ResourceStrings
{
public static string ConfirmWorkflow = "Are you sure you want to run the workflow";
public static string ConfirmWorkflowMultiple = "Are you sure you want to run the workflow on {0} record(s)?";
public static string JSException = "Error: '{0}'\nPlease contact your system Administrator";
public static string WorkflowNotPublished = "Workflow '{0}' is not published";
}
}
22 changes: 18 additions & 4 deletions Develop1SmartButtons/SmartButtons.ClientHooks/SmartButtons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static void RunDialog(string name, string entityId, string entityLogicalN
<attribute name='workflowid'/>
<filter type='and'>
<condition attribute='name' operator='eq' value='{0}'/>
<condition attribute='primaryentityname' operator='eq' value='{1}'/>
<condition attribute='ondemand' operator='eq' value='true'/>
<condition attribute='statuscode' operator='eq' value='2'/>
<condition attribute='type' operator='eq' value='1'/>
Expand Down Expand Up @@ -90,8 +89,15 @@ public static void RunDialog(string name, string entityId, string entityLogicalN
[PreserveCase]
public static void QuickJavascript(string[] entityIds, string javascript)
{
string entityIdStrings = Json.Stringify(entityIds);
Script.Eval(javascript.Replace("%ids%", entityIdStrings));
try
{
string entityIdStrings = Json.Stringify(entityIds);
Script.Eval(javascript.Replace("%ids%", entityIdStrings));
}
catch (Exception ex)
{
Utility.AlertDialog(String.Format(ResourceStrings.JSException, ex.Message),null);
}
}

[PreserveCase]
Expand Down Expand Up @@ -160,7 +166,15 @@ public static void RunWorkflow(string name, string entityId, string completeCall
EntityCollection results = OrganizationServiceProxy.EndRetrieveMultiple(state, typeof(Entity));
if (results.Entities.Count == 0)
{
Page.Ui.SetFormNotification("Workflow " + name + " is not published", FormNotificationLevel.Error, "RibbonWorkflowError");
string message = String.Format(ResourceStrings.WorkflowNotPublished,name);
if (Page.Ui != null)
{
Page.Ui.SetFormNotification(message, FormNotificationLevel.Error, "RibbonWorkflowError");
}
else
{
Utility.AlertDialog(message, null);
}
}

foreach (Entity row in results.Entities)
Expand Down

0 comments on commit 90b1025

Please sign in to comment.