Project

General

Profile

Actions

Feature #1070

open

Script call is generated by script type

Added by Petr Michal about 6 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
Ondřej Kopr
Category:
Scripts
Target version:
-
Start date:
04/12/2018
Due date:
% Done:

0%

Estimated time:
Owner:

Description

When we use inserted script in attribute mapping, account management filter, etc., script call is generated based on script type, which often does not make sense.

My common usecase:
I have a simple script, that I want to use for transformation into idm and also like a transformation from idm. So I need to set the type of this script as Standard.
Problem is, that I must to add attribute attributeValue into call always when I want to use this script in transformation. This is really non-intuitive.
------------------------
Another usecase:
When I want to insert script into Account management filter in system mapping. The following code is generated:

scriptEvaluator.evaluate(
    scriptEvaluator.newBuilder()
        .setScriptCode('xxxxxxxxxxx')
        .addParameter('scriptEvaluator', scriptEvaluator)
        .addParameter('uid', uid)
        .addParameter('attributeValue', attributeValue)
        .addParameter('entity', entity)
        .addParameter('system', system)
    .build());

Problem is, that filter does not include attributeValue like transformation. So unless you delete this parameter from generated code, you will end with null pointer.
Actions #1

Updated by Petr Michal about 6 years ago

  • Description updated (diff)
Actions #2

Updated by Vít Švanda about 6 years ago

  • Tracker changed from Defect to Feature

This behavior is expected. It is possible to insert scripts from the "transformation to system" category. I did not create a new category because it would not make a good sense.
I have described this situation in the documentation where the attribute "attributeValue" is also not mentioned in the example.

The documentation is here: https://wiki.czechidm.com/7.8/dev/account-management?s[]=account#script_example_-_role_catalogue

We can't generate parametrized call of script for now.

Actions #3

Updated by Alena Peterová almost 6 years ago

Similar situation happened to me when I wanted to use a Standard script in the "transformation from" script in synchronization. This didn't generate the parameter "attributeValue", so the synchronization ended with results "ResultCodeException: Script has some errors: [No such property: attributeValue for class: Script1]".

This is really unlucky and the admin wouldn't expect the problem in the insertion of the script in GUI (I tried to find the error inside the script for several minutes). The insertion of scripts should be done with the context, where am I inserting it, and generate the parameters accordingly. Other solution would be to disable inserting any other script than "transformation from" script and enable multiple categories for one script.

Actions #4

Updated by Vít Švanda almost 6 years ago

  • Target version changed from Jade (8.1.0) to Lapis (8.2.0)
Actions #5

Updated by Marcel Poul almost 6 years ago

Alena Peterová wrote:

Similar situation happened to me when I wanted to use a Standard script in the "transformation from" script in synchronization. This didn't generate the parameter "attributeValue", so the synchronization ended with results "ResultCodeException: Script has some errors: [No such property: attributeValue for class: Script1]".

This is really unlucky and the admin wouldn't expect the problem in the insertion of the script in GUI (I tried to find the error inside the script for several minutes). The insertion of scripts should be done with the context, where am I inserting it, and generate the parameters accordingly. Other solution would be to disable inserting any other script than "transformation from" script and enable multiple categories for one script.

The exactly same situation I came across now, when connecting HR system. It little bit confused me, but was able to solve it in 10 minutes. But I guess basic admin would have hard time to use transformation scripts.

Actions #6

Updated by Vít Švanda almost 6 years ago

  • Target version changed from Lapis (8.2.0) to Malachite (9.0.0)
Actions #7

Updated by Petr Michal almost 6 years ago

  • Subject changed from Insert script into Account management filter to Script call is generated by script type
  • Description updated (diff)
Actions #8

Updated by Petr Michal almost 6 years ago

Suggestion for solution:
1) Send all the possible attributes to the script.
2) Do not show code of call to the Administrator.
- Instead of the code of the call, display only the id and the name of used script.
- If inserted script is used, we need a non-active field for writing your own script.
- The downside is, that you can not easily call two scripts. But I consulted this with team and it's not a problem.

Actions #9

Updated by Ondřej Kopr over 5 years ago

  • Target version deleted (Malachite (9.0.0))
Actions

Also available in: Atom PDF