Saving user's metadata on process

292 views
Skip to first unread message

al...@wedosoft.net

unread,
Mar 31, 2016, 2:05:45 AM3/31/16
to Fujitsu RunMyProcess Developer Community
Hi,

I want to update user's metadata on process. and that event is intermediary timer event's output variable.

output variable value script is like this. (author_id is user(composer)'s email address)

<#assign user_data = get_user_metadata(author_id)>
<#assign count = user_data.vacation + my_array.period[0]?number>
${P_change_metadata(author_id, "vacation", count)}

It means that user's vacation count is modified and saved. But when this event processed, it occurers error like this.

com.runmyprocess.error.config.UnknownUser: Unauthorized: [user email address] . User is unknown

Can you check this, and Can you guide the best practice like this case?

Regards,
Alan.

Murali

unread,
Apr 1, 2016, 2:40:08 AM4/1/16
to Fujitsu RunMyProcess Developer Community, al...@wedosoft.net
Hi Alan,

The function 'get_user_metadata' can be executed only by an ADMIN profile, and i believe this could be the cause of the error.

User guide ref: https://docs.runmyprocess.com/Developer_Guide/Process/Freemarker_Examples/Metadata

If you need to execute this by USER profile as well:

1. Please create a CAPI and in the input or output variables execute 'get_user_metadata' function and store in X.

2. Create a connector for this CAPI with hard-coded admin credentials (in Provider config)and pass any input variables required.
(like..login of the user for whom we need to get the metadata).

3. Now attach this connector to your process, in input variable of connector pass required variables like the login of the user for whom we need to get the metadata. In output variables retrieve the calculated metadata by ${P_result.X}.

Please let us know if this helps.

Regards,
Murali
Fujitsu RunMyProcess Support

al...@wedosoft.net

unread,
Apr 3, 2016, 8:46:27 PM4/3/16
to Fujitsu RunMyProcess Developer Community, al...@wedosoft.net
Hi Murali,

Thanks for your comments. Would you explain more about 2 step regarding hard-coded admin credential? Sorry, I can't understand perfectly.

What is the core difference between metadata and preference?

I knew that metadata can be modifed by admin profile only (not user profile)
I knew that preference can be modified by user(him/herself) profile (not admin profile)

In case of user's vacation count from my project, user submit vacation request and approver approve and final approve step update user's vacation count. (whether it is metadata or preferences)

and sometimes, administrator have to modify user's vacation count on User Management application or IDE user config.

Would you guide what is the best practice?

Regards,
Alan.

Richard Manga

unread,
Apr 4, 2016, 5:50:44 AM4/4/16
to Fujitsu RunMyProcess Developer Community, al...@wedosoft.net
Good Morning Alan,

Please could you check that you are passign the parameters in the following order:


${P_change_metadata("lo...@email.com", "mydata.field.2", "my new cool value")} // this will change the second item of the item "field" of the item "mydata", its new value will be "my new cool value".

As you can see, the "id" parameter should be the user email.

NB: if the connected user is ADMIN, he can update the metadata of any other user. If the connected user is not ADMIN, he can only update its own metadata.

I am waiting for your feedback,

Regards,

Richard
Reply all
Reply to author
Forward
0 new messages