ARIS Community - We Love BPM

Updating attribute for a object

sunilsbo's picture
by Sunil Oza in Reports & Macros posted on 2018-02-14

Hi,

I'm trying to update the attribute for an object in the selected model.  Using the script, first I want to open a database using a dummy user who has read access on this database as the user who will execute the report don't have direct access to some groups in the database. 

Based on the objects selected the script will then update the attribute of an object in the selected model with the name or names of the objects selected with ";" as a separator. I'm using Dialogs.BrowsArisItems(String sTitle,String sDesc,String servername,String databasename,Constants.CID_OBJDEF,null,"")

The ArisData.openDatabase("dbname","username","password",filter,locale,true) gives null.

Can anyone suggest if there is any other way to do this and if can share a code for this?

 

Please find the attached code I've written and suggest corrections if any required.

 

364 Views
0 Likes
3 Comments
Sorry there are no tags
Attachments
Francois Du Toit posted on 2018-02-14

Hi Sunil,

I believe you have to "recreate" the selected model list using the oreadDb instance. When you use selModels, the items still refer to the user's login context.

Hope that helps :)

Rgs,
Francois

Sunil Oza posted on 2018-02-15

Hi Francois,

Thanks for the reply. 

I've tried this way but in Dialogs.BrowseArisItems() it doesn't show the object definitions. Please see the attached code and suggest if this requires any change. 

In code, scriptUser has read access to group and subgroups under 10.xxx whereas user executing script doesn't have access  to 10.xxx group and subgroups.

Thanks in advance.

Sunil

File attachments: 
Kay Fischbach posted on 2018-02-14

Hello Sunil,

considering your login problem arises relatively early at the beginning of your code, let's fix that first.

Please make sure that all parameters you pass to the openDatabase method are correct.

As can be read in the ARIS Script method help the method openDatabase has the return value

"Database - Object of the opened database or null</null> if the database does not exist or in case of an incorrect database login."

With your method of acquiring the database name and the localeID I think it's highly unlikely that the method returns null because of an incorrect database name or localeID. The readOnly boolean value is also a simple true, so that can't be incorrect either.

Left options are

  • the filter GUID is incorrect. Double check that in the ARIS Architect in the administration tab > Configuration > Conventions > Filter > right click on the filter you want to use > Edit > displayed GUID matches the GUID used in the report.
  • The "scriptuser" user has insufficient privileges to log into the database. Use the username and password used in the script to open the ARIS Designer/Architect software and then try to manually log into the database.
    • If the database you want to log into is not displayed in the Explorer tab your scriptuser has no read privileges anywhere on the database you want to log into. In that case contact someone who can give the "scriptuser" user read rights on the target database.
    • If you see the database but when trying to "Log in with options..." you can't find the needed filter, contact someone who can allow the "scriptuser" user to log into the database with the needed filter