11-07-2016 10:39 PM
Hello,
I am trying to migrate a workflow that worked in GMSC 2014 and 2015 to GMSC 2016. The problem is, that it's using a custom view and is throwing an error, when it's started:
c:\Program Files\Intergraph\GeoMedia SmartClient\Program\Workflows\Views\Shared\CustomForm.cshtml(14): error CS1501: No overload for method 'IncludeCustomScripts' takes 2 arguments
This looks to me, like something fundamental with the method "IncludeCustomScripts" has changed for using such customized views. If I remove the methodcalls the workflow is starting but ofc without the necessary scripts and styles.
@using Intergraph.Emea.Workflows @using Intergraph.Dach.Global @using Intergraph.Dach.Global.Controllers @model WorkflowViewModel<Form> @{ ViewBag.Title = Model.Node.Label; ViewBag.ScriptBag = new Dictionary<string, string>(); ViewBag.FormHelpBag = new List<FormHelp>(); Layout = "~/Views/Shared/_SiteMaster.cshtml"; } @section ScriptSection{ @{ Html.RenderPartial("ScriptFormControl"); } @Html.IncludeCustomScripts(Url, Model.SubModel.CustomScripts) @Html.IncludeCustomStyles(Url, Model.SubModel.CustomStyles) <script type="text/javascript" id="ClientViewModel"> @Html.Raw(string.Concat("IG.WorkflowContainer =", Html.ToJson(Model), "; IG.formSettings = IG.WorkflowContainer.submodel;")) </script> } @section WorkflowMainSection{ @using (Html.BeginForm("Form", "Save")) { @Html.EditorFor(m => Model.SubModel, "FormTemplate") } } @section WorkflowMenuSection{ <div class="ig-column-menu-header"> </div> <div class="aa" style="background-position: left bottom; background-color: #FFFFFF; top:5px; background-image: none; background-repeat: repeat; background-attachment: fixed;"> @Html.Raw(@Html.TreeView("legend", (List<LegendEntry>)LegendController.GetLegendWithRoot(), l => l.Childs, l => Html.ActionLink(l.Name, "Legend", null, new { onclick = "IG.getFieldById('SIMPLEIDS').setValue(addremove([" + l.SimpleId + "],getArray(),IG.getFieldById('FEATURES').getValue()));return false;IG.formSettings.tabs[0].groups[0].fields[4].sortable = false;" }).ToHtmlString())) </div> <!-- new { id = l.SimpleId } --> <script type="text/javascript"> @Html.Raw(string.Concat("IG.vent.on('form:ready', function(){" , "$('#FEATURESwrapper').find('.ig-label').hide();IG.getGridById('FEATURES')._jqNode.delegate(':checkbox', 'click', function (e) {IG.getFieldById('FEATURESSELECTION').fill(IG.getGridById('FEATURES').localSelection.length);});", "IG.getFieldById('SIMPLEDIDSELECTALL').value.subscribe(function(newValue){ setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},300) });", "IG.getFieldById('SIMPLEIDS').value.subscribe(function(){ setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},300);setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},1200);setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},2000); setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},3000);});", " getArray=function(){ return array=$.map(IG.convertToArray(IG.getFieldById('SIMPLEIDS').getValue()),", " function(val,i) {return parseInt(val);});};addremove=function(simpleid,array,gridselection){", " setTimeout(function(){for(var i = 0; i < gridselection.length; i++) {", "if(i<gridselection.length-1){ ", "window.top.IG.getGridById('FEATURES').setValue(gridselection[i]);IG.getFieldById('FEATURES')._toggleActionColumn(true)}", "else {", " window.top.IG.getGridById('FEATURES').setValue(gridselection[i]);IG.getFieldById('FEATURES')._toggleActionColumn(true)", " }", "}},500);setTimeout(function(){$('#FEATURES').click(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)})},600);", "arrayselektion = simpleid; var ff = _.intersection(array,arrayselektion);if(ff.length==0){array =_.union(array,arrayselektion)} else {array = _.difference(array,ff);}return array.toString()} ; IG.getFieldById('SIMPLEIDSLOAD').setValue('" + LegendController.GetLegendWithRoot()[0].SimpleId + "');$('#FEATURES').click(function(){setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},300);setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},900);setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},1400);setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},2000);}); IG.util.toggleWorkflowNavigation(); $('.k-icon').click(function(){setTimeout(function(){IG.getFieldById('FEATURES')._toggleActionColumn(true)},300);});", "gridselect =function(selectionsarray){for(var i = 0; i < selectionsarray.length; i++) { if(i<selectionsarray.length-1){", "IG.getGridById('FEATURES').setValue(selectionsarray[i]);}", "else {", "window.top.IG.getGridById('FEATURES').setValue(selectionsarray[i]);}}};", "window.top.IG.getFieldById('FEATURESSELECTION').value.subscribe(function(newValue){ selectionsarray = IG.convertToArray(IG.getItemById('FEATURES').getValue());", "if(newValue!=IG.getFieldById('FEATURESSELECTION_OLD').value() && IG.getFieldById('DELETED').getValue()==0){ IG.getFieldById('SIMPLEDIDSELECTALL').fill(IG.getFieldById('FEATURES').getValue().toString()); IG.trigger({triggerNames:['RemoveSession']}); IG.trigger({triggerNames:['RemoveSession2']}).done(function(){", "IG.getItemById('FEATURES').reload().done(function(){ IG.getFieldById('FEATURES').setValue(gridselect(selectionsarray));IG.getFieldById('DELETED').setValue(1);}); ", "IG.getFieldById('FEATURESSELECTION_OLD').fill(newValue)}); }})})")); </script> }
I can't figure out how to get this running in 2016. Some help is much appreciated. Thanks!
Regards,
Sven
Solved! Go to Solution.
11-08-2016 06:03 AM
A workaround that made this custom view work for me is to remove the two method calls in line 14 and 15 and load the custom scripts and styles separately.
Is there any method how to do this in a clean way like in GMSC 2015? What is the reasoning on removing these methods or why don't they work any longer?
Regards,
Sven
11-08-2016 06:08 AM
Hi Sven,
I guess the way to add custom scripts and styles has changed because of the new locations (they are now in a subfolder with the workflow name). In doing so they have probably changed the objects used...
Thanks for sharing your solution.
Regards,
Stefano
08-28-2019 12:17 AM
Hi all,
Is there anything official how to use IncludeCustomScripts in newer (16.5 in my case) GMSC versions?
The workaround from Sven works (thank you), but its quite ugly to manualy include all the scripts (and styles).
Thank you and regards,
Marco
10-01-2019 05:23 AM
Greetings all,
There were changes in design between the past GMSC versions and 2018 (16.5) for this 'IncludeCustomScripts' method. The changes were introduced in GMSC 2016 (16.0).
The 'IncludeCustomScripts' method now takes 3 arguments and is called as follows:
@Html.IncludeCustomScripts(Url, Model.Workflow, Model.SubModel.CustomScripts)
The reason for this design change was the difference in folder structures in GMSC versions newer than 2015 ie. each separate Workflow now has specific Custom folders.