Project and Portfolio Management Practitioners Forum
cancel

Is it possible to update user data via a request?

Highlighted
kndlny
Super Contributor.

Is it possible to update user data via a request?

Hi,

 

Is it possible to update users user data via request's workflow step?

 

What I am looking for is that a user creates a request and selects a user from a field in this request. After transition, the value user selected from the field should be updated user data value of the user who created the request?

 

It can be done through db but this causes an inconsistency between field value in the db and field's token. Thus, the most certain way is by updating the user data token.

 

Thanks

10 REPLIES
Mohit_Agrawal
Outstanding Contributor.

Re: Is it possible to update user data via a request?

Hi..

 

You can update the user data through DB..you can call a function in the workflow step and then update the user data with the selected value of the field. You can pass the token value of the field in function and then update..

user_data = token_value.

 

If you do not wish to use DB, then one more way is...Advanced SQL Logic Rule..for  "Apply on Field Change"..

You can create the SQL rule in a way that when "Field value" contains any value.. then "User Data" should be ...(SQL Logic)

 

Thanks!!
--Mohit Agrawal
-- Remember to give Kudos, if this solves your query!!

kndlny
Super Contributor.

Re: Is it possible to update user data via a request?

Hi Mohit,

 

I have tried calling an update function but as I said, this causes a data inconsistency between db value of the user data and the token value of the user data. You will see the new value in the db, however, if you use this user data's token in workflow security, selected user will not be able to see the action buttons even though his name is in the approvers details. There has to be an action (transition or save) on the request after update function in order to make the fields and action buttons available to the selected user, in other words math the token with the db value of the user data, and that is not something we consider.

 

And I did not understand how I could use field change rule in order to update a users user data since it is not possible to select a user data field from the result fields. Can you explain this suggestion further ?

 

Thanks,

 

Utkarsh_Mishra
Acclaimed Contributor.

Re: Is it possible to update user data via a request?

Talking about inconsistency, are you updating like

 

user_data= USER_ID

visible_user_data = FULL_NAME

 

 

This should work.

Cheers..
Utkarsh Mishra

-- Remember to give Kudos to answers! (click the KUDOS star)
kndlny
Super Contributor.

Re: Is it possible to update user data via a request?

Hi Utkarsh,

 

yes, thats pretty much what I have done. You can see it from the screenshots

 

After executing the function, it is possible to seen the new values in the user data column of the user in  knta_users table, but it is not possible to see it in user data tab of the user screen in the workbench. Thus it does not update the token, it just updates the database values. But, if there is an action (save or transition) ocurs, then token will match with the db value.

 

For requests, you can call a function from a Security Util package, but still, not exactly what I need.

 

Thanks

Jim Esler
Acclaimed Contributor.

Re: Is it possible to update user data via a request?

The original value has been cached. You need to flush the user cache to get the new value picked up from the database. Also, you should set the last_update_date field in the record when you change a value in the record.

kndlny
Super Contributor.

Re: Is it possible to update user data via a request?

Hi Jim,

 

I am updating the last_update_date value.

 

What do you mean by flush the user cache?

 

You mean kRunCacheManager? If so, it would not be a sufficient solution to ask user to run this command every time s/he creates a request which has been mentioned above,will provide a change in the user's user data.

 

Thanks

Mohit_Agrawal
Outstanding Contributor.

Re: Is it possible to update user data via a request?

Hi

 

Please check once, how you are providing the token ID of user in the security tab of workflow.

 

If your Request progresses from Status A to Status B and you want that Selected user should have actions available at Status B. Then set the security in the worklflow at Decision step B according to the attached screen shot.

 

Hope this helps..

 

Thanks!!
--Mohit Agrawal

Jim Esler
Acclaimed Contributor.

Re: Is it possible to update user data via a request?

We incorporate cache flushes when needed by executing the following command step:

 

ksc_local_exec sh "cd bin;./kRunCacheManager.sh [CACHE_ID]"

 

You may have problems with this if you are running on a Windows server and the Cygwin environment is not available to the PPM process. In that case, you would need to use ssh to connect to the local server and execute the script directly in the ssh session.

 

CACHE_ID can be 'A' to clear all caches or a number to clear a specific cache. In 9.14, the Users cache is number 20. A list of cache numbers can be obtained by executing kRunCacheManager.sh with no parameters.

Oscar_Pereira
Honored Contributor.

Re: Is it possible to update user data via a request?

Other syntax options to flush the cache via a execution step...
 
OPTION 1: (Syntax for a workflow execution step)
 
 ======
ksc_local_exec bash -c "cd bin; ./kRunCacheManager.sh A"
======
 
 
OPTION 2: (Syntax for a workflow execution step)
 
=====
ksc_connect_source_server SOURCE_ENV="KINTANA_SERVER"
cd ./bin
sh ./kRunCacheManager.sh A
cd ..
ksc_exit
======
kndlny
Super Contributor.

Re: Is it possible to update user data via a request?

Hi Jim and Oscar,


I already have tried cleaning cache manually right after my operation and did not work. So, I don't see a point to try it in an execution step.

 

I thought this was a known issue. When I update only the db value of a field, the token of the field will not be updated right away. Thus, what I asked here is, whether there is way to use USR token with ksc_store or any other related command as we use ksc_store with REQ tokens.

 

Thanks.