locked
Update the field valuse based on combination of conditions RRS feed

  • Question

  • I have a requirement to update a filed value on a particular enity based on diffrent conditions. For eg:- I have 3 fields in an entity called Country,State and City. For each combinations, i need to set a diffrent owners for the record. If country is U.S and State is Newyork owenr will be set as ABC. If country is U.S and state is Texas, then Owner will be XYZ. Such a way ineed to check all the permutationas and combinations and create a rule engine. Can any one suggest an approach or solution for this scenario?
    Thursday, April 10, 2014 8:47 AM

Answers

  • Hi,

    From my perspective configuration entity usually should consist only some basic key-pair value. And the address - user mapping as separate entities as this is utilised to be your mapping criteria.

    If I may know, what kind of different combinations of rules that you have? Do they follow the same logic?

    As far as I understand from your question, you only match City, State and Country fields as selection criteria and assign default owner against criteria. Is that correct? 

    If the matching criteria always be the same pattern (City, State and Country to map the Owner), then you only have 1 rule, which can be implemented using a plugin. 

    maybe pseudo code for this rule will be:

    1. Select default owner from the address - user mapping entity where city = your record city AND state = your record state AND country = your record country.

    2. If the record is found, update your record owner to the selected default owner.

    • Marked as answer by Linta Prince Friday, April 18, 2014 5:43 AM
    Friday, April 11, 2014 1:24 PM

All replies

  • Hi,

    Personally I would create a custom entity to store the mapping. Since your scenario seems to be more into Key mapping. 

    The entity will consist of 2 Field, this could be free text or global optionset (Country and State) depends on your choice, and 1 Lookup to SystemUser (Default Owner).

    Then you could use plugin on Update Request to search this mapping entity based on the Country and State to get the default SystemUser, then set the retrieved SystemUser to the current object.

    I hope it answers.

    Cheers,

    Andre

    Thursday, April 10, 2014 9:51 AM
  • Depending on the budget and the need for configurability, it might be a good idea to use a business rules engine like InRule (http://www.inrule.com/).

    That would allow for an interface that lets the business update owner assignment after deployment, such as when a new person is hired, or someone quits.


    The postings on this site are solely my own and do not represent or constitute Hitachi Solutions' positions, views, strategies or opinions.

    Thursday, April 10, 2014 12:49 PM
  • Thanks Andre!

    I will have an entity for configration, there i will add all the rules. For eg:- when the user creates a records with city Dallas, State Texas and Country U.S then, the owner will be ABC. But i have diffrent combinations of rule available in configuration entity. The challenge here is that how can i check all the possible combinations of rules? I don't want to include thousands of if conditions.

    Friday, April 11, 2014 11:54 AM
  • Hi,

    From my perspective configuration entity usually should consist only some basic key-pair value. And the address - user mapping as separate entities as this is utilised to be your mapping criteria.

    If I may know, what kind of different combinations of rules that you have? Do they follow the same logic?

    As far as I understand from your question, you only match City, State and Country fields as selection criteria and assign default owner against criteria. Is that correct? 

    If the matching criteria always be the same pattern (City, State and Country to map the Owner), then you only have 1 rule, which can be implemented using a plugin. 

    maybe pseudo code for this rule will be:

    1. Select default owner from the address - user mapping entity where city = your record city AND state = your record state AND country = your record country.

    2. If the record is found, update your record owner to the selected default owner.

    • Marked as answer by Linta Prince Friday, April 18, 2014 5:43 AM
    Friday, April 11, 2014 1:24 PM