Skip to main content

Hi guys,

 

I need to run the complex rules in the form upon submit. The rules are not very complex but I do not know the best way of handling the conditions. So, I am looking for some suggestion and best practice.

 

1. Checks for Duplicates in database. If found, inform user through messagebox that duplicate record (invoice) already exist. Else do step 2

2.Check for Duplicates in SharePoint document library (actually meta-data check). If found, inform user through messagebox that duplicate record (invoice) already exist. Else do step 3

3. run the Custom Service Broker smartobject to submit invoice into GP. If sucess, it returns vouchernumber. Show the vouchernumber in messagebox otherwise show another messagebox -invoice submission failed.

 

Please have a look at rukes I defined. not sure it its the best way of handling this.

 

13709iEEA5C35637EDD7D6.jpg

 

 


11807iA3A51B8823DB5EFC.jpg

Hi,

 

As per your business requirement, i would recommend the below rule pattern design;

 

On submit clicked()

{

// excute these two rules parallely -- concurrent---

              Check duplicate entry at DataBase();

              Check duplicate entry in SharePoint library();

}                             - end of the above executuion blok, you must have stored the output result of both the rules on hidden fields, lets say DBcheckFlag and SPCheckFlag.

 

 

IF Advanced condition (DBCheckFlag is not empty AND SPCheckFlag is not empty)

{

        Show MessageBox(duplicate entry exist);

}

 

ELSE

{

       Call Custom SmartObject to create a entry into GP and generates Invoice Number();

}

 

 

 

With this approach you can reduce number of advanced conditions and multiple ELSE execution blocks!

 

 

Hope it helps !

 

Cheers,

Prajwal Shambhu


Thank you for your suggestion. Since these rules are defined in the smartform rules using K2 designer. I dnot know how to handle rules pattern design in K2 designer tool. Can you please give me some idea ?

 


IPO, 


 


When I start working with something of this complexity, I create unbound rules. I never trust 'else' and I don't like nesting rules. 


Create unbound rules for your nested rules.


Call the unbound rule from your main rule. 


That will make the logic a bit easier to follow, and when you need to change the location of 1 rule, it won't get caugt in a "Am I nested in an Else statement?" or the Else statement needs at least one rule. 


 


Hi,

 

I standy by Chadg reply, i dont use ELSE specially when there is complex rule implementation. As Chadg suggested we can make use of unbound rules and call them inside any rules.

 

Cheers,

Prajwal Shambhu


Reply