Skip to main content
Hi all,

I got some customised code for the Preceding Rule, when a user make a choice (in a wizard) to use the code, it will be written for that particular activity, else will be nothing. This process works fine, as I check the preceding rule: click on "Use Code" --> "Edit Code", then I can see the customised code there. But this implies that the user needs to click "Use Code", any idea how to set this option to "Use Code" by default? Or would it be matter if not set this by default but user want to use the customised code?

Welcome any suggestion.

Thanks a lot.
Patrick
Apart from re-writing the Preceding Rule property template, I don't think there's any way to change the default behaviour of 'Use GUI'.

Sorry,
Ockert
Hi Ockert,

Thanks for your suggestion. I got a customised activity template, could you please provide me some guide line or example to implement the Preceding Rule property template?

Cheers,
Patrick
Hi Ockert,

In SourceCode.K2StudioAssist.Wizard.EditControl, I can't find anywhere that be able to change the default behaviour to "UseCode". Am i on the right track? or do I need to implement the IDataAssist interface so that I can set UseGUIOption?


private void editControl1_Load(object sender, System.EventArgs e)
{
UseGUIOption = SourceCode.K2StudioAssist.Core.CodeOptionEnum.Code;
}


public SourceCode.K2StudioAssist.Core.CodeOptionEnum UseGUIOption
{
get
{
return new SourceCode.K2StudioAssist.Core.CodeOptionEnum ();
}
set {
UseGUIOption = (SourceCode.K2StudioAssist.Core.CodeOptionEnum) value;
}
}



In SourceCode.K2Utilities, is there any template for implementing the "Add" "Edit" and "Remove" button? (like: SourceCode.K2Utilities.DataViewButton)


Thanks a lot,
Patrick
Sorry, I was wrong...

Apparently you can't change the 'Use GUI' vs. 'Use Code' default behaviour - even when writing your own property template. At least not through the K2StudioAssist SDK and certainly not through any other supported method.

Regards,
Ockert
Hi Ockert,

Thanks for your reply.

I was thinking another way: does K2 provide some kind of hyperlink or redirect-button that can open up the Preceding Rule window?


Cheers,
Patrick
Hi Patrick,

I assume you're referring to the Code window with the Preceding Rule displayed.
To be honest, I don't know exactly how it is called. The fact of the matter is that no matter how it is done, it is not accessible by any custom code.

Can you explain to me exactly what the problem is? I assume, you're creating a workflow process on-the-fly by using the K2Studio object model. When creating this process, you also add Preceding Rule code to your Activities. Afterwards, when you edit the process, you can not immediately see that there is already code behind your Preceding Rules. Is this correct?

Regards,
Ockert
Hi Ockert,

You are right. I got a wizard for user to set up workflow process on-the-fly, Preceding Rule code will be added to the activity only if the user ticks a checkbox in the wizard. So, not every activity in the workflow process would need my Preceding Rule code. But isn't that in K2, we have to tell it to "use code", otherwise K2 won't execute the customised preceding rule code even though the code is added for that activity (Activity.PrecRule.Code), and K2 just runs the preceding rule as normal (which is the "use GUI" mode)? That's why user need to open the code window with the Preceding Rule and click on "Use Code" (which notifies K2 that this activity should run based on the customised preceding rule code, rather than the default option). And user complains about these extra steps.

Is this correct? or we don't have to click "Use Code" to notify K2 as long as the customised code is written to Activity.PrecRule.Code?


Regards,
Patrick
Hi Patrick,

No, you don't have to explicitly select 'Use Code' for K2.net Server to execute the code.

The wizard is there to help the user (even a business user) create code. Whether you use the GUI or write some custom code behind a Preceding rule, the fact is that there exists code behind the prededing rule which will be executed by the K2.net Server. Even if you leave the preceding rule blank, there's still an empty method call for K2.net Server to make.

Hope this makes sense,
Ockert
Hi Ockert,

Thanks, it helps a lot.

Regards,
Patrick

Reply