How to check if "Opened by" is not part of the decision table results on flow designer

mfhaciahmetoglu
Mega Sage

Hi,

 

I have a problem that I am having hard time to come up with a solution.

 

For a catalog request, I have a decision table with user outputs (sys_user). Based on the business unit on the request form, different approvers are produced as results of the decision table and subsequently approvals are generated to one ore more users coming from this decision table. 

 

Now, I need to make sure that if the person who opened the request is also part of the results of the decision table, we should skip that approver, as it does not make sense to ask for the approval of the person who opened that request.

 

Any ideas?

 

Thanks!

 

Best,

Firat

1 REPLY 1

Periyasamy P
Tera Guru

Use decision API to get all answer from your decision table. And check whether opened by user in this answer list, if yes then skip the approval.

 

Example:
var dt = new sn_dt.DecisionTableAPI();
var response = dt.getAnswers("3c4464a7b701230034d1da23ee11a993");
gs.info(JSON.stringify(response));

Output:
{
 "result": [
  {
   "answerElementValues": [
    {
     "valid": true,
     "answerElementName": "u_user",
     "label": "Abel Tuter",
     "value": "62826bf03710200044e0bfc8bcbe5df1",
     "table": "sys_user"
   }],
  "valid": true,
  "multipleAnswerRecord": true,
  "label": "User: Abel Tuter",
  "value": "76e19cd953d7011097a3ddeeff7b122c",
  "table": "sys_decision_multi_result"
  },
 ]
}